/[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 985 by capela, Mon Dec 18 16:42:33 2006 UTC revision 1019 by capela, Thu Jan 11 12:33:05 2007 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 46  lscp_status_t server_callback ( lscp_con Line 46  lscp_status_t server_callback ( lscp_con
46          static int iMidiDevice  = 0;          static int iMidiDevice  = 0;
47          static int iMidiMaps = 0;          static int iMidiMaps = 0;
48          static int iMidiInstruments = 0;          static int iMidiInstruments = 0;
49            static float fVolume = 1.0f;
50    
51          if (pchBuffer == NULL) {          if (pchBuffer == NULL) {
52                  fprintf(stderr, "server_callback: addr=%s port=%d: ",                  fprintf(stderr, "server_callback: addr=%s port=%d: ",
# Line 413  lscp_status_t server_callback ( lscp_con Line 414  lscp_status_t server_callback ( lscp_con
414                          sprintf(szTemp, "%d\r\n", rand() % 100);                          sprintf(szTemp, "%d\r\n", rand() % 100);
415                          pszResult = szTemp;                          pszResult = szTemp;
416                  }                  }
417                    else if (lscp_parser_test(&tok, "VOLUME")) {
418                            // Get global volume attenuation:
419                            // GET VOLUME
420                            sprintf(szTemp, "%g\r\n", fVolume);
421                            pszResult = szTemp;
422                    }
423                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {                  else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {
424                          // Get the total count of MIDI instrument map entries:                          // Get the total count of MIDI instrument map entries:
425                          // GET MIDI_INSTRUMENTS                          // GET MIDI_INSTRUMENTS
# Line 580  lscp_status_t server_callback ( lscp_con Line 587  lscp_status_t server_callback ( lscp_con
587                          }                          }
588                          else ret = LSCP_FAILED;                          else ret = LSCP_FAILED;
589                  }                  }
590                    else if (lscp_parser_test(&tok, "VOLUME")) {
591                            // Setting global volume attenuation:
592                            // SET VOLUME <volume>
593                            fVolume = lscp_parser_nextnum(&tok);
594                    }
595                  else if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT_MAP", "NAME")) {                  else if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT_MAP", "NAME")) {
596                          // Setting MIDI instrument map name:                          // Setting MIDI instrument map name:
597                          // SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name>                          // SET MIDI_INSTRUMENT_MAP NAME <midi-map> <map-name>
# Line 651  lscp_status_t server_callback ( lscp_con Line 663  lscp_status_t server_callback ( lscp_con
663                          iSamplerChannel = 0;                          iSamplerChannel = 0;
664                          iAudioDevice = 0;                          iAudioDevice = 0;
665                          iMidiDevice = 0;                          iMidiDevice = 0;
666                            iMidiMaps = 0;
667                            iMidiInstruments = 0;
668                  }                  }
669          }          }
670          else if (lscp_parser_test(&tok, "CREATE")) {          else if (lscp_parser_test(&tok, "CREATE")) {
# Line 714  lscp_status_t server_callback ( lscp_con Line 728  lscp_status_t server_callback ( lscp_con
728          else if (lscp_parser_test2(&tok, "CLEAR", "MIDI_INSTRUMENTS")) {          else if (lscp_parser_test2(&tok, "CLEAR", "MIDI_INSTRUMENTS")) {
729                  // Clear the MIDI instrumnet map:                  // Clear the MIDI instrumnet map:
730                  // CLEAR MIDI_INSTRUMENTS                  // CLEAR MIDI_INSTRUMENTS
731                    iMidiInstruments = 0;
732          }          }
733          else if (lscp_parser_test(&tok, "SUBSCRIBE")) {          else if (lscp_parser_test(&tok, "SUBSCRIBE")) {
734                  // Register frontend for receiving event notification messages:                  // Register frontend for receiving event notification messages:

Legend:
Removed from v.985  
changed lines
  Added in v.1019

  ViewVC Help
Powered by ViewVC