43 |
static int iSamplerChannel = 0; |
static int iSamplerChannel = 0; |
44 |
static int iAudioDevice = 0; |
static int iAudioDevice = 0; |
45 |
static int iMidiDevice = 0; |
static int iMidiDevice = 0; |
46 |
|
static int iMidiInstruments = 0; |
47 |
|
|
48 |
if (pchBuffer == NULL) { |
if (pchBuffer == NULL) { |
49 |
fprintf(stderr, "server_callback: addr=%s port=%d: ", |
fprintf(stderr, "server_callback: addr=%s port=%d: ", |
377 |
} |
} |
378 |
else ret = LSCP_FAILED; |
else ret = LSCP_FAILED; |
379 |
} |
} |
380 |
|
else if (lscp_parser_test(&tok, "TOTAL_VOICE_COUNT")) { |
381 |
|
// Current number of active voices: |
382 |
|
// GET TOTAL_VOICE_COUNT |
383 |
|
sprintf(szTemp, "%d", rand() % 100); |
384 |
|
pszResult = szTemp; |
385 |
|
} |
386 |
|
else if (lscp_parser_test(&tok, "TOTAL_VOICE_COUNT_MAX")) { |
387 |
|
// Maximum amount of active voices: |
388 |
|
// GET TOTAL_VOICE_COUNT_MAX |
389 |
|
sprintf(szTemp, "%d", rand() % 100); |
390 |
|
pszResult = szTemp; |
391 |
|
} |
392 |
|
else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) { |
393 |
|
// Get the total count of MIDI instrument map entries: |
394 |
|
// GET MIDI_INSTRUMENTS |
395 |
|
sprintf(szTemp, "%d", iMidiInstruments); |
396 |
|
pszResult = szTemp; |
397 |
|
} |
398 |
|
if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT", "INFO")) { |
399 |
|
// Getting information about a MIDI instrument map entry: |
400 |
|
// GET MIDI_INSTRUMENT INFO <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
401 |
|
pszResult = "NAME: DummyName\r\n" |
402 |
|
"ENGINE_NAME: DummyEngine\r\n" |
403 |
|
"INSTRUMENT_FILE: DummyInstrument.gig\r\n" |
404 |
|
"INSTRUMENT_NR: 0\r\n" |
405 |
|
"INSTRUMENT_NAME: Dummy Instrument\r\n" |
406 |
|
"LOAD_MODE: ON_DEMAND\r\n" |
407 |
|
"VOLUME: 0.5\r\n"; |
408 |
|
} |
409 |
else ret = LSCP_FAILED; |
else ret = LSCP_FAILED; |
410 |
} |
} |
411 |
else if (lscp_parser_test(&tok, "LIST")) { |
else if (lscp_parser_test(&tok, "LIST")) { |
460 |
} |
} |
461 |
else ret = LSCP_FAILED; |
else ret = LSCP_FAILED; |
462 |
} |
} |
463 |
|
else if (lscp_parser_test(&tok, "LIST_MIDI_INSTRUMENTS")) { |
464 |
|
// Getting indeces of all MIDI instrument map entries: |
465 |
|
// LIST MIDI_INSTRUMENTS |
466 |
|
if (iMidiInstruments > 0) { |
467 |
|
strcpy(szTemp, "{0,0,0}"); |
468 |
|
for (i = 1; i < iMidiInstruments && strlen(szTemp) < sizeof(szTemp) - 16; i++) |
469 |
|
sprintf(szTemp + strlen(szTemp), ",{0,%d,%d}", i / 128, i % 128); |
470 |
|
strcat(szTemp, "\r\n"); |
471 |
|
pszResult = szTemp; |
472 |
|
} |
473 |
|
else ret = LSCP_FAILED; |
474 |
|
} |
475 |
else ret = LSCP_FAILED; |
else ret = LSCP_FAILED; |
476 |
} |
} |
477 |
else if (lscp_parser_test(&tok, "SET")) { |
else if (lscp_parser_test(&tok, "SET")) { |
608 |
} |
} |
609 |
else ret = LSCP_FAILED; |
else ret = LSCP_FAILED; |
610 |
} |
} |
611 |
|
else if (lscp_parser_test2(&tok, "MAP", "MIDI_INSTRUMENT")) { |
612 |
|
// Create or replace a MIDI instrumnet map entry: |
613 |
|
// MAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
614 |
|
// <engine-name> <filename> <instr-index> <volume> <load-mode> [<name>] |
615 |
|
iMidiInstruments++; |
616 |
|
} |
617 |
|
else if (lscp_parser_test2(&tok, "UNMAP", "MIDI_INSTRUMENT")) { |
618 |
|
// Remove an entry from the MIDI instrument map: |
619 |
|
// UNMAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog> |
620 |
|
if (iMidiInstruments > 0) |
621 |
|
iMidiInstruments--; |
622 |
|
else |
623 |
|
ret = LSCP_FAILED; |
624 |
|
} |
625 |
|
else if (lscp_parser_test2(&tok, "CLEAR", "MIDI_INSTRUMENTS")) { |
626 |
|
// Clear the MIDI instrumnet map: |
627 |
|
// CLEAR MIDI_INSTRUMENTS |
628 |
|
} |
629 |
else if (lscp_parser_test(&tok, "SUBSCRIBE")) { |
else if (lscp_parser_test(&tok, "SUBSCRIBE")) { |
630 |
// Register frontend for receiving event notification messages: |
// Register frontend for receiving event notification messages: |
631 |
// SUBSCRIBE <event> |
// SUBSCRIBE <event> |