Commit feef5ca5 authored by Hoger Dehnhardt's avatar Hoger Dehnhardt
Browse files

added a toggle command to allow toggling between play and stop state

parent 4429cbe4
......@@ -211,6 +211,29 @@ static void com_timeout(char *arg)
jack_set_sync_timeout(client, (jack_time_t) (timeout*1000000));
}
/* Toggle between play and stop state */
static void com_toggle(char *arg)
{
jack_position_t current;
jack_transport_state_t transport_state;
transport_state = jack_transport_query (client, &current);
switch (transport_state) {
case JackTransportStopped:
com_play( arg );
break;
case JackTransportRolling:
com_stop( arg );
break;
case JackTransportStarting:
printf ("state: Starting - no transport toggling");
break;
default:
printf ("state: Starting - no transport toggling");
}
}
/* Command parsing based on GNU readline info examples. */
......@@ -238,6 +261,7 @@ command_t commands[] = {
{"stop", com_stop, "Stop transport"},
{"tempo", com_tempo, "Set beat tempo <beats_per_min>"},
{"timeout", com_timeout, "Set sync timeout in <seconds>"},
{"toggle", com_toggle, "Toggle transport rolling"},
{"?", com_help, "Synonym for `help'" },
{(char *)NULL, (cmd_function_t *)NULL, (char *)NULL }
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment