Example #1
0
PRIVATE void clock_handler(AClock *clock, AClockReason reason) {

    switch (reason) {
	case CLOCK_DISABLE:
	    jack_deactivate( jack_client );
	    break;

	case CLOCK_ENABLE:
	    jack_set_process_callback( jack_client, (JackProcessCallback) process_callback, NULL ); 
	    jack_on_shutdown (jack_client, jack_shutdown, 0);

	    jack_activate( jack_client );

	    lash_event_t *event;
	    if( lash_enabled( galan_lash_get_client() ) ) {
		event = lash_event_new_with_type(LASH_Jack_Client_Name);
		lash_event_set_string(event, jack_get_client_name( jack_client ) );
		lash_send_event( galan_lash_get_client(), event);
	    }
	    break;

	default:
	    g_message("Unreachable code reached (jack_output)... reason = %d", reason);
	    break;
    }
}
Example #2
0
int lash_clinit(int argc, char** argv, jack_client_t *jack_client, snd_seq_t *alsa_handle)
{
    lash_jackname = jack_get_client_name(jack_client);
    lash_client = lash_init(lash_extract_args(&argc, &argv), lash_jackname, LASH_Config_File, LASH_PROTOCOL(2, 0));
    if (lash_enabled(lash_client)) 
    {
        lash_jack_client_name(lash_client, lash_jackname);
        lash_event_t *event = lash_event_new_with_type(LASH_Client_Name);
        lash_event_set_string(event, lash_jackname);
        lash_send_event(lash_client, event);
        lash_alsaid = alsa_handle;
        lash_alsa_client_id(lash_client, (unsigned char)snd_seq_client_id(alsa_handle));
        return 0;
    }
    return -1;
}
Example #3
0
int lash_pollevent()
{
    if (!lash_enabled(lash_client))
        return -1;

    lash_event_t *event;
    char *l_path;
    while (event = lash_get_event(lash_client)) {
        if (lash_event_get_type(event) == LASH_Save_File) {
            lash_buffer = (char *)lash_event_get_string(event);
            l_path = (char *)malloc(strlen(lash_buffer) + 13);
            sprintf(l_path, "%s/phasex.phx", lash_buffer);
            save_patch(l_path, 0);
            sprintf(l_path, "%s/phasex.map", lash_buffer);
            save_midimap(l_path);
            lash_send_event(lash_client, lash_event_new_with_type(LASH_Save_File));
            free(l_path);
            break;
        }
        else if (lash_event_get_type(event) == LASH_Restore_File) {
            lash_buffer = (char *)lash_event_get_string(event);
            l_path = (char *)malloc(strlen(lash_buffer) + 13);
            sprintf(l_path, "%s/phasex.phx", lash_buffer);
            read_patch(l_path, 0);
            sprintf(l_path, "%s/phasex.map", lash_buffer);
            read_midimap(l_path);
            lash_send_event(lash_client, lash_event_new_with_type(LASH_Restore_File));
            free(l_path);
            break;
        }
        else if (lash_event_get_type(event) == LASH_Quit) {
            shutdown = 1;
            break;
        }
        lash_event_destroy(event);
    }
    return 0;
}
Example #4
0
int
fluid_lash_connect (fluid_lash_args_t * args)
{
  fluid_lash_client = lash_init (args, PACKAGE, LASH_Config_Data_Set | LASH_Terminal, LASH_PROTOCOL (2,0));
  return fluid_lash_client && lash_enabled (fluid_lash_client);
}