/[svn]/liblscp/trunk/src/device.c
ViewVC logotype

Diff of /liblscp/trunk/src/device.c

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

revision 170 by capela, Wed Jun 30 15:16:03 2004 UTC revision 171 by capela, Mon Jul 5 16:26:44 2004 UTC
# Line 26  Line 26 
26  // Local prototypes.  // Local prototypes.
27    
28  static lscp_driver_info_t *_lscp_driver_info_query (lscp_client_t *pClient, lscp_driver_info_t *pDriverInfo, char *pszQuery);  static lscp_driver_info_t *_lscp_driver_info_query (lscp_client_t *pClient, lscp_driver_info_t *pDriverInfo, char *pszQuery);
29  static lscp_param_info_t  *_lscp_param_info_query  (lscp_client_t *pClient, lscp_param_info_t *pParamInfo, char *pszQuery, lscp_param_t *pDepList);  static lscp_device_info_t *_lscp_device_info_query (lscp_client_t *pClient, lscp_device_info_t *pDeviceInfo, char *pszQuery);
30    static lscp_param_info_t  *_lscp_param_info_query  (lscp_client_t *pClient, lscp_param_info_t *pParamInfo, char *pszQuery, int cchMaxQuery, lscp_param_t *pDepList);
31    
32    static lscp_device_port_info_t *_lscp_device_port_info_query (lscp_client_t *pClient, lscp_device_port_info_t *pDevicePortInfo, char *pszQuery);
33    
34    
35  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
# Line 75  static lscp_driver_info_t *_lscp_driver_ Line 78  static lscp_driver_info_t *_lscp_driver_
78  }  }
79    
80    
81    // Common device info query command.
82    static lscp_device_info_t *_lscp_device_info_query ( lscp_client_t *pClient, lscp_device_info_t *pDeviceInfo, char *pszQuery )
83    {
84        const char *pszResult;
85        const char *pszSeps = ":";
86        const char *pszCrlf = "\r\n";
87        char *pszToken;
88        char *pch;
89        char *pszKey;
90    
91        // Lock this section up.
92        lscp_mutex_lock(pClient->mutex);
93    
94        lscp_device_info_reset(pDeviceInfo);
95        if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {
96            pszResult = lscp_client_get_result(pClient);
97            pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
98            while (pszToken) {
99                if (strcasecmp(pszToken, "DRIVER") == 0) {
100                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
101                    if (pszToken)
102                        pDeviceInfo->driver = lscp_unquote(&pszToken, 1);
103                }
104                else {
105                    pszKey = pszToken;
106                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
107                    if (pszToken)
108                        lscp_plist_append(&(pDeviceInfo->params), pszKey, lscp_unquote(&pszToken, 0));
109                }
110                pszToken = lscp_strtok(NULL, pszSeps, &(pch));
111            }
112        }
113    
114        // Unlock this section down.
115        lscp_mutex_unlock(pClient->mutex);
116    
117        return pDeviceInfo;
118    }
119    
120    
121    // Common device channel/port info query command.
122    static lscp_device_port_info_t *_lscp_device_port_info_query ( lscp_client_t *pClient, lscp_device_port_info_t *pDevicePortInfo, char *pszQuery )
123    {
124        const char *pszResult;
125        const char *pszSeps = ":";
126        const char *pszCrlf = "\r\n";
127        char *pszToken;
128        char *pch;
129        char *pszKey;
130    
131        // Lock this section up.
132        lscp_mutex_lock(pClient->mutex);
133    
134        lscp_device_port_info_reset(pDevicePortInfo);
135        if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {
136            pszResult = lscp_client_get_result(pClient);
137            pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
138            while (pszToken) {
139                if (strcasecmp(pszToken, "NAME") == 0) {
140                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
141                    if (pszToken)
142                        pDevicePortInfo->name = lscp_unquote(&pszToken, 1);
143                }
144                else {
145                    pszKey = pszToken;
146                    pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
147                    if (pszToken)
148                        lscp_plist_append(&(pDevicePortInfo->params), pszKey, lscp_unquote(&pszToken, 0));
149                }
150                pszToken = lscp_strtok(NULL, pszSeps, &(pch));
151            }
152        }
153    
154        // Unlock this section down.
155        lscp_mutex_unlock(pClient->mutex);
156    
157        return pDevicePortInfo;
158    }
159    
160    
161  // Common parameter info query command.  // Common parameter info query command.
162  static lscp_param_info_t *_lscp_param_info_query ( lscp_client_t *pClient, lscp_param_info_t *pParamInfo, char *pszQuery, lscp_param_t *pDepList )  static lscp_param_info_t *_lscp_param_info_query ( lscp_client_t *pClient, lscp_param_info_t *pParamInfo, char *pszQuery, int cchMaxQuery, lscp_param_t *pDepList )
163  {  {
164      const char *pszResult;      const char *pszResult;
165      const char *pszSeps = ":";      const char *pszSeps = ":";
# Line 88  static lscp_param_info_t *_lscp_param_in Line 171  static lscp_param_info_t *_lscp_param_in
171      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
172    
173      lscp_param_info_reset(pParamInfo);      lscp_param_info_reset(pParamInfo);
174      lscp_param_concat(pszQuery, LSCP_BUFSIZ, pDepList);      lscp_param_concat(pszQuery, cchMaxQuery, pDepList);
175      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {
176          pszResult = lscp_client_get_result(pClient);          pszResult = lscp_client_get_result(pClient);
177          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
# Line 215  lscp_driver_info_t* lscp_get_audio_drive Line 298  lscp_driver_info_t* lscp_get_audio_drive
298          return NULL;          return NULL;
299    
300      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);
301      return _lscp_driver_info_query(pClient, &(pClient->audio_info), szQuery);      return _lscp_driver_info_query(pClient, &(pClient->audio_driver_info), szQuery);
302  }  }
303    
304    
# Line 242  lscp_param_info_t *lscp_get_audio_driver Line 325  lscp_param_info_t *lscp_get_audio_driver
325      if (pszParam == NULL)      if (pszParam == NULL)
326          return NULL;          return NULL;
327    
328      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s\r\n", pszAudioDriver, pszParam);      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s", pszAudioDriver, pszParam);
329      return _lscp_param_info_query(pClient, &(pClient->audio_param_info), szQuery, pDepList);      return _lscp_param_info_query(pClient, &(pClient->audio_param_info), szQuery, sizeof(szQuery), pDepList);
330  }  }
331    
332    
# Line 263  lscp_param_info_t *lscp_get_audio_driver Line 346  lscp_param_info_t *lscp_get_audio_driver
346   */   */
347  int lscp_create_audio_device ( lscp_client_t *pClient, const char *pszAudioDriver, lscp_param_t *pParams )  int lscp_create_audio_device ( lscp_client_t *pClient, const char *pszAudioDriver, lscp_param_t *pParams )
348  {  {
349        char szQuery[LSCP_BUFSIZ];
350      int iAudioDevice = -1;      int iAudioDevice = -1;
351    
352      if (pClient == NULL)      if (pClient == NULL)
353          return -1;          return iAudioDevice;
354      if (pszAudioDriver == NULL)      if (pszAudioDriver == NULL)
355          return -1;          return iAudioDevice;
356      if (pParams == NULL)  
357          return -1;      // Lock this section up.
358        lscp_mutex_lock(pClient->mutex);
359    
360        sprintf(szQuery, "CREATE AUDIO_OUTPUT_DEVICE %s", pszAudioDriver);
361        lscp_param_concat(szQuery, sizeof(szQuery), pParams);
362        if (lscp_client_call(pClient, szQuery) == LSCP_OK)
363            iAudioDevice = atoi(lscp_client_get_result(pClient));
364    
365        // Unlock this section down.
366        lscp_mutex_unlock(pClient->mutex);
367    
368      return iAudioDevice;      return iAudioDevice;
369  }  }
# Line 288  int lscp_create_audio_device ( lscp_clie Line 381  int lscp_create_audio_device ( lscp_clie
381  lscp_status_t lscp_destroy_audio_device ( lscp_client_t *pClient, int iAudioDevice )  lscp_status_t lscp_destroy_audio_device ( lscp_client_t *pClient, int iAudioDevice )
382  {  {
383      lscp_status_t ret = LSCP_FAILED;      lscp_status_t ret = LSCP_FAILED;
384        char szQuery[LSCP_BUFSIZ];
385    
386      if (pClient == NULL)      if (pClient == NULL)
387          return ret;          return ret;
388      if (iAudioDevice < 0)      if (iAudioDevice < 0)
389          return ret;          return ret;
390    
391      return ret;      sprintf(szQuery, "DESTROY AUDIO_OUTPUT_DEVICE %d\r\n", iAudioDevice);
392        return lscp_client_query(pClient, szQuery);
393  }  }
394    
395    
# Line 370  int *lscp_list_audio_devices ( lscp_clie Line 465  int *lscp_list_audio_devices ( lscp_clie
465   */   */
466  lscp_device_info_t *lscp_get_audio_device_info ( lscp_client_t *pClient, int iAudioDevice )  lscp_device_info_t *lscp_get_audio_device_info ( lscp_client_t *pClient, int iAudioDevice )
467  {  {
468      lscp_device_info_t *pDeviceInfo = NULL;      char szQuery[LSCP_BUFSIZ];
469    
470      if (pClient == NULL)      if (pClient == NULL)
471          return NULL;          return NULL;
472      if (iAudioDevice < 0)      if (iAudioDevice < 0)
473          return NULL;          return NULL;
474    
475      return pDeviceInfo;      sprintf(szQuery, "GET AUDIO_OUTPUT_DEVICE INFO %d\r\n", iAudioDevice);
476        return _lscp_device_info_query(pClient, &(pClient->audio_device_info), szQuery);
477  }  }
478    
479    
480  /**  /**
481   *  Changing settings of audio output devices.   *  Changing settings of audio output devices.
482   *  SET AUDIO_OUTPUT_DEVICE_PARAMETER <audio-device-id> <param> <value>   *  SET AUDIO_OUTPUT_DEVICE_PARAMETER <audio-device-id> <param>=<value>
483   *   *
484   *  @param pClient      Pointer to client instance structure.   *  @param pClient      Pointer to client instance structure.
485   *  @param iAudioDevice Audio device number identifier.   *  @param iAudioDevice Audio device number identifier.
# Line 393  lscp_device_info_t *lscp_get_audio_devic Line 489  lscp_device_info_t *lscp_get_audio_devic
489   */   */
490  lscp_status_t lscp_set_audio_device_param ( lscp_client_t *pClient, int iAudioDevice, lscp_param_t *pParam )  lscp_status_t lscp_set_audio_device_param ( lscp_client_t *pClient, int iAudioDevice, lscp_param_t *pParam )
491  {  {
492      lscp_status_t ret = LSCP_FAILED;      char szQuery[LSCP_BUFSIZ];
493    
494      if (pClient == NULL)      if (pClient == NULL)
495          return ret;          return LSCP_FAILED;
496      if (iAudioDevice < 0)      if (iAudioDevice < 0)
497          return ret;          return LSCP_FAILED;
498      if (pParam == NULL)      if (pParam == NULL)
499          return ret;          return LSCP_FAILED;
500    
501      return ret;      sprintf(szQuery, "SET AUDIO_OUTPUT_DEVICE_PARAMETER %d", iAudioDevice);
502        lscp_param_concat(szQuery, sizeof(szQuery), pParam);
503        return lscp_client_query(pClient, szQuery);
504  }  }
505    
506    
# Line 414  lscp_status_t lscp_set_audio_device_para Line 512  lscp_status_t lscp_set_audio_device_para
512   *  @param iAudioDevice     Audio device number identifier.   *  @param iAudioDevice     Audio device number identifier.
513   *  @param iAudioChannel    Audio channel number.   *  @param iAudioChannel    Audio channel number.
514   *   *
515   *  @returns A pointer to a @ref lscp_device_channel_info_t structure,   *  @returns A pointer to a @ref lscp_device_port_info_t structure,
516   *  with the given audio channel information, or NULL in case of failure.   *  with the given audio channel information, or NULL in case of failure.
517   */   */
518  lscp_device_channel_info_t* lscp_get_audio_channel_info ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel )  lscp_device_port_info_t* lscp_get_audio_channel_info ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel )
519  {  {
520      lscp_device_channel_info_t *pDevChannelInfo = NULL;      char szQuery[LSCP_BUFSIZ];
521    
522      if (pClient == NULL)      if (pClient == NULL)
523          return NULL;          return NULL;
# Line 428  lscp_device_channel_info_t* lscp_get_aud Line 526  lscp_device_channel_info_t* lscp_get_aud
526      if (iAudioChannel < 0)      if (iAudioChannel < 0)
527          return NULL;          return NULL;
528    
529      return pDevChannelInfo;      sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL INFO %d %d\r\n", iAudioDevice, iAudioChannel);
530        return _lscp_device_port_info_query(pClient, &(pClient->audio_channel_info), szQuery);
531  }  }
532    
533    
# Line 446  lscp_device_channel_info_t* lscp_get_aud Line 545  lscp_device_channel_info_t* lscp_get_aud
545   */   */
546  lscp_param_info_t* lscp_get_audio_channel_param_info ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, const char *pszParam )  lscp_param_info_t* lscp_get_audio_channel_param_info ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, const char *pszParam )
547  {  {
548      lscp_param_info_t *pParamInfo = NULL;      char szQuery[LSCP_BUFSIZ];
549    
550      if (pClient == NULL)      if (pClient == NULL)
551          return NULL;          return NULL;
# Line 457  lscp_param_info_t* lscp_get_audio_channe Line 556  lscp_param_info_t* lscp_get_audio_channe
556      if (pszParam == NULL)      if (pszParam == NULL)
557          return NULL;          return NULL;
558    
559      return pParamInfo;      sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL_PARAMETER INFO %d %d %s", iAudioDevice, iAudioChannel, pszParam);
560        return _lscp_param_info_query(pClient, &(pClient->audio_channel_param_info), szQuery, sizeof(szQuery), NULL);
561  }  }
562    
563    
# Line 474  lscp_param_info_t* lscp_get_audio_channe Line 574  lscp_param_info_t* lscp_get_audio_channe
574   */   */
575  lscp_status_t lscp_set_audio_channel_param ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, lscp_param_t *pParam )  lscp_status_t lscp_set_audio_channel_param ( lscp_client_t *pClient, int iAudioDevice, int iAudioChannel, lscp_param_t *pParam )
576  {  {
577      lscp_status_t ret = LSCP_FAILED;      char szQuery[LSCP_BUFSIZ];
578    
579      if (pClient == NULL)      if (pClient == NULL)
580          return ret;          return LSCP_FAILED;
581      if (iAudioDevice < 0)      if (iAudioDevice < 0)
582          return ret;          return LSCP_FAILED;
583      if (iAudioChannel < 0)      if (iAudioChannel < 0)
584          return ret;          return LSCP_FAILED;
585      if (pParam == NULL)      if (pParam == NULL)
586          return ret;          return LSCP_FAILED;
587    
588      return ret;      sprintf(szQuery, "SET AUDIO_OUTPUT_CHANNEL_PARAMETER %d %d", iAudioDevice, iAudioChannel);
589        lscp_param_concat(szQuery, sizeof(szQuery), pParam);
590        return lscp_client_query(pClient, szQuery);
591  }  }
592    
593    
# Line 541  lscp_driver_info_t* lscp_get_midi_driver Line 643  lscp_driver_info_t* lscp_get_midi_driver
643          return NULL;          return NULL;
644    
645      sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);      sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);
646      return _lscp_driver_info_query(pClient, &(pClient->midi_info), szQuery);      return _lscp_driver_info_query(pClient, &(pClient->midi_driver_info), szQuery);
647  }  }
648    
649    
# Line 570  lscp_param_info_t *lscp_get_midi_driver_ Line 672  lscp_param_info_t *lscp_get_midi_driver_
672      if (pszParam == NULL)      if (pszParam == NULL)
673          return NULL;          return NULL;
674    
675      sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s\r\n", pszMidiDriver, pszParam);      sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s", pszMidiDriver, pszParam);
676      return _lscp_param_info_query(pClient, &(pClient->midi_param_info), szQuery, pDepList);      return _lscp_param_info_query(pClient, &(pClient->midi_param_info), szQuery, sizeof(szQuery), pDepList);
677  }  }
678    
679    
# Line 591  lscp_param_info_t *lscp_get_midi_driver_ Line 693  lscp_param_info_t *lscp_get_midi_driver_
693   */   */
694  int lscp_create_midi_device ( lscp_client_t *pClient, const char *pszMidiDriver, lscp_param_t *pParams )  int lscp_create_midi_device ( lscp_client_t *pClient, const char *pszMidiDriver, lscp_param_t *pParams )
695  {  {
696        char szQuery[LSCP_BUFSIZ];
697      int iMidiDevice = -1;      int iMidiDevice = -1;
698    
699      if (pClient == NULL)      if (pClient == NULL)
700          return -1;          return iMidiDevice;
701      if (pszMidiDriver == NULL)      if (pszMidiDriver == NULL)
702          return -1;          return iMidiDevice;
703      if (pParams == NULL)  
704          return -1;      // Lock this section up.
705        lscp_mutex_lock(pClient->mutex);
706    
707        sprintf(szQuery, "CREATE MIDI_INPUT_DEVICE %s", pszMidiDriver);
708        lscp_param_concat(szQuery, sizeof(szQuery), pParams);
709        if (lscp_client_call(pClient, szQuery) == LSCP_OK)
710            iMidiDevice = atoi(lscp_client_get_result(pClient));
711    
712        // Unlock this section down.
713        lscp_mutex_unlock(pClient->mutex);
714    
715      return iMidiDevice;      return iMidiDevice;
716  }  }
# Line 616  int lscp_create_midi_device ( lscp_clien Line 728  int lscp_create_midi_device ( lscp_clien
728  lscp_status_t lscp_destroy_midi_device ( lscp_client_t *pClient, int iMidiDevice )  lscp_status_t lscp_destroy_midi_device ( lscp_client_t *pClient, int iMidiDevice )
729  {  {
730      lscp_status_t ret = LSCP_FAILED;      lscp_status_t ret = LSCP_FAILED;
731        char szQuery[LSCP_BUFSIZ];
732    
733      if (pClient == NULL)      if (pClient == NULL)
734          return ret;          return ret;
735      if (iMidiDevice < 0)      if (iMidiDevice < 0)
736          return ret;          return ret;
737    
738      return ret;      sprintf(szQuery, "DESTROY MIDI_INPUT_DEVICE %d\r\n", iMidiDevice);
739        return lscp_client_query(pClient, szQuery);
740  }  }
741    
742    
# Line 698  int *lscp_list_midi_devices ( lscp_clien Line 812  int *lscp_list_midi_devices ( lscp_clien
812   */   */
813  lscp_device_info_t* lscp_get_midi_device_info ( lscp_client_t *pClient, int iMidiDevice )  lscp_device_info_t* lscp_get_midi_device_info ( lscp_client_t *pClient, int iMidiDevice )
814  {  {
815      lscp_device_info_t *pDeviceInfo = NULL;      char szQuery[LSCP_BUFSIZ];
816    
817      if (pClient == NULL)      if (pClient == NULL)
818          return NULL;          return NULL;
819      if (iMidiDevice < 0)      if (iMidiDevice < 0)
820          return NULL;          return NULL;
821    
822      return pDeviceInfo;      sprintf(szQuery, "GET MIDI_INPUT_DEVICE INFO %d\r\n", iMidiDevice);
823        return _lscp_device_info_query(pClient, &(pClient->midi_device_info), szQuery);
824  }  }
825    
826    
827  /**  /**
828   *  Changing settings of MIDI input devices.   *  Changing settings of MIDI input devices.
829   *  SET MIDI_INPUT_DEVICE_PARAMETER <midi-device-id> <param> <value>   *  SET MIDI_INPUT_DEVICE_PARAMETER <midi-device-id> <param>=<value>
830   *   *
831   *  @param pClient      Pointer to client instance structure.   *  @param pClient      Pointer to client instance structure.
832   *  @param iMidiDevice  MIDI device number identifier.   *  @param iMidiDevice  MIDI device number identifier.
# Line 721  lscp_device_info_t* lscp_get_midi_device Line 836  lscp_device_info_t* lscp_get_midi_device
836   */   */
837  lscp_status_t lscp_set_midi_device_param ( lscp_client_t *pClient, int iMidiDevice, lscp_param_t *pParam )  lscp_status_t lscp_set_midi_device_param ( lscp_client_t *pClient, int iMidiDevice, lscp_param_t *pParam )
838  {  {
839      lscp_status_t ret = LSCP_FAILED;      char szQuery[LSCP_BUFSIZ];
840    
841      if (pClient == NULL)      if (pClient == NULL)
842          return ret;          return LSCP_FAILED;
843      if (iMidiDevice < 0)      if (iMidiDevice < 0)
844          return ret;          return LSCP_FAILED;
845      if (pParam == NULL)      if (pParam == NULL)
846          return ret;          return LSCP_FAILED;
847    
848      return ret;      sprintf(szQuery, "SET MIDI_INPUT_DEVICE_PARAMETER %d", iMidiDevice);
849        lscp_param_concat(szQuery, sizeof(szQuery), pParam);
850        return lscp_client_query(pClient, szQuery);
851  }  }
852    
853    
# Line 742  lscp_status_t lscp_set_midi_device_param Line 859  lscp_status_t lscp_set_midi_device_param
859   *  @param iMidiDevice  MIDI device number identifier.   *  @param iMidiDevice  MIDI device number identifier.
860   *  @param iMidiPort    MIDI port number.   *  @param iMidiPort    MIDI port number.
861   *   *
862   *  @returns A pointer to a @ref lscp_device_channel_info_t structure,   *  @returns A pointer to a @ref lscp_device_port_info_t structure,
863   *  with the given MIDI port information, or NULL in case of failure.   *  with the given MIDI port information, or NULL in case of failure.
864   */   */
865  lscp_device_channel_info_t* lscp_get_midi_port_info ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort )  lscp_device_port_info_t* lscp_get_midi_port_info ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort )
866  {  {
867      lscp_device_channel_info_t *pDevChannelInfo = NULL;      char szQuery[LSCP_BUFSIZ];
868    
869      if (pClient == NULL)      if (pClient == NULL)
870          return NULL;          return NULL;
# Line 756  lscp_device_channel_info_t* lscp_get_mid Line 873  lscp_device_channel_info_t* lscp_get_mid
873      if (iMidiPort < 0)      if (iMidiPort < 0)
874          return NULL;          return NULL;
875    
876      return pDevChannelInfo;      sprintf(szQuery, "GET MIDI_INPUT_PORT INFO %d %d\r\n", iMidiDevice, iMidiPort);
877        return _lscp_device_port_info_query(pClient, &(pClient->midi_port_info), szQuery);
878  }  }
879    
880    
# Line 774  lscp_device_channel_info_t* lscp_get_mid Line 892  lscp_device_channel_info_t* lscp_get_mid
892   */   */
893  lscp_param_info_t* lscp_get_midi_port_param_info ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort, const char *pszParam )  lscp_param_info_t* lscp_get_midi_port_param_info ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort, const char *pszParam )
894  {  {
895      lscp_param_info_t *pParamInfo = NULL;      char szQuery[LSCP_BUFSIZ];
896    
897      if (pClient == NULL)      if (pClient == NULL)
898          return NULL;          return NULL;
# Line 785  lscp_param_info_t* lscp_get_midi_port_pa Line 903  lscp_param_info_t* lscp_get_midi_port_pa
903      if (pszParam == NULL)      if (pszParam == NULL)
904          return NULL;          return NULL;
905    
906      return pParamInfo;      sprintf(szQuery, "GET MIDI_INPUT_PORT_PARAMETER INFO %d %d %s", iMidiDevice, iMidiPort, pszParam);
907        return _lscp_param_info_query(pClient, &(pClient->midi_port_param_info), szQuery, sizeof(szQuery), NULL);
908  }  }
909    
910    
# Line 802  lscp_param_info_t* lscp_get_midi_port_pa Line 921  lscp_param_info_t* lscp_get_midi_port_pa
921   */   */
922  lscp_status_t lscp_set_midi_port_param ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort, lscp_param_t *pParam )  lscp_status_t lscp_set_midi_port_param ( lscp_client_t *pClient, int iMidiDevice, int iMidiPort, lscp_param_t *pParam )
923  {  {
924      lscp_status_t ret = LSCP_FAILED;      char szQuery[LSCP_BUFSIZ];
925    
926      if (pClient == NULL)      if (pClient == NULL)
927          return ret;          return LSCP_FAILED;
928      if (iMidiDevice < 0)      if (iMidiDevice < 0)
929          return ret;          return LSCP_FAILED;
930      if (iMidiPort < 0)      if (iMidiPort < 0)
931          return ret;          return LSCP_FAILED;
932      if (pParam == NULL)      if (pParam == NULL)
933          return ret;          return LSCP_FAILED;
934    
935      return ret;      sprintf(szQuery, "SET MIDI_INPUT_PORT_PARAMETER %d %d", iMidiDevice, iMidiPort);
936        lscp_param_concat(szQuery, sizeof(szQuery), pParam);
937        return lscp_client_query(pClient, szQuery);
938  }  }
939    
940  // end of device.c  // end of device.c

Legend:
Removed from v.170  
changed lines
  Added in v.171

  ViewVC Help
Powered by ViewVC