/[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 735 by capela, Tue Aug 16 09:48:42 2005 UTC revision 948 by capela, Tue Nov 28 15:31:20 2006 UTC
# Line 1  Line 1 
1  // example_server.c  // example_server.c
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.     liblscp - LinuxSampler Control Protocol API
5       Copyright (C) 2004-2006, 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 13  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
# Line 37  lscp_status_t server_callback ( lscp_con Line 38  lscp_status_t server_callback ( lscp_con
38      lscp_status_t ret = LSCP_OK;      lscp_status_t ret = LSCP_OK;
39      lscp_parser_t tok;      lscp_parser_t tok;
40      const char *pszResult = NULL;      const char *pszResult = NULL;
41      char szTemp[256];      char szTemp[4096];
42      int i;      int i;
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: ",
# Line 80  lscp_status_t server_callback ( lscp_con Line 82  lscp_status_t server_callback ( lscp_con
82                              "MIDI_INPUT_CHANNEL: ALL\r\n"                              "MIDI_INPUT_CHANNEL: ALL\r\n"
83                              "VOLUME: 0.5\r\n"                              "VOLUME: 0.5\r\n"
84                              "MUTE: FALSE\r\n"                              "MUTE: FALSE\r\n"
85                              "SOLO: TRUE\r\n";                              "SOLO: TRUE\r\n"
86                                                            ".\r\n";
87              }              }
88              else if (lscp_parser_test(&tok, "VOICE_COUNT")) {              else if (lscp_parser_test(&tok, "VOICE_COUNT")) {
89                  // Current number of active voices:                  // Current number of active voices:
90                  // GET CHANNEL VOICE_COUNT <sampler-channel>                  // GET CHANNEL VOICE_COUNT <sampler-channel>
91                  sprintf(szTemp, "%d", rand() % 100);                  sprintf(szTemp, "%d\r\n", rand() % 100);
92                  pszResult = szTemp;                  pszResult = szTemp;
93              }              }
94              else if (lscp_parser_test(&tok, "STREAM_COUNT")) {              else if (lscp_parser_test(&tok, "STREAM_COUNT")) {
# Line 113  lscp_status_t server_callback ( lscp_con Line 116  lscp_status_t server_callback ( lscp_con
116          else if (lscp_parser_test(&tok, "CHANNELS")) {          else if (lscp_parser_test(&tok, "CHANNELS")) {
117              // Current number of sampler channels:              // Current number of sampler channels:
118              // GET CHANNELS              // GET CHANNELS
119              sprintf(szTemp, "%d", iSamplerChannel);              sprintf(szTemp, "%d\r\n", iSamplerChannel);
120              pszResult = szTemp;              pszResult = szTemp;
121          }          }
122          else if (lscp_parser_test(&tok, "AVAILABLE_AUDIO_OUTPUT_DRIVERS")) {          else if (lscp_parser_test(&tok, "AVAILABLE_AUDIO_OUTPUT_DRIVERS")) {
# Line 132  lscp_status_t server_callback ( lscp_con Line 135  lscp_status_t server_callback ( lscp_con
135              if (lscp_parser_test(&tok, "Alsa")) {              if (lscp_parser_test(&tok, "Alsa")) {
136                  pszResult = "DESCRIPTION: 'ALSA PCM'\r\n"                  pszResult = "DESCRIPTION: 'ALSA PCM'\r\n"
137                              "VERSION: '1.0'\r\n"                              "VERSION: '1.0'\r\n"
138                              "PARAMETERS: channels,samplerate,active\r\n";                              "PARAMETERS: channels,samplerate,active\r\n"
139                                ".\r\n";
140              }              }
141              else if (lscp_parser_test(&tok, "Jack")) {              else if (lscp_parser_test(&tok, "Jack")) {
142                  pszResult = "DESCRIPTION: JACK Audio Connection Kit\r\n"                  pszResult = "DESCRIPTION: JACK Audio Connection Kit\r\n"
143                              "VERSION: 0.98.1\r\n"                              "VERSION: 0.98.1\r\n"
144                              "PARAMETERS: channels,samplerate,active\r\n";                              "PARAMETERS: channels,samplerate,active\r\n"
145                                ".\r\n";
146              }              }
147              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
148          }          }
# Line 147  lscp_status_t server_callback ( lscp_con Line 152  lscp_status_t server_callback ( lscp_con
152              if (lscp_parser_test(&tok, "Alsa")) {              if (lscp_parser_test(&tok, "Alsa")) {
153                  pszResult = "DESCRIPTION: ALSA Sequencer\r\n"                  pszResult = "DESCRIPTION: ALSA Sequencer\r\n"
154                              "VERSION: 1.0\r\n"                              "VERSION: 1.0\r\n"
155                              "PARAMETERS: ports,active\r\n";                              "PARAMETERS: ports,active\r\n"
156                                ".\r\n";
157              }              }
158              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
159          }          }
# Line 165  lscp_status_t server_callback ( lscp_con Line 171  lscp_status_t server_callback ( lscp_con
171                                  "DEFAULT: TRUE\r\n"                                  "DEFAULT: TRUE\r\n"
172                                  "RANGE_MIN: FALSE\r\n"                                  "RANGE_MIN: FALSE\r\n"
173                                  "RANGE_MAX: TRUE\r\n"                                  "RANGE_MAX: TRUE\r\n"
174                                  "POSSIBILITIES: FALSE,TRUE\r\n";                                  "POSSIBILITIES: FALSE,TRUE\r\n"
175                                    ".\r\n";
176                  }                  }
177                  else if (lscp_parser_test(&tok, "channels")) {                  else if (lscp_parser_test(&tok, "channels")) {
178                      pszResult = "DESCRIPTION: 'Number of ALSA PCM channels'\r\n"                      pszResult = "DESCRIPTION: 'Number of ALSA PCM channels'\r\n"
# Line 173  lscp_status_t server_callback ( lscp_con Line 180  lscp_status_t server_callback ( lscp_con
180                                  "MANDATORY: TRUE\r\n"                                  "MANDATORY: TRUE\r\n"
181                                  "FIX: TRUE\r\n"                                  "FIX: TRUE\r\n"
182                                  "MULTIPLICITY: FALSE\r\n"                                  "MULTIPLICITY: FALSE\r\n"
183                                  "DEFAULT: 2\r\n";                                  "DEFAULT: 2\r\n"
184                                    ".\r\n";
185                  }                  }
186                  else if (lscp_parser_test(&tok, "samplerate")) {                  else if (lscp_parser_test(&tok, "samplerate")) {
187                      pszResult = "DESCRIPTION: 'ALSA PCM sample rate'\r\n"                      pszResult = "DESCRIPTION: 'ALSA PCM sample rate'\r\n"
# Line 182  lscp_status_t server_callback ( lscp_con Line 190  lscp_status_t server_callback ( lscp_con
190                                  "FIX: TRUE\r\n"                                  "FIX: TRUE\r\n"
191                                  "MULTIPLICITY: TRUE\r\n"                                  "MULTIPLICITY: TRUE\r\n"
192                                  "DEFAULT: 44100\r\n"                                  "DEFAULT: 44100\r\n"
193                                  "POSSIBILITIES: 44100,48000,96000\r\n";                                  "POSSIBILITIES: 44100,48000,96000\r\n"
194                                    ".\r\n";
195                  }                  }
196                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
197              }              }
# Line 197  lscp_status_t server_callback ( lscp_con Line 206  lscp_status_t server_callback ( lscp_con
206                                  "DEFAULT: TRUE\r\n"                                  "DEFAULT: TRUE\r\n"
207                                  "RANGE_MIN: FALSE\r\n"                                  "RANGE_MIN: FALSE\r\n"
208                                  "RANGE_MAX: TRUE\r\n"                                  "RANGE_MAX: TRUE\r\n"
209                                  "POSSIBILITIES: FALSE,TRUE\r\n";                                  "POSSIBILITIES: FALSE,TRUE\r\n"
210                                    ".\r\n";
211                  }                  }
212                  else if (lscp_parser_test(&tok, "channels")) {                  else if (lscp_parser_test(&tok, "channels")) {
213                      pszResult = "DESCRIPTION: 'Number of JACK audio channels'\r\n"                      pszResult = "DESCRIPTION: 'Number of JACK audio channels'\r\n"
# Line 205  lscp_status_t server_callback ( lscp_con Line 215  lscp_status_t server_callback ( lscp_con
215                                  "MANDATORY: TRUE\r\n"                                  "MANDATORY: TRUE\r\n"
216                                  "FIX: TRUE\r\n"                                  "FIX: TRUE\r\n"
217                                  "MULTIPLICITY: FALSE\r\n"                                  "MULTIPLICITY: FALSE\r\n"
218                                  "DEFAULT: 2\r\n";                                  "DEFAULT: 2\r\n"
219                                    ".\r\n";
220                  }                  }
221                  else if (lscp_parser_test(&tok, "samplerate")) {                  else if (lscp_parser_test(&tok, "samplerate")) {
222                      pszResult = "DESCRIPTION: 'JACK sample rate'\r\n"                      pszResult = "DESCRIPTION: 'JACK sample rate'\r\n"
# Line 214  lscp_status_t server_callback ( lscp_con Line 225  lscp_status_t server_callback ( lscp_con
225                                  "FIX: TRUE\r\n"                                  "FIX: TRUE\r\n"
226                                  "MULTIPLICITY: TRUE\r\n"                                  "MULTIPLICITY: TRUE\r\n"
227                                  "DEFAULT: 44100\r\n"                                  "DEFAULT: 44100\r\n"
228                                  "POSSIBILITIES: 44100,48000,96000\r\n";                                  "POSSIBILITIES: 44100,48000,96000\r\n"
229                                    ".\r\n";
230                  }                  }
231                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
232              }              }
# Line 234  lscp_status_t server_callback ( lscp_con Line 246  lscp_status_t server_callback ( lscp_con
246                                  "DEFAULT: TRUE\r\n"                                  "DEFAULT: TRUE\r\n"
247                                  "RANGE_MIN: FALSE\r\n"                                  "RANGE_MIN: FALSE\r\n"
248                                  "RANGE_MAX: TRUE\r\n"                                  "RANGE_MAX: TRUE\r\n"
249                                  "POSSIBILITIES: FALSE,TRUE\r\n";                                  "POSSIBILITIES: FALSE,TRUE\r\n"
250                                    ".\r\n";
251                  }                  }
252                  else if (lscp_parser_test(&tok, "ports")) {                  else if (lscp_parser_test(&tok, "ports")) {
253                      pszResult = "DESCRIPTION: 'Number of ALSA Sequencer ports'\r\n"                      pszResult = "DESCRIPTION: 'Number of ALSA Sequencer ports'\r\n"
# Line 244  lscp_status_t server_callback ( lscp_con Line 257  lscp_status_t server_callback ( lscp_con
257                                  "MULTIPLICITY: FALSE\r\n"                                  "MULTIPLICITY: FALSE\r\n"
258                                  "DEFAULT: 1\r\n"                                  "DEFAULT: 1\r\n"
259                                  "RANGE_MIN: 1\r\n"                                  "RANGE_MIN: 1\r\n"
260                                  "RANGE_MAX: 4\r\n";                                  "RANGE_MAX: 4\r\n"
261                                    ".\r\n";
262                  }                  }
263                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
264              }              }
# Line 257  lscp_status_t server_callback ( lscp_con Line 271  lscp_status_t server_callback ( lscp_con
271                  pszResult = "driver: Alsa\r\n"                  pszResult = "driver: Alsa\r\n"
272                              "active: TRUE\r\n"                              "active: TRUE\r\n"
273                              "channels: 2\r\n"                              "channels: 2\r\n"
274                              "samplerate: 44100\r\n";                              "samplerate: 44100\r\n"
275                                ".\r\n";
276              }              }
277              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
278          }          }
# Line 268  lscp_status_t server_callback ( lscp_con Line 283  lscp_status_t server_callback ( lscp_con
283                  pszResult = "driver: Alsa\r\n"                  pszResult = "driver: Alsa\r\n"
284                              "active: TRUE\r\n"                              "active: TRUE\r\n"
285                              "channels: 16\r\n"                              "channels: 16\r\n"
286                              "ports: 1\r\n";                              "ports: 1\r\n"
287                                ".\r\n";
288              }              }
289              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
290          }          }
# Line 278  lscp_status_t server_callback ( lscp_con Line 294  lscp_status_t server_callback ( lscp_con
294              if (lscp_parser_nextint(&tok) < iAudioDevice) {              if (lscp_parser_nextint(&tok) < iAudioDevice) {
295                  pszResult = "name: DummyMonitor\r\n"                  pszResult = "name: DummyMonitor\r\n"
296                              "is_mix_channel: FALSE\r\n"                              "is_mix_channel: FALSE\r\n"
297                              "mix_channel_destination: 0\r\n";                              "mix_channel_destination: 0\r\n"
298                                ".\r\n";
299              }              }
300              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
301          }          }
# Line 287  lscp_status_t server_callback ( lscp_con Line 304  lscp_status_t server_callback ( lscp_con
304              // GET MIDI_INPUT_PORT INFO <midi-device-id> <midi-port>              // GET MIDI_INPUT_PORT INFO <midi-device-id> <midi-port>
305              if (lscp_parser_nextint(&tok) < iMidiDevice) {              if (lscp_parser_nextint(&tok) < iMidiDevice) {
306                  pszResult = "name: DummyKeyboard\r\n"                  pszResult = "name: DummyKeyboard\r\n"
307                              "alsa_seq_bindings: '64:0'\r\n";                              "alsa_seq_bindings: '64:0'\r\n"
308                                ".\r\n";
309              }              }
310              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
311          }          }
# Line 302  lscp_status_t server_callback ( lscp_con Line 320  lscp_status_t server_callback ( lscp_con
320                                  "MANDATORY: TRUE\r\n"                                  "MANDATORY: TRUE\r\n"
321                                  "FIX: FALSE\r\n"                                  "FIX: FALSE\r\n"
322                                  "MULTIPLICITY: FALSE\r\n"                                  "MULTIPLICITY: FALSE\r\n"
323                                  "POSSIBILITIES: FALSE,TRUE\r\n";                                  "POSSIBILITIES: FALSE,TRUE\r\n"
324                                    ".\r\n";
325                  }                  }
326                  else if (lscp_parser_test(&tok, "mix_channel_destination")) {                  else if (lscp_parser_test(&tok, "mix_channel_destination")) {
327                      pszResult = "DESCRIPTION: 'Audio mix channel destination'\r\n"                      pszResult = "DESCRIPTION: 'Audio mix channel destination'\r\n"
# Line 310  lscp_status_t server_callback ( lscp_con Line 329  lscp_status_t server_callback ( lscp_con
329                                  "MANDATORY: TRUE\r\n"                                  "MANDATORY: TRUE\r\n"
330                                  "FIX: FALSE\r\n"                                  "FIX: FALSE\r\n"
331                                  "MULTIPLICITY: TRUE\r\n"                                  "MULTIPLICITY: TRUE\r\n"
332                                  "POSSIBILITIES: 0,1\r\n";                                  "POSSIBILITIES: 0,1\r\n"
333                                    ".\r\n";
334                  }                  }
335                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
336              }              }
# Line 327  lscp_status_t server_callback ( lscp_con Line 347  lscp_status_t server_callback ( lscp_con
347                                  "MANDATORY: TRUE\r\n"                                  "MANDATORY: TRUE\r\n"
348                                  "FIX: FALSE\r\n"                                  "FIX: FALSE\r\n"
349                                  "MULTIPLICITY: TRUE\r\n"                                  "MULTIPLICITY: TRUE\r\n"
350                                  "POSSIBILITIES: '64:0','68:0','68:1'\r\n";                                  "POSSIBILITIES: '64:0','68:0','68:1'\r\n"
351                                    ".\r\n";
352                  }                  }
353                  else ret = LSCP_FAILED;                  else ret = LSCP_FAILED;
354              }              }
# Line 354  lscp_status_t server_callback ( lscp_con Line 375  lscp_status_t server_callback ( lscp_con
375              // Getting information about the server.              // Getting information about the server.
376              // GET SERVER INFO              // GET SERVER INFO
377              sprintf(szTemp, "DESCRIPTION: example_server (%s) %s\r\n"              sprintf(szTemp, "DESCRIPTION: example_server (%s) %s\r\n"
378                  "VERSION: %s\r\n", lscp_server_package(),                  "VERSION: %s\r\n.\r\n", lscp_server_package(),
379                  lscp_server_build(), lscp_server_version());                  lscp_server_build(), lscp_server_version());
380              pszResult = szTemp;              pszResult = szTemp;
381          }          }
# Line 363  lscp_status_t server_callback ( lscp_con Line 384  lscp_status_t server_callback ( lscp_con
384              // GET ENGINE INFO <engine-name>              // GET ENGINE INFO <engine-name>
385              if (lscp_parser_test(&tok, "GigEngine")) {              if (lscp_parser_test(&tok, "GigEngine")) {
386                  pszResult = "DESCRIPTION: GigaSampler Engine\r\n"                  pszResult = "DESCRIPTION: GigaSampler Engine\r\n"
387                              "VERSION: 0.3\r\n";                              "VERSION: 0.3\r\n"
388                                ".\r\n";
389              }              }
390              else if (lscp_parser_test(&tok, "DLSEngine")) {              else if (lscp_parser_test(&tok, "DLSEngine")) {
391                  pszResult = "DESCRIPTION: 'DLS Generic Engine'\r\n"                  pszResult = "DESCRIPTION: 'DLS Generic Engine'\r\n"
392                              "VERSION: 0.2\r\n";                              "VERSION: 0.2\r\n"
393                                ".\r\n";
394              }              }
395              else if (lscp_parser_test(&tok, "AkaiEngine")) {              else if (lscp_parser_test(&tok, "AkaiEngine")) {
396                  pszResult = "DESCRIPTION: Akai Sampler Engine\r\n"                  pszResult = "DESCRIPTION: Akai Sampler Engine\r\n"
397                              "VERSION: 0.1\r\n";                              "VERSION: 0.1\r\n"
398                                ".\r\n";
399              }              }
400              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
401          }          }
402            else if (lscp_parser_test(&tok, "TOTAL_VOICE_COUNT")) {
403                // Current number of active voices:
404                // GET TOTAL_VOICE_COUNT
405                sprintf(szTemp, "%d\r\n", rand() % 100);
406                pszResult = szTemp;
407            }
408            else if (lscp_parser_test(&tok, "TOTAL_VOICE_COUNT_MAX")) {
409                // Maximum amount of active voices:
410                // GET TOTAL_VOICE_COUNT_MAX
411                sprintf(szTemp, "%d\r\n", rand() % 100);
412                pszResult = szTemp;
413            }
414            else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {
415                // Get the total count of MIDI instrument map entries:
416                // GET MIDI_INSTRUMENTS
417                sprintf(szTemp, "%d\r\n", iMidiInstruments);
418                pszResult = szTemp;
419            }
420            if (lscp_parser_test2(&tok, "MIDI_INSTRUMENT", "INFO")) {
421                // Getting information about a MIDI instrument map entry:
422                // GET MIDI_INSTRUMENT INFO <midi-bank-msb> <midi-bank-lsb> <midi-prog>
423                pszResult = "NAME: DummyName\r\n"
424                            "ENGINE_NAME: DummyEngine\r\n"
425                            "INSTRUMENT_FILE: DummyInstrument.gig\r\n"
426                            "INSTRUMENT_NR: 0\r\n"
427                            "INSTRUMENT_NAME: Dummy Instrument\r\n"
428                            "LOAD_MODE: ON_DEMAND\r\n"
429                            "VOLUME: 0.5\r\n"
430                            ".\r\n";
431            }
432          else ret = LSCP_FAILED;          else ret = LSCP_FAILED;
433      }      }
434      else if (lscp_parser_test(&tok, "LIST")) {      else if (lscp_parser_test(&tok, "LIST")) {
# Line 429  lscp_status_t server_callback ( lscp_con Line 483  lscp_status_t server_callback ( lscp_con
483              }              }
484              else ret = LSCP_FAILED;              else ret = LSCP_FAILED;
485          }          }
486            else if (lscp_parser_test(&tok, "MIDI_INSTRUMENTS")) {
487                // Getting indeces of all MIDI instrument map entries:
488                // LIST MIDI_INSTRUMENTS
489                if (iMidiInstruments > 0) {
490                    strcpy(szTemp, "{0,0,0}");
491                    for (i = 1; i < iMidiInstruments && strlen(szTemp) < sizeof(szTemp) - 16; i++)
492                        sprintf(szTemp + strlen(szTemp), ",{0,%d,%d}", i / 128, i % 128);
493                    strcat(szTemp, "\r\n");
494                    pszResult = szTemp;
495                }
496                else ret = LSCP_FAILED;
497            }
498          else ret = LSCP_FAILED;          else ret = LSCP_FAILED;
499      }      }
500      else if (lscp_parser_test(&tok, "SET")) {      else if (lscp_parser_test(&tok, "SET")) {
# Line 492  lscp_status_t server_callback ( lscp_con Line 558  lscp_status_t server_callback ( lscp_con
558          // Adding a new sampler channel:          // Adding a new sampler channel:
559          // ADD CHANNEL          // ADD CHANNEL
560          if (iSamplerChannel < 16) {          if (iSamplerChannel < 16) {
561              sprintf(szTemp, "OK[%d]", iSamplerChannel++);              sprintf(szTemp, "OK[%d]\r\n", iSamplerChannel++);
562              pszResult = szTemp;              pszResult = szTemp;
563          } else {          } else {
564              iSamplerChannel = 0;              iSamplerChannel = 0;
# Line 526  lscp_status_t server_callback ( lscp_con Line 592  lscp_status_t server_callback ( lscp_con
592              // Creating an audio output device.              // Creating an audio output device.
593              // CREATE AUDIO_OUTPUT_DEVICE <audio-output-driver> [<params>]              // CREATE AUDIO_OUTPUT_DEVICE <audio-output-driver> [<params>]
594              if (iAudioDevice < 8) {              if (iAudioDevice < 8) {
595                  sprintf(szTemp, "OK[%d]", iAudioDevice++);                  sprintf(szTemp, "OK[%d]\r\n", iAudioDevice++);
596                  pszResult = szTemp;                  pszResult = szTemp;
597              } else {              } else {
598                  iAudioDevice = 0;                  iAudioDevice = 0;
# Line 537  lscp_status_t server_callback ( lscp_con Line 603  lscp_status_t server_callback ( lscp_con
603              // Creating an MIDI input device.              // Creating an MIDI input device.
604              // CREATE MIDI_INPUT_DEVICE <midi-input-driver> [<params>]              // CREATE MIDI_INPUT_DEVICE <midi-input-driver> [<params>]
605              if (iMidiDevice < 8) {              if (iMidiDevice < 8) {
606                  sprintf(szTemp, "OK[%d]", iMidiDevice++);                  sprintf(szTemp, "OK[%d]\r\n", iMidiDevice++);
607                  pszResult = szTemp;                  pszResult = szTemp;
608              } else {              } else {
609                  iMidiDevice = 0;                  iMidiDevice = 0;
# Line 565  lscp_status_t server_callback ( lscp_con Line 631  lscp_status_t server_callback ( lscp_con
631          }          }
632          else ret = LSCP_FAILED;          else ret = LSCP_FAILED;
633      }      }
634        else if (lscp_parser_test2(&tok, "MAP", "MIDI_INSTRUMENT")) {
635            // Create or replace a MIDI instrumnet map entry:
636            // MAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog>
637            // <engine-name> <filename> <instr-index> <volume> <load-mode> [<name>]
638            iMidiInstruments++;
639        }
640        else if (lscp_parser_test2(&tok, "UNMAP", "MIDI_INSTRUMENT")) {
641            // Remove an entry from the MIDI instrument map:
642            // UNMAP MIDI_INSTRUMENT <midi-bank-msb> <midi-bank-lsb> <midi-prog>
643            if (iMidiInstruments > 0)
644                iMidiInstruments--;
645            else
646                ret = LSCP_FAILED;
647        }
648        else if (lscp_parser_test2(&tok, "CLEAR", "MIDI_INSTRUMENTS")) {
649            // Clear the MIDI instrumnet map:
650            // CLEAR MIDI_INSTRUMENTS
651        }
652      else if (lscp_parser_test(&tok, "SUBSCRIBE")) {      else if (lscp_parser_test(&tok, "SUBSCRIBE")) {
653          // Register frontend for receiving event notification messages:          // Register frontend for receiving event notification messages:
654          // SUBSCRIBE <event>          // SUBSCRIBE <event>

Legend:
Removed from v.735  
changed lines
  Added in v.948

  ViewVC Help
Powered by ViewVC