Skip to main content

Example c client API

-> -> Improvements to language bindings

Creation, deletion and modification of objects is done using asynchronous dbus messages.

gboolean        dbus_server_connect (GError**);
gboolean        dbus_server_get_shm ();
void            dbus_object_new     (action*, char* name, gboolean from_source, uint32_t src_idx, guint32 parent_idx, struct _song_pos* stime, guint64 len, guint32 inset);
void            dbus_object_del     (action*, int object_type, uint32_t object_idx);
DBusGProxyCall* dbus_get_prop_string(action*, int object_type, int property_type);
DBusGProxyCall* dbus_set_prop_int   (action*, int object_type, int property_type, uint32_t object_idx, int val);
DBusGProxyCall* dbus_set_prop_int64 (action*, int object_type, int property_type, uint32_t object_idx, int64_t val);
DBusGProxyCall* dbus_set_prop_float (action*, int object_type, int property_type, uint32_t object_idx, double val);
DBusGProxyCall* dbus_set_prop_bool  (action*, int object_type, int property_type, uint32_t object_idx, gboolean val);
DBusGProxyCall* dbus_set_prop_string(action*, int object_type, int property_type, uint32_t object_idx, const char* val);
DBusGProxyCall* dbus_set_prop_3index_2float (action*, int object_type, int property_type, uint32_t object_idx, uint32_t idx2, uint32_t idx3, double val1, double val2);
DBusGProxyCall* dbus_set_notelist   (action*, uint32_t part_idx, const GPtrArray* notes);

Objects are stored in custom containers. Containers are either top-level, eg the track list, or are properties of parent objects, eg midi event containers are properties of a Part object. Lists can also be used if you dont need random access.

void*    ayyi_container_get_item        (AyyiContainer*, int shm_idx);
void*    ayyi_container_next_item       (AyyiContainer*, void*);
void*    ayyi_container_prev_item       (AyyiContainer*, void*);
int      ayyi_container_find            (AyyiContainer*, void* content);
int      ayyi_container_get_last        (AyyiContainer*);
int      ayyi_container_count_items     (AyyiContainer*);
gboolean ayyi_container_index_ok        (AyyiContainer*, int shm_idx);
gboolean ayyi_container_index_is_used   (AyyiContainer*, int shm_idx);
gboolean ayyi_container_verify          (AyyiContainer*);

Shortcuts to container functions are provided for different object types. Eg:

void*    ayyi_song__audio_region_next       (void* prev);
void*    ayyi_song__audio_region_prev       (void* old);
void*    ayyi_song__audio_region_get        (int shm_idx);
int      ayyi_song__audio_region_find       (audio_region*);
int      ayyi_song__audio_region_get_last   ();
int      ayyi_song__audio_region_count      ();

The AyyiClient object stores information about available shared data. The Song and Mixer segments have inbuilt support. Information about other types is loaded at runtime from the the ayyi lib plugin directory.

struct _ayyi_client
    GList*                    segs;
    struct _shm_song*         song;
    struct _shm_seg_mixer*    amixer;
void ayyi_client__init();
void ayyi_client__load_plugins();