/[svn]/liblscp/trunk/examples/example_server.c
ViewVC logotype

Diff of /liblscp/trunk/examples/example_server.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1030 by capela, Thu Jan 11 12:33:05 2007 UTC revision 1031 by capela, Mon Jan 15 11:08:28 2007 UTC
# Line 44  lscp_status_t server_callback ( lscp_con Line 44  lscp_status_t server_callback ( lscp_con
44          static int iSamplerChannel = 0;          static int iSamplerChannel = 0;
45          static int iAudioDevice = 0;          static int iAudioDevice = 0;
46          static int iMidiDevice  = 0;          static int iMidiDevice  = 0;
47            static int iFxSend = 0;
48          static int iMidiMaps = 0;          static int iMidiMaps = 0;
49          static int iMidiInstruments = 0;          static int iMidiInstruments = 0;
50          static float fVolume = 1.0f;          static float fVolume = 1.0f;
# Line 420  lscp_status_t server_callback ( lscp_con Line 421  lscp_status_t server_callback ( lscp_con
421                          sprintf(szTemp, "%g\r\n", fVolume);                          sprintf(szTemp, "%g\r\n", fVolume);
422                          pszResult = szTemp;                          pszResult = szTemp;
423                  }                  }
424                    else if (lscp_parser_test2(&tok, "FX_SEND", "INFO")) {
425                            // Getting effect send informations:
426                            // GET FX_SEND INFO <sampler-channel> <fx-send-id>
427                            pszResult = "NAME: DummyFxSend\r\n"
428                                                    "MIDI_CONTROLLER: 99\r\n"
429                                                    "AUDIO_OUTPUT_ROUTING: 0,1\r\n"
430                                                    "LEVEL: 0.15\r\n"
431                                                    ".\r\n";
432                    }
433                    else if (lscp_parser_test(&tok, "FX_SENDS")) {
434                            // Get ammount of effect sends on a sampler channel:
435                            // GET FX_SENDS <sampler-channel>
436                            sprintf(szTemp, "%d\r\n", iFxSend);
437                            pszResult = szTemp;
438                    }
439                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {
440                          // Get the total count of MIDI instrument map entries:                          // Get the total count of MIDI instrument map entries:
441                          // GET MIDI_INSTRUMENTS                          // GET MIDI_INSTRUMENTS
# Line 513  lscp_status_t server_callback ( lscp_con Line 529  lscp_status_t server_callback ( lscp_con
529                          strcat(szTemp, "\r\n");                          strcat(szTemp, "\r\n");
530                          pszResult = szTemp;                          pszResult = szTemp;
531                  }                  }
532                    else if (lscp_parser_test(&tok, "FX_SENDS")) {
533                            // Listing all effect sends on a sampler channel:
534                            // LIST FX_SENDS <sampler-channel>
535                            szTemp[0] = (char) 0;
536                            for (i = 0; i < iFxSend && strlen(szTemp) < sizeof(szTemp) - 8; i++) {
537                                    if (i > 0)
538                                            strcat(szTemp, ",");
539                                    sprintf(szTemp + strlen(szTemp), "%d", i);
540                            }
541                            strcat(szTemp, "\r\n");
542                            pszResult = szTemp;
543                    }
544                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {
545                          // Getting indeces of all MIDI instrument map entries:                          // Getting indeces of all MIDI instrument map entries:
546                          // LIST MIDI_INSTRUMENTS                          // LIST MIDI_INSTRUMENTS
# Line 592  lscp_status_t server_callback ( lscp_con Line 620  lscp_status_t server_callback ( lscp_con
620                          // SET VOLUME <volume>                          // SET VOLUME <volume>
621                          fVolume = lscp_parser_nextnum(&tok);                          fVolume = lscp_parser_nextnum(&tok);
622                  }                  }
623                    else if (lscp_parser_test(&tok, "FX_SEND")) {
624                            if (lscp_parser_test(&tok, "MIDI_CONTROLLER")) {
625                                    // Altering effect send MIDI controller:
626                                    // SET FX_SEND MIDI_CONTROLLER <sampler-channel> <fx-send-id> <midi-ctrl>
627                            }
628                            else if (lscp_parser_test(&tok, "AUDIO_OUTPUT_CHANNEL")) {
629                                    // Altering effect send audio routing:
630                                    // SET FX_SEND AUDIO_OUTPUT_CHANNEL <sampler-channel> <fx-send-id> <midi-ctrl> <audio-src> <audio-dst>
631                            }
632                            else if (lscp_parser_test(&tok, "LEVEL")) {
633                                    // Altering effect send audio level:
634                                    // SET FX_SEND LEVEL <sampler-channel> <fx-send-id> <midi-ctrl> <volume>
635                            }
636                            else ret = LSCP_FAILED;
637                    }
638                  else if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT_MAP", "NAME")) {                  else if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT_MAP", "NAME")) {
639                          // Setting MIDI instrument map name:                          // Setting MIDI instrument map name:
640                          // SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name>                          // SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name>
# Line 690  lscp_status_t server_callback ( lscp_con Line 733  lscp_status_t server_callback ( lscp_con
733                                  ret = LSCP_FAILED;                                  ret = LSCP_FAILED;
734                          }                          }
735                  }                  }
736                    else if (lscp_parser_test(&tok, "FX_SEND")) {
737                            // Adding an effect send to a sampler channel:
738                            // CREATE FX_SEND <sampler-channel> <midi-ctrl> [<name>]
739                            if (iFxSend < 8) {
740                                    sprintf(szTemp, "OK[%d]\r\n", iFxSend++);
741                                    pszResult = szTemp;
742                            } else {
743                                    iFxSend = 0;
744                                    ret = LSCP_FAILED;
745                            }
746                    }
747                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
748          }          }
749          else if (lscp_parser_test(&tok, "DESTROY")) {          else if (lscp_parser_test(&tok, "DESTROY")) {
750                  if (lscp_parser_test(&tok, "AUDIO_OUTPUT_DEVICE")) {                  if (lscp_parser_test(&tok, "AUDIO_OUTPUT_DEVICE")) {
751                          // Destroying an audio output device.                          // Destroying an audio output device.
752                          // DESTROY AUDIO_OUTPUT_DEVICE <audio-device-id>                          // DESTROY AUDIO_OUTPUT_DEVICE <audio-device-id>
753                          if (lscp_parser_nextint(&tok) < iAudioDevice)                          if (lscp_parser_nextint(&tok) >= 0 && iAudioDevice > 0)
754                                  iAudioDevice--;                                  iAudioDevice--;
755                          else                          else
756                                  ret = LSCP_FAILED;                                  ret = LSCP_FAILED;
# Line 704  lscp_status_t server_callback ( lscp_con Line 758  lscp_status_t server_callback ( lscp_con
758                  else if (lscp_parser_test(&tok, "MIDI_INPUT_DEVICE")) {                  else if (lscp_parser_test(&tok, "MIDI_INPUT_DEVICE")) {
759                          // Destroying an MIDI intput device.                          // Destroying an MIDI intput device.
760                          // DESTROY MIDI_INPUT_DEVICE <midi-device-id>                          // DESTROY MIDI_INPUT_DEVICE <midi-device-id>
761                          if (lscp_parser_nextint(&tok) < iMidiDevice)                          if (lscp_parser_nextint(&tok) >= 0 && iMidiDevice > 0)
762                                  iMidiDevice--;                                  iMidiDevice--;
763                          else                          else
764                                  ret = LSCP_FAILED;                                  ret = LSCP_FAILED;
765                  }                  }
766                    else if (lscp_parser_test(&tok, "FX_SEND")) {
767                            // Removing an effect send from a sampler channel:
768                            // CREATE FX_SEND <sampler-channel> <fx-send-id>
769                            if (lscp_parser_nextint(&tok) >= 0 && iFxSend > 0)
770                                    iFxSend--;
771                            else
772                                    ret = LSCP_FAILED;
773                    }
774                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
775          }          }
776          else if (lscp_parser_test2(&tok, "MAP", "MIDI_INSTRUMENT")) {          else if (lscp_parser_test2(&tok, "MAP", "MIDI_INSTRUMENT")) {

Legend:
Removed from v.1030  
changed lines
  Added in v.1031

  ViewVC Help
Powered by ViewVC