| @@ -23,6 +23,8 @@ | |||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include <jack/jack.h> | #include <jack/jack.h> | ||||
| #include <jack/metadata.h> | |||||
| #include <jack/uuid.h> | |||||
| void | void | ||||
| port_callback (jack_port_id_t port, int yn, void* arg) | port_callback (jack_port_id_t port, int yn, void* arg) | ||||
| @@ -49,6 +51,39 @@ graph_callback (void* arg) | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| void | |||||
| propchange (jack_uuid_t subject, const char* key, jack_property_change_t change) | |||||
| { | |||||
| char buf[JACK_UUID_STRING_SIZE]; | |||||
| const char* action = ""; | |||||
| switch (change) { | |||||
| case PropertyCreated: | |||||
| action = "created"; | |||||
| break; | |||||
| case PropertyChanged: | |||||
| action = "changed"; | |||||
| break; | |||||
| case PropertyDeleted: | |||||
| action = "deleted"; | |||||
| break; | |||||
| } | |||||
| if (jack_uuid_empty (subject)) { | |||||
| printf ("All properties changed!\n"); | |||||
| } else { | |||||
| jack_uuid_unparse (subject, buf); | |||||
| if (key) { | |||||
| printf ("key [%s] for %s %s\n", key, buf, action); | |||||
| } else { | |||||
| printf ("all keys for %s %s\n", buf, action); | |||||
| } | |||||
| } | |||||
| } | |||||
| int | int | ||||
| main (int argc, char *argv[]) | main (int argc, char *argv[]) | ||||
| { | { | ||||
| @@ -81,6 +116,10 @@ main (int argc, char *argv[]) | |||||
| fprintf (stderr, "cannot set graph order registration callback\n"); | fprintf (stderr, "cannot set graph order registration callback\n"); | ||||
| return 1; | return 1; | ||||
| } | } | ||||
| if (jack_set_property_change_callback (client, (JackPropertyChangeCallback) propchange, 0)) { | |||||
| fprintf (stderr, "cannot set property change callback\n"); | |||||
| return 1; | |||||
| } | |||||
| if (jack_activate (client)) { | if (jack_activate (client)) { | ||||
| fprintf (stderr, "cannot activate client"); | fprintf (stderr, "cannot activate client"); | ||||
| return 1; | return 1; | ||||