/[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 449 by capela, Thu Mar 10 22:48:38 2005 UTC revision 948 by capela, Tue Nov 28 15:31:20 2006 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004-2005, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This library is free software; you can redistribute it and/or     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public     modify it under the terms of the GNU Lesser General Public
# Line 14  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15     Lesser General Public License for more details.     Lesser General Public License for more details.
16    
17     You should have received a copy of the GNU Lesser General Public     You should have received a copy of the GNU General Public License along
18     License along with this library; 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 48  static lscp_driver_info_t *_lscp_driver_ Line 48  static lscp_driver_info_t *_lscp_driver_
48      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
49    
50      lscp_driver_info_reset(pDriverInfo);      lscp_driver_info_reset(pDriverInfo);
51      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {      if (lscp_client_call(pClient, pszQuery, 1) == LSCP_OK) {
52          pszResult = lscp_client_get_result(pClient);          pszResult = lscp_client_get_result(pClient);
53          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
54          while (pszToken) {          while (pszToken) {
# Line 96  static lscp_device_info_t *_lscp_device_ Line 96  static lscp_device_info_t *_lscp_device_
96      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
97    
98      lscp_device_info_reset(pDeviceInfo);      lscp_device_info_reset(pDeviceInfo);
99      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {      if (lscp_client_call(pClient, pszQuery, 1) == LSCP_OK) {
100          pszResult = lscp_client_get_result(pClient);          pszResult = lscp_client_get_result(pClient);
101          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
102          while (pszToken) {          while (pszToken) {
# Line 137  static lscp_device_port_info_t *_lscp_de Line 137  static lscp_device_port_info_t *_lscp_de
137      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
138    
139      lscp_device_port_info_reset(pDevicePortInfo);      lscp_device_port_info_reset(pDevicePortInfo);
140      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {      if (lscp_client_call(pClient, pszQuery, 1) == LSCP_OK) {
141          pszResult = lscp_client_get_result(pClient);          pszResult = lscp_client_get_result(pClient);
142          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
143          while (pszToken) {          while (pszToken) {
# Line 178  static lscp_param_info_t *_lscp_param_in Line 178  static lscp_param_info_t *_lscp_param_in
178    
179      lscp_param_info_reset(pParamInfo);      lscp_param_info_reset(pParamInfo);
180      lscp_param_concat(pszQuery, cchMaxQuery, pDepList);      lscp_param_concat(pszQuery, cchMaxQuery, pDepList);
181      if (lscp_client_call(pClient, pszQuery) == LSCP_OK) {      if (lscp_client_call(pClient, pszQuery, 1) == LSCP_OK) {
182          pszResult = lscp_client_get_result(pClient);          pszResult = lscp_client_get_result(pClient);
183          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));          pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch));
184          while (pszToken) {          while (pszToken) {
# Line 263  static lscp_param_info_t *_lscp_param_in Line 263  static lscp_param_info_t *_lscp_param_in
263  // Audio driver control functions.  // Audio driver control functions.
264    
265  /**  /**
266   *  Getting all available audio output drivers.   *  Getting all available audio output driver count.
267   *  GET AVAILABLE_AUDIO_OUTPUT_DRIVERS   *  GET AVAILABLE_AUDIO_OUTPUT_DRIVERS
268   *   *
269   *  @param pClient  Pointer to client instance structure.   *  @param pClient  Pointer to client instance structure.
270   *   *
271     *  @returns The current total number of audio output drivers on success,
272     *  -1 otherwise.
273     */
274    int lscp_get_available_audio_drivers ( lscp_client_t *pClient )
275    {
276        int iAudioDrivers = -1;
277    
278        // Lock this section up.
279        lscp_mutex_lock(pClient->mutex);
280    
281        if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)
282            iAudioDrivers = atoi(lscp_client_get_result(pClient));
283    
284        // Unlock this section down.
285        lscp_mutex_unlock(pClient->mutex);
286    
287        return iAudioDrivers;
288    }
289    
290    
291    /**
292     *  Getting all available audio output drivers.
293     *  LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS
294     *
295     *  @param pClient  Pointer to client instance structure.
296     *
297   *  @returns A NULL terminated array of audio output driver type   *  @returns A NULL terminated array of audio output driver type
298   *  name strings, or NULL in case of failure.   *  name strings, or NULL in case of failure.
299   */   */
300  const char ** lscp_get_available_audio_drivers ( lscp_client_t *pClient )  const char ** lscp_list_available_audio_drivers ( lscp_client_t *pClient )
301  {  {
302      const char *pszSeps = ",";      const char *pszSeps = ",";
303    
# Line 283  const char ** lscp_get_available_audio_d Line 309  const char ** lscp_get_available_audio_d
309          pClient->audio_drivers = NULL;          pClient->audio_drivers = NULL;
310      }      }
311    
312      if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)
313          pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);          pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);
314    
315      // Unlock this section down.      // Unlock this section down.
# Line 372  int lscp_create_audio_device ( lscp_clie Line 398  int lscp_create_audio_device ( lscp_clie
398    
399      sprintf(szQuery, "CREATE AUDIO_OUTPUT_DEVICE %s", pszAudioDriver);      sprintf(szQuery, "CREATE AUDIO_OUTPUT_DEVICE %s", pszAudioDriver);
400      lscp_param_concat(szQuery, sizeof(szQuery), pParams);      lscp_param_concat(szQuery, sizeof(szQuery), pParams);
401      if (lscp_client_call(pClient, szQuery) == LSCP_OK)      if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
402          iAudioDevice = atoi(lscp_client_get_result(pClient));          iAudioDevice = atoi(lscp_client_get_result(pClient));
403    
404      // Unlock this section down.      // Unlock this section down.
# Line 422  int lscp_get_audio_devices ( lscp_client Line 448  int lscp_get_audio_devices ( lscp_client
448      // Lock this section up.      // Lock this section up.
449      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
450    
451      if (lscp_client_call(pClient, "GET AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "GET AUDIO_OUTPUT_DEVICES\r\n", 0) == LSCP_OK)
452          iAudioDevices = atoi(lscp_client_get_result(pClient));          iAudioDevices = atoi(lscp_client_get_result(pClient));
453    
454      // Unlock this section down.      // Unlock this section down.
# Line 456  int *lscp_list_audio_devices ( lscp_clie Line 482  int *lscp_list_audio_devices ( lscp_clie
482          pClient->audio_devices = NULL;          pClient->audio_devices = NULL;
483      }      }
484    
485      if (lscp_client_call(pClient, "LIST AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "LIST AUDIO_OUTPUT_DEVICES\r\n", 0) == LSCP_OK)
486          pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);          pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);
487    
488      // Unlock this section down.      // Unlock this section down.
# Line 606  lscp_status_t lscp_set_audio_channel_par Line 632  lscp_status_t lscp_set_audio_channel_par
632  // MIDI driver control functions.  // MIDI driver control functions.
633    
634  /**  /**
635   *  Getting all available MIDI input drivers.   *  Getting all available MIDI input driver count.
636   *  GET AVAILABLE_MIDI_INPUT_DRIVERS   *  GET AVAILABLE_MIDI_INPUT_DRIVERS
637   *   *
638   *  @param pClient  Pointer to client instance structure.   *  @param pClient  Pointer to client instance structure.
639   *   *
640     *  @returns The current total number of MIDI input drivers on success,
641     *  -1 otherwise.
642     */
643    int lscp_get_available_midi_drivers ( lscp_client_t *pClient )
644    {
645        int iMidiDrivers = -1;
646    
647        // Lock this section up.
648        lscp_mutex_lock(pClient->mutex);
649    
650        if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)
651            iMidiDrivers = atoi(lscp_client_get_result(pClient));
652    
653        // Unlock this section up.
654        lscp_mutex_unlock(pClient->mutex);
655    
656        return iMidiDrivers;
657    }
658    
659    
660    /**
661     *  Getting all available MIDI input drivers.
662     *  LIST AVAILABLE_MIDI_INPUT_DRIVERS
663     *
664     *  @param pClient  Pointer to client instance structure.
665     *
666   *  @returns A NULL terminated array of MIDI input driver type   *  @returns A NULL terminated array of MIDI input driver type
667   *  name strings, or NULL in case of failure.   *  name strings, or NULL in case of failure.
668   */   */
669  const char** lscp_get_available_midi_drivers ( lscp_client_t *pClient )  const char** lscp_list_available_midi_drivers ( lscp_client_t *pClient )
670  {  {
671      const char *pszSeps = ",";      const char *pszSeps = ",";
672    
# Line 626  const char** lscp_get_available_midi_dri Line 678  const char** lscp_get_available_midi_dri
678          pClient->midi_drivers = NULL;          pClient->midi_drivers = NULL;
679      }      }
680    
681      if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "LIST AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)
682          pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);          pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);
683    
684      // Unlock this section up.      // Unlock this section up.
# Line 717  int lscp_create_midi_device ( lscp_clien Line 769  int lscp_create_midi_device ( lscp_clien
769    
770      sprintf(szQuery, "CREATE MIDI_INPUT_DEVICE %s", pszMidiDriver);      sprintf(szQuery, "CREATE MIDI_INPUT_DEVICE %s", pszMidiDriver);
771      lscp_param_concat(szQuery, sizeof(szQuery), pParams);      lscp_param_concat(szQuery, sizeof(szQuery), pParams);
772      if (lscp_client_call(pClient, szQuery) == LSCP_OK)      if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
773          iMidiDevice = atoi(lscp_client_get_result(pClient));          iMidiDevice = atoi(lscp_client_get_result(pClient));
774    
775      // Unlock this section down.      // Unlock this section down.
# Line 767  int lscp_get_midi_devices ( lscp_client_ Line 819  int lscp_get_midi_devices ( lscp_client_
819      // Lock this section up.      // Lock this section up.
820      lscp_mutex_lock(pClient->mutex);      lscp_mutex_lock(pClient->mutex);
821    
822      if (lscp_client_call(pClient, "GET MIDI_INPUT_DEVICES\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "GET MIDI_INPUT_DEVICES\r\n", 0) == LSCP_OK)
823          iMidiDevices = atoi(lscp_client_get_result(pClient));          iMidiDevices = atoi(lscp_client_get_result(pClient));
824                    
825      // Unlock this section down.      // Unlock this section down.
# Line 801  int *lscp_list_midi_devices ( lscp_clien Line 853  int *lscp_list_midi_devices ( lscp_clien
853          pClient->midi_devices = NULL;          pClient->midi_devices = NULL;
854      }      }
855    
856      if (lscp_client_call(pClient, "LIST MIDI_INPUT_DEVICES\r\n") == LSCP_OK)      if (lscp_client_call(pClient, "LIST MIDI_INPUT_DEVICES\r\n", 0) == LSCP_OK)
857          pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);          pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);
858    
859      // Unlock this section down.      // Unlock this section down.

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

  ViewVC Help
Powered by ViewVC