/[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 951 by capela, Tue Nov 28 15:31:20 2006 UTC revision 952 by capela, Tue Nov 28 22:46:32 2006 UTC
# Line 38  static lscp_device_port_info_t *_lscp_de Line 38  static lscp_device_port_info_t *_lscp_de
38  // Common driver type query command.  // Common driver type query command.
39  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 )
40  {  {
41      const char *pszResult;          const char *pszResult;
42      const char *pszSeps = ":";          const char *pszSeps = ":";
43      const char *pszCrlf = "\r\n";          const char *pszCrlf = "\r\n";
44      char *pszToken;          char *pszToken;
45      char *pch;          char *pch;
46    
47      // Lock this section up.          // Lock this section up.
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, 1) == 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) {
55              if (strcasecmp(pszToken, "DESCRIPTION") == 0) {                          if (strcasecmp(pszToken, "DESCRIPTION") == 0) {
56                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
57                  if (pszToken)                                  if (pszToken)
58                      lscp_unquote_dup(&(pDriverInfo->description), &pszToken);                                          lscp_unquote_dup(&(pDriverInfo->description), &pszToken);
59              }                          }
60              else if (strcasecmp(pszToken, "VERSION") == 0) {                          else if (strcasecmp(pszToken, "VERSION") == 0) {
61                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
62                  if (pszToken)                                  if (pszToken)
63                      lscp_unquote_dup(&(pDriverInfo->version), &pszToken);                                          lscp_unquote_dup(&(pDriverInfo->version), &pszToken);
64              }                          }
65              else if (strcasecmp(pszToken, "PARAMETERS") == 0) {                          else if (strcasecmp(pszToken, "PARAMETERS") == 0) {
66                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
67                  if (pszToken) {                                  if (pszToken) {
68                      if (pDriverInfo->parameters)                                          if (pDriverInfo->parameters)
69                          lscp_szsplit_destroy(pDriverInfo->parameters);                                                  lscp_szsplit_destroy(pDriverInfo->parameters);
70                      pDriverInfo->parameters = lscp_szsplit_create(pszToken, ",");                                          pDriverInfo->parameters = lscp_szsplit_create(pszToken, ",");
71                  }                                  }
72              }                          }
73              pszToken = lscp_strtok(NULL, pszSeps, &(pch));                          pszToken = lscp_strtok(NULL, pszSeps, &(pch));
74          }                  }
75      }          }
76      else pDriverInfo = NULL;          else pDriverInfo = NULL;
77                
78      // Unlock this section down.          // Unlock this section down.
79      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
80    
81      return pDriverInfo;          return pDriverInfo;
82  }  }
83    
84    
85  // Common device info query command.  // Common device info query command.
86  static lscp_device_info_t *_lscp_device_info_query ( lscp_client_t *pClient, lscp_device_info_t *pDeviceInfo, char *pszQuery )  static lscp_device_info_t *_lscp_device_info_query ( lscp_client_t *pClient, lscp_device_info_t *pDeviceInfo, char *pszQuery )
87  {  {
88      const char *pszResult;          const char *pszResult;
89      const char *pszSeps = ":";          const char *pszSeps = ":";
90      const char *pszCrlf = "\r\n";          const char *pszCrlf = "\r\n";
91      char *pszToken;          char *pszToken;
92      char *pch;          char *pch;
93      char *pszKey;          char *pszKey;
94    
95      // Lock this section up.          // Lock this section up.
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, 1) == 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) {
103              if (strcasecmp(pszToken, "DRIVER") == 0) {                          if (strcasecmp(pszToken, "DRIVER") == 0) {
104                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
105                  if (pszToken)                                  if (pszToken)
106                      lscp_unquote_dup(&(pDeviceInfo->driver), &pszToken);                                          lscp_unquote_dup(&(pDeviceInfo->driver), &pszToken);
107              }                          }
108              else {                          else {
109                  pszKey = pszToken;                                  pszKey = pszToken;
110                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
111                  if (pszToken)                                  if (pszToken)
112                      lscp_plist_append(&(pDeviceInfo->params), pszKey, lscp_unquote(&pszToken, 0));                                          lscp_plist_append(&(pDeviceInfo->params), pszKey, lscp_unquote(&pszToken, 0));
113              }                          }
114              pszToken = lscp_strtok(NULL, pszSeps, &(pch));                          pszToken = lscp_strtok(NULL, pszSeps, &(pch));
115          }                  }
116      }          }
117      else pDeviceInfo = NULL;          else pDeviceInfo = NULL;
118    
119      // Unlock this section down.          // Unlock this section down.
120      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
121    
122      return pDeviceInfo;          return pDeviceInfo;
123  }  }
124    
125    
126  // Common device channel/port info query command.  // Common device channel/port info query command.
127  static lscp_device_port_info_t *_lscp_device_port_info_query ( lscp_client_t *pClient, lscp_device_port_info_t *pDevicePortInfo, char *pszQuery )  static lscp_device_port_info_t *_lscp_device_port_info_query ( lscp_client_t *pClient, lscp_device_port_info_t *pDevicePortInfo, char *pszQuery )
128  {  {
129      const char *pszResult;          const char *pszResult;
130      const char *pszSeps = ":";          const char *pszSeps = ":";
131      const char *pszCrlf = "\r\n";          const char *pszCrlf = "\r\n";
132      char *pszToken;          char *pszToken;
133      char *pch;          char *pch;
134      char *pszKey;          char *pszKey;
135    
136      // Lock this section up.          // Lock this section up.
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, 1) == 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) {
144              if (strcasecmp(pszToken, "NAME") == 0) {                          if (strcasecmp(pszToken, "NAME") == 0) {
145                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
146                  if (pszToken)                                  if (pszToken)
147                      lscp_unquote_dup(&(pDevicePortInfo->name), &pszToken);                                          lscp_unquote_dup(&(pDevicePortInfo->name), &pszToken);
148              }                          }
149              else {                          else {
150                  pszKey = pszToken;                                  pszKey = pszToken;
151                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
152                  if (pszToken)                                  if (pszToken)
153                      lscp_plist_append(&(pDevicePortInfo->params), pszKey, lscp_unquote(&pszToken, 0));                                          lscp_plist_append(&(pDevicePortInfo->params), pszKey, lscp_unquote(&pszToken, 0));
154              }                          }
155              pszToken = lscp_strtok(NULL, pszSeps, &(pch));                          pszToken = lscp_strtok(NULL, pszSeps, &(pch));
156          }                  }
157      }          }
158      else pDevicePortInfo = NULL;          else pDevicePortInfo = NULL;
159    
160      // Unlock this section down.          // Unlock this section down.
161      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
162    
163      return pDevicePortInfo;          return pDevicePortInfo;
164  }  }
165    
166    
167  // Common parameter info query command.  // Common parameter info query command.
168  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 )  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 )
169  {  {
170      const char *pszResult;          const char *pszResult;
171      const char *pszSeps = ":";          const char *pszSeps = ":";
172      const char *pszCrlf = "\r\n";          const char *pszCrlf = "\r\n";
173      char *pszToken;          char *pszToken;
174      char *pch;          char *pch;
175    
176      // Lock this section up.          // Lock this section up.
177      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
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, 1) == 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) {
185              if (strcasecmp(pszToken, "TYPE") == 0) {                          if (strcasecmp(pszToken, "TYPE") == 0) {
186                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
187                  if (pszToken) {                                  if (pszToken) {
188                      pszToken = lscp_unquote(&pszToken, 0);                                          pszToken = lscp_unquote(&pszToken, 0);
189                      if (strcasecmp(pszToken, "BOOL") == 0)                                          if (strcasecmp(pszToken, "BOOL") == 0)
190                          pParamInfo->type = LSCP_TYPE_BOOL;                                                  pParamInfo->type = LSCP_TYPE_BOOL;
191                      else if (strcasecmp(pszToken, "INT") == 0)                                          else if (strcasecmp(pszToken, "INT") == 0)
192                          pParamInfo->type = LSCP_TYPE_INT;                                                  pParamInfo->type = LSCP_TYPE_INT;
193                      else if (strcasecmp(pszToken, "FLOAT") == 0)                                          else if (strcasecmp(pszToken, "FLOAT") == 0)
194                          pParamInfo->type = LSCP_TYPE_FLOAT;                                                  pParamInfo->type = LSCP_TYPE_FLOAT;
195                      else if (strcasecmp(pszToken, "STRING") == 0)                                          else if (strcasecmp(pszToken, "STRING") == 0)
196                          pParamInfo->type = LSCP_TYPE_STRING;                                                  pParamInfo->type = LSCP_TYPE_STRING;
197                  }                                  }
198              }                          }
199              else if (strcasecmp(pszToken, "DESCRIPTION") == 0) {                          else if (strcasecmp(pszToken, "DESCRIPTION") == 0) {
200                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
201                  if (pszToken)                                  if (pszToken)
202                      lscp_unquote_dup(&(pParamInfo->description), &pszToken);                                          lscp_unquote_dup(&(pParamInfo->description), &pszToken);
203              }                          }
204              else if (strcasecmp(pszToken, "MANDATORY") == 0) {                          else if (strcasecmp(pszToken, "MANDATORY") == 0) {
205                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
206                  if (pszToken)                                  if (pszToken)
207                      pParamInfo->mandatory = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);                                          pParamInfo->mandatory = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);
208              }                          }
209              else if (strcasecmp(pszToken, "FIX") == 0) {                          else if (strcasecmp(pszToken, "FIX") == 0) {
210                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
211                  if (pszToken)                                  if (pszToken)
212                      pParamInfo->fix = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);                                          pParamInfo->fix = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);
213              }                          }
214              else if (strcasecmp(pszToken, "MULTIPLICITY") == 0) {                          else if (strcasecmp(pszToken, "MULTIPLICITY") == 0) {
215                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
216                  if (pszToken)                                  if (pszToken)
217                      pParamInfo->multiplicity = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);                                          pParamInfo->multiplicity = (strcasecmp(lscp_unquote(&pszToken, 0), "TRUE") == 0);
218              }                          }
219              else if (strcasecmp(pszToken, "DEPENDS") == 0) {                          else if (strcasecmp(pszToken, "DEPENDS") == 0) {
220                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
221                  if (pszToken) {                                  if (pszToken) {
222                      if (pParamInfo->depends)                                          if (pParamInfo->depends)
223                          lscp_szsplit_destroy(pParamInfo->depends);                                                  lscp_szsplit_destroy(pParamInfo->depends);
224                      pParamInfo->depends = lscp_szsplit_create(pszToken, ",");                                          pParamInfo->depends = lscp_szsplit_create(pszToken, ",");
225                  }                                  }
226              }                          }
227              else if (strcasecmp(pszToken, "DEFAULT") == 0) {                          else if (strcasecmp(pszToken, "DEFAULT") == 0) {
228                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
229                  if (pszToken)                                  if (pszToken)
230                      lscp_unquote_dup(&(pParamInfo->defaultv), &pszToken);                                          lscp_unquote_dup(&(pParamInfo->defaultv), &pszToken);
231              }                          }
232              else if (strcasecmp(pszToken, "RANGE_MIN") == 0) {                          else if (strcasecmp(pszToken, "RANGE_MIN") == 0) {
233                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
234                  if (pszToken)                                  if (pszToken)
235                      lscp_unquote_dup(&(pParamInfo->range_min), &pszToken);                                          lscp_unquote_dup(&(pParamInfo->range_min), &pszToken);
236              }                          }
237              else if (strcasecmp(pszToken, "RANGE_MAX") == 0) {                          else if (strcasecmp(pszToken, "RANGE_MAX") == 0) {
238                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
239                  if (pszToken)                                  if (pszToken)
240                      lscp_unquote_dup(&(pParamInfo->range_max), &pszToken);                                          lscp_unquote_dup(&(pParamInfo->range_max), &pszToken);
241              }                          }
242              else if (strcasecmp(pszToken, "POSSIBILITIES") == 0) {                          else if (strcasecmp(pszToken, "POSSIBILITIES") == 0) {
243                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));                                  pszToken = lscp_strtok(NULL, pszCrlf, &(pch));
244                  if (pszToken) {                                  if (pszToken) {
245                      if (pParamInfo->possibilities)                                          if (pParamInfo->possibilities)
246                          lscp_szsplit_destroy(pParamInfo->possibilities);                                                  lscp_szsplit_destroy(pParamInfo->possibilities);
247                      pParamInfo->possibilities = lscp_szsplit_create(pszToken, ",");                                          pParamInfo->possibilities = lscp_szsplit_create(pszToken, ",");
248                  }                                  }
249              }                          }
250              pszToken = lscp_strtok(NULL, pszSeps, &(pch));                          pszToken = lscp_strtok(NULL, pszSeps, &(pch));
251          }                  }
252      }          }
253      else pParamInfo = NULL;          else pParamInfo = NULL;
254    
255      // Unlock this section down.          // Unlock this section down.
256      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
257    
258      return pParamInfo;          return pParamInfo;
259  }  }
260    
261    
# Line 273  static lscp_param_info_t *_lscp_param_in Line 273  static lscp_param_info_t *_lscp_param_in
273   */   */
274  int lscp_get_available_audio_drivers ( lscp_client_t *pClient )  int lscp_get_available_audio_drivers ( lscp_client_t *pClient )
275  {  {
276      int iAudioDrivers = -1;          int iAudioDrivers = -1;
277    
278      // Lock this section up.          // Lock this section up.
279      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
280    
281      if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)          if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)
282          iAudioDrivers = atoi(lscp_client_get_result(pClient));                  iAudioDrivers = atoi(lscp_client_get_result(pClient));
283    
284      // Unlock this section down.          // Unlock this section down.
285      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
286    
287      return iAudioDrivers;          return iAudioDrivers;
288  }  }
289    
290    
# Line 299  int lscp_get_available_audio_drivers ( l Line 299  int lscp_get_available_audio_drivers ( l
299   */   */
300  const char ** lscp_list_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    
304      // Lock this section up.          // Lock this section up.
305      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
306    
307      if (pClient->audio_drivers) {          if (pClient->audio_drivers) {
308          lscp_szsplit_destroy(pClient->audio_drivers);                  lscp_szsplit_destroy(pClient->audio_drivers);
309          pClient->audio_drivers = NULL;                  pClient->audio_drivers = NULL;
310      }          }
311    
312      if (lscp_client_call(pClient, "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == 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.
316      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
317    
318      return (const char **) pClient->audio_drivers;          return (const char **) pClient->audio_drivers;
319  }  }
320    
321    
# Line 331  const char ** lscp_list_available_audio_ Line 331  const char ** lscp_list_available_audio_
331   */   */
332  lscp_driver_info_t* lscp_get_audio_driver_info ( lscp_client_t *pClient, const char *pszAudioDriver )  lscp_driver_info_t* lscp_get_audio_driver_info ( lscp_client_t *pClient, const char *pszAudioDriver )
333  {  {
334      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
335    
336      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
337          return NULL;                  return NULL;
338    
339      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);          sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);
340      return _lscp_driver_info_query(pClient, &(pClient->audio_driver_info), szQuery);          return _lscp_driver_info_query(pClient, &(pClient->audio_driver_info), szQuery);
341  }  }
342    
343    
# Line 355  lscp_driver_info_t* lscp_get_audio_drive Line 355  lscp_driver_info_t* lscp_get_audio_drive
355   */   */
356  lscp_param_info_t *lscp_get_audio_driver_param_info ( lscp_client_t *pClient, const char *pszAudioDriver, const char *pszParam, lscp_param_t *pDepList )  lscp_param_info_t *lscp_get_audio_driver_param_info ( lscp_client_t *pClient, const char *pszAudioDriver, const char *pszParam, lscp_param_t *pDepList )
357  {  {
358      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
359    
360      if (pClient == NULL)          if (pClient == NULL)
361          return NULL;                  return NULL;
362      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
363          return NULL;                  return NULL;
364      if (pszParam == NULL)          if (pszParam == NULL)
365          return NULL;                  return NULL;
366    
367      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s", pszAudioDriver, pszParam);          sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s", pszAudioDriver, pszParam);
368      return _lscp_param_info_query(pClient, &(pClient->audio_param_info), szQuery, sizeof(szQuery), pDepList);          return _lscp_param_info_query(pClient, &(pClient->audio_param_info), szQuery, sizeof(szQuery), pDepList);
369  }  }
370    
371    
# Line 385  lscp_param_info_t *lscp_get_audio_driver Line 385  lscp_param_info_t *lscp_get_audio_driver
385   */   */
386  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 )
387  {  {
388      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
389      int iAudioDevice = -1;          int iAudioDevice = -1;
390    
391      if (pClient == NULL)          if (pClient == NULL)
392          return iAudioDevice;                  return iAudioDevice;
393      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
394          return iAudioDevice;                  return iAudioDevice;
395    
396      // Lock this section up.          // Lock this section up.
397      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
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, 0) == 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.
405      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
406    
407      return iAudioDevice;          return iAudioDevice;
408  }  }
409    
410    
# Line 419  int lscp_create_audio_device ( lscp_clie Line 419  int lscp_create_audio_device ( lscp_clie
419   */   */
420  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 )
421  {  {
422      lscp_status_t ret = LSCP_FAILED;          lscp_status_t ret = LSCP_FAILED;
423      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
424    
425      if (pClient == NULL)          if (pClient == NULL)
426          return ret;                  return ret;
427      if (iAudioDevice < 0)          if (iAudioDevice < 0)
428          return ret;                  return ret;
429    
430      sprintf(szQuery, "DESTROY AUDIO_OUTPUT_DEVICE %d\r\n", iAudioDevice);          sprintf(szQuery, "DESTROY AUDIO_OUTPUT_DEVICE %d\r\n", iAudioDevice);
431      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
432  }  }
433    
434    
# Line 443  lscp_status_t lscp_destroy_audio_device Line 443  lscp_status_t lscp_destroy_audio_device
443   */   */
444  int lscp_get_audio_devices ( lscp_client_t *pClient )  int lscp_get_audio_devices ( lscp_client_t *pClient )
445  {  {
446      int iAudioDevices = -1;          int iAudioDevices = -1;
447    
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", 0) == 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.
455      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
456    
457      return iAudioDevices;          return iAudioDevices;
458  }  }
459    
460    
# Line 469  int lscp_get_audio_devices ( lscp_client Line 469  int lscp_get_audio_devices ( lscp_client
469   */   */
470  int *lscp_list_audio_devices ( lscp_client_t *pClient )  int *lscp_list_audio_devices ( lscp_client_t *pClient )
471  {  {
472      const char *pszSeps = ",";          const char *pszSeps = ",";
473    
474      if (pClient == NULL)          if (pClient == NULL)
475          return NULL;                  return NULL;
476    
477      // Lock this section up.          // Lock this section up.
478      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
479    
480      if (pClient->audio_devices) {          if (pClient->audio_devices) {
481          lscp_isplit_destroy(pClient->audio_devices);                  lscp_isplit_destroy(pClient->audio_devices);
482          pClient->audio_devices = NULL;                  pClient->audio_devices = NULL;
483      }          }
484    
485      if (lscp_client_call(pClient, "LIST AUDIO_OUTPUT_DEVICES\r\n", 0) == 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.
489      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
490    
491      return pClient->audio_devices;          return pClient->audio_devices;
492  }  }
493    
494    
# Line 504  int *lscp_list_audio_devices ( lscp_clie Line 504  int *lscp_list_audio_devices ( lscp_clie
504   */   */
505  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 )
506  {  {
507      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
508    
509      if (pClient == NULL)          if (pClient == NULL)
510          return NULL;                  return NULL;
511      if (iAudioDevice < 0)          if (iAudioDevice < 0)
512          return NULL;                  return NULL;
513    
514      sprintf(szQuery, "GET AUDIO_OUTPUT_DEVICE INFO %d\r\n", iAudioDevice);          sprintf(szQuery, "GET AUDIO_OUTPUT_DEVICE INFO %d\r\n", iAudioDevice);
515      return _lscp_device_info_query(pClient, &(pClient->audio_device_info), szQuery);          return _lscp_device_info_query(pClient, &(pClient->audio_device_info), szQuery);
516  }  }
517    
518    
# Line 528  lscp_device_info_t *lscp_get_audio_devic Line 528  lscp_device_info_t *lscp_get_audio_devic
528   */   */
529  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 )
530  {  {
531      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
532    
533      if (pClient == NULL)          if (pClient == NULL)
534          return LSCP_FAILED;                  return LSCP_FAILED;
535      if (iAudioDevice < 0)          if (iAudioDevice < 0)
536          return LSCP_FAILED;                  return LSCP_FAILED;
537      if (pParam == NULL)          if (pParam == NULL)
538          return LSCP_FAILED;                  return LSCP_FAILED;
539    
540      sprintf(szQuery, "SET AUDIO_OUTPUT_DEVICE_PARAMETER %d %s='%s'\r\n", iAudioDevice, pParam->key, pParam->value);          sprintf(szQuery, "SET AUDIO_OUTPUT_DEVICE_PARAMETER %d %s='%s'\r\n", iAudioDevice, pParam->key, pParam->value);
541      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
542  }  }
543    
544    
# Line 555  lscp_status_t lscp_set_audio_device_para Line 555  lscp_status_t lscp_set_audio_device_para
555   */   */
556  lscp_device_port_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 )
557  {  {
558      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
559    
560      if (pClient == NULL)          if (pClient == NULL)
561          return NULL;                  return NULL;
562      if (iAudioDevice < 0)          if (iAudioDevice < 0)
563          return NULL;                  return NULL;
564      if (iAudioChannel < 0)          if (iAudioChannel < 0)
565          return NULL;                  return NULL;
566    
567      sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL INFO %d %d\r\n", iAudioDevice, iAudioChannel);          sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL INFO %d %d\r\n", iAudioDevice, iAudioChannel);
568      return _lscp_device_port_info_query(pClient, &(pClient->audio_channel_info), szQuery);          return _lscp_device_port_info_query(pClient, &(pClient->audio_channel_info), szQuery);
569  }  }
570    
571    
# Line 583  lscp_device_port_info_t* lscp_get_audio_ Line 583  lscp_device_port_info_t* lscp_get_audio_
583   */   */
584  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 )
585  {  {
586      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
587    
588      if (pClient == NULL)          if (pClient == NULL)
589          return NULL;                  return NULL;
590      if (iAudioDevice < 0)          if (iAudioDevice < 0)
591          return NULL;                  return NULL;
592      if (iAudioChannel < 0)          if (iAudioChannel < 0)
593          return NULL;                  return NULL;
594      if (pszParam == NULL)          if (pszParam == NULL)
595          return NULL;                  return NULL;
596    
597      sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL_PARAMETER INFO %d %d %s", iAudioDevice, iAudioChannel, pszParam);          sprintf(szQuery, "GET AUDIO_OUTPUT_CHANNEL_PARAMETER INFO %d %d %s", iAudioDevice, iAudioChannel, pszParam);
598      return _lscp_param_info_query(pClient, &(pClient->audio_channel_param_info), szQuery, sizeof(szQuery), NULL);          return _lscp_param_info_query(pClient, &(pClient->audio_channel_param_info), szQuery, sizeof(szQuery), NULL);
599  }  }
600    
601    
# Line 612  lscp_param_info_t* lscp_get_audio_channe Line 612  lscp_param_info_t* lscp_get_audio_channe
612   */   */
613  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 )
614  {  {
615      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
616    
617      if (pClient == NULL)          if (pClient == NULL)
618          return LSCP_FAILED;                  return LSCP_FAILED;
619      if (iAudioDevice < 0)          if (iAudioDevice < 0)
620          return LSCP_FAILED;                  return LSCP_FAILED;
621      if (iAudioChannel < 0)          if (iAudioChannel < 0)
622          return LSCP_FAILED;                  return LSCP_FAILED;
623      if (pParam == NULL)          if (pParam == NULL)
624          return LSCP_FAILED;                  return LSCP_FAILED;
625    
626      sprintf(szQuery, "SET AUDIO_OUTPUT_CHANNEL_PARAMETER %d %d %s='%s'\r\n", iAudioDevice, iAudioChannel, pParam->key, pParam->value);          sprintf(szQuery, "SET AUDIO_OUTPUT_CHANNEL_PARAMETER %d %d %s='%s'\r\n", iAudioDevice, iAudioChannel, pParam->key, pParam->value);
627      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
628  }  }
629    
630    
# Line 642  lscp_status_t lscp_set_audio_channel_par Line 642  lscp_status_t lscp_set_audio_channel_par
642   */   */
643  int lscp_get_available_midi_drivers ( lscp_client_t *pClient )  int lscp_get_available_midi_drivers ( lscp_client_t *pClient )
644  {  {
645      int iMidiDrivers = -1;          int iMidiDrivers = -1;
646    
647      // Lock this section up.          // Lock this section up.
648      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
649    
650      if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)          if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)
651          iMidiDrivers = atoi(lscp_client_get_result(pClient));                  iMidiDrivers = atoi(lscp_client_get_result(pClient));
652    
653      // Unlock this section up.          // Unlock this section up.
654      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
655    
656      return iMidiDrivers;          return iMidiDrivers;
657  }  }
658    
659    
# Line 668  int lscp_get_available_midi_drivers ( ls Line 668  int lscp_get_available_midi_drivers ( ls
668   */   */
669  const char** lscp_list_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    
673      // Lock this section up.          // Lock this section up.
674      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
675    
676      if (pClient->midi_drivers) {          if (pClient->midi_drivers) {
677          lscp_szsplit_destroy(pClient->midi_drivers);                  lscp_szsplit_destroy(pClient->midi_drivers);
678          pClient->midi_drivers = NULL;                  pClient->midi_drivers = NULL;
679      }          }
680    
681      if (lscp_client_call(pClient, "LIST AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == 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.
685      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
686    
687      return (const char **) pClient->midi_drivers;          return (const char **) pClient->midi_drivers;
688  }  }
689    
690    
# Line 700  const char** lscp_list_available_midi_dr Line 700  const char** lscp_list_available_midi_dr
700   */   */
701  lscp_driver_info_t* lscp_get_midi_driver_info ( lscp_client_t *pClient, const char *pszMidiDriver )  lscp_driver_info_t* lscp_get_midi_driver_info ( lscp_client_t *pClient, const char *pszMidiDriver )
702  {  {
703      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
704    
705      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
706          return NULL;                  return NULL;
707    
708      sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);          sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);
709      return _lscp_driver_info_query(pClient, &(pClient->midi_driver_info), szQuery);          return _lscp_driver_info_query(pClient, &(pClient->midi_driver_info), szQuery);
710  }  }
711    
712    
# Line 726  lscp_driver_info_t* lscp_get_midi_driver Line 726  lscp_driver_info_t* lscp_get_midi_driver
726   */   */
727  lscp_param_info_t *lscp_get_midi_driver_param_info ( lscp_client_t *pClient, const char *pszMidiDriver, const char *pszParam, lscp_param_t *pDepList )  lscp_param_info_t *lscp_get_midi_driver_param_info ( lscp_client_t *pClient, const char *pszMidiDriver, const char *pszParam, lscp_param_t *pDepList )
728  {  {
729      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
730    
731      if (pClient == NULL)          if (pClient == NULL)
732          return NULL;                  return NULL;
733      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
734          return NULL;                  return NULL;
735      if (pszParam == NULL)          if (pszParam == NULL)
736          return NULL;                  return NULL;
737    
738      sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s", pszMidiDriver, pszParam);          sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s", pszMidiDriver, pszParam);
739      return _lscp_param_info_query(pClient, &(pClient->midi_param_info), szQuery, sizeof(szQuery), pDepList);          return _lscp_param_info_query(pClient, &(pClient->midi_param_info), szQuery, sizeof(szQuery), pDepList);
740  }  }
741    
742    
# Line 756  lscp_param_info_t *lscp_get_midi_driver_ Line 756  lscp_param_info_t *lscp_get_midi_driver_
756   */   */
757  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 )
758  {  {
759      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
760      int iMidiDevice = -1;          int iMidiDevice = -1;
761    
762      if (pClient == NULL)          if (pClient == NULL)
763          return iMidiDevice;                  return iMidiDevice;
764      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
765          return iMidiDevice;                  return iMidiDevice;
766    
767      // Lock this section up.          // Lock this section up.
768      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
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, 0) == 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.
776      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
777    
778      return iMidiDevice;          return iMidiDevice;
779  }  }
780    
781    
# Line 790  int lscp_create_midi_device ( lscp_clien Line 790  int lscp_create_midi_device ( lscp_clien
790   */   */
791  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 )
792  {  {
793      lscp_status_t ret = LSCP_FAILED;          lscp_status_t ret = LSCP_FAILED;
794      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
795    
796      if (pClient == NULL)          if (pClient == NULL)
797          return ret;                  return ret;
798      if (iMidiDevice < 0)          if (iMidiDevice < 0)
799          return ret;                  return ret;
800    
801      sprintf(szQuery, "DESTROY MIDI_INPUT_DEVICE %d\r\n", iMidiDevice);          sprintf(szQuery, "DESTROY MIDI_INPUT_DEVICE %d\r\n", iMidiDevice);
802      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
803  }  }
804    
805    
# Line 814  lscp_status_t lscp_destroy_midi_device ( Line 814  lscp_status_t lscp_destroy_midi_device (
814   */   */
815  int lscp_get_midi_devices ( lscp_client_t *pClient )  int lscp_get_midi_devices ( lscp_client_t *pClient )
816  {  {
817      int iMidiDevices = -1;          int iMidiDevices = -1;
818    
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", 0) == 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.
826      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
827    
828      return iMidiDevices;          return iMidiDevices;
829  }  }
830    
831    
# Line 840  int lscp_get_midi_devices ( lscp_client_ Line 840  int lscp_get_midi_devices ( lscp_client_
840   */   */
841  int *lscp_list_midi_devices ( lscp_client_t *pClient )  int *lscp_list_midi_devices ( lscp_client_t *pClient )
842  {  {
843      const char *pszSeps = ",";          const char *pszSeps = ",";
844    
845      if (pClient == NULL)          if (pClient == NULL)
846          return NULL;                  return NULL;
847    
848      // Lock this section up.          // Lock this section up.
849      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
850    
851      if (pClient->midi_devices) {          if (pClient->midi_devices) {
852          lscp_isplit_destroy(pClient->midi_devices);                  lscp_isplit_destroy(pClient->midi_devices);
853          pClient->midi_devices = NULL;                  pClient->midi_devices = NULL;
854      }          }
855    
856      if (lscp_client_call(pClient, "LIST MIDI_INPUT_DEVICES\r\n", 0) == 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.
860      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
861    
862      return pClient->midi_devices;          return pClient->midi_devices;
863  }  }
864    
865    
# Line 875  int *lscp_list_midi_devices ( lscp_clien Line 875  int *lscp_list_midi_devices ( lscp_clien
875   */   */
876  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 )
877  {  {
878      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
879    
880      if (pClient == NULL)          if (pClient == NULL)
881          return NULL;                  return NULL;
882      if (iMidiDevice < 0)          if (iMidiDevice < 0)
883          return NULL;                  return NULL;
884    
885      sprintf(szQuery, "GET MIDI_INPUT_DEVICE INFO %d\r\n", iMidiDevice);          sprintf(szQuery, "GET MIDI_INPUT_DEVICE INFO %d\r\n", iMidiDevice);
886      return _lscp_device_info_query(pClient, &(pClient->midi_device_info), szQuery);          return _lscp_device_info_query(pClient, &(pClient->midi_device_info), szQuery);
887  }  }
888    
889    
# Line 899  lscp_device_info_t* lscp_get_midi_device Line 899  lscp_device_info_t* lscp_get_midi_device
899   */   */
900  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 )
901  {  {
902      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
903    
904      if (pClient == NULL)          if (pClient == NULL)
905          return LSCP_FAILED;                  return LSCP_FAILED;
906      if (iMidiDevice < 0)          if (iMidiDevice < 0)
907          return LSCP_FAILED;                  return LSCP_FAILED;
908      if (pParam == NULL)          if (pParam == NULL)
909          return LSCP_FAILED;                  return LSCP_FAILED;
910    
911      sprintf(szQuery, "SET MIDI_INPUT_DEVICE_PARAMETER %d %s='%s'\r\n", iMidiDevice, pParam->key, pParam->value);          sprintf(szQuery, "SET MIDI_INPUT_DEVICE_PARAMETER %d %s='%s'\r\n", iMidiDevice, pParam->key, pParam->value);
912      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
913  }  }
914    
915    
# Line 926  lscp_status_t lscp_set_midi_device_param Line 926  lscp_status_t lscp_set_midi_device_param
926   */   */
927  lscp_device_port_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 )
928  {  {
929      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
930    
931      if (pClient == NULL)          if (pClient == NULL)
932          return NULL;                  return NULL;
933      if (iMidiDevice < 0)          if (iMidiDevice < 0)
934          return NULL;                  return NULL;
935      if (iMidiPort < 0)          if (iMidiPort < 0)
936          return NULL;                  return NULL;
937    
938      sprintf(szQuery, "GET MIDI_INPUT_PORT INFO %d %d\r\n", iMidiDevice, iMidiPort);          sprintf(szQuery, "GET MIDI_INPUT_PORT INFO %d %d\r\n", iMidiDevice, iMidiPort);
939      return _lscp_device_port_info_query(pClient, &(pClient->midi_port_info), szQuery);          return _lscp_device_port_info_query(pClient, &(pClient->midi_port_info), szQuery);
940  }  }
941    
942    
# Line 954  lscp_device_port_info_t* lscp_get_midi_p Line 954  lscp_device_port_info_t* lscp_get_midi_p
954   */   */
955  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 )
956  {  {
957      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
958    
959      if (pClient == NULL)          if (pClient == NULL)
960          return NULL;                  return NULL;
961      if (iMidiDevice < 0)          if (iMidiDevice < 0)
962          return NULL;                  return NULL;
963      if (iMidiPort < 0)          if (iMidiPort < 0)
964          return NULL;                  return NULL;
965      if (pszParam == NULL)          if (pszParam == NULL)
966          return NULL;                  return NULL;
967    
968      sprintf(szQuery, "GET MIDI_INPUT_PORT_PARAMETER INFO %d %d %s", iMidiDevice, iMidiPort, pszParam);          sprintf(szQuery, "GET MIDI_INPUT_PORT_PARAMETER INFO %d %d %s", iMidiDevice, iMidiPort, pszParam);
969      return _lscp_param_info_query(pClient, &(pClient->midi_port_param_info), szQuery, sizeof(szQuery), NULL);          return _lscp_param_info_query(pClient, &(pClient->midi_port_param_info), szQuery, sizeof(szQuery), NULL);
970  }  }
971    
972    
# Line 983  lscp_param_info_t* lscp_get_midi_port_pa Line 983  lscp_param_info_t* lscp_get_midi_port_pa
983   */   */
984  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 )
985  {  {
986      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
987    
988      if (pClient == NULL)          if (pClient == NULL)
989          return LSCP_FAILED;                  return LSCP_FAILED;
990      if (iMidiDevice < 0)          if (iMidiDevice < 0)
991          return LSCP_FAILED;                  return LSCP_FAILED;
992      if (iMidiPort < 0)          if (iMidiPort < 0)
993          return LSCP_FAILED;                  return LSCP_FAILED;
994      if (pParam == NULL)          if (pParam == NULL)
995          return LSCP_FAILED;                  return LSCP_FAILED;
996    
997      sprintf(szQuery, "SET MIDI_INPUT_PORT_PARAMETER %d %d %s='%s'\r\n", iMidiDevice, iMidiPort, pParam->key, pParam->value);          sprintf(szQuery, "SET MIDI_INPUT_PORT_PARAMETER %d %d %s='%s'\r\n", iMidiDevice, iMidiPort, pParam->key, pParam->value);
998      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
999  }  }
1000    
1001    
# Line 1004  lscp_status_t lscp_set_midi_port_param ( Line 1004  lscp_status_t lscp_set_midi_port_param (
1004    
1005  const char *lscp_get_param_value ( lscp_param_t *pParams, const char *pszParam )  const char *lscp_get_param_value ( lscp_param_t *pParams, const char *pszParam )
1006  {  {
1007      int i;          int i;
1008    
1009      for (i = 0; pParams && pParams[i].key; i++) {          for (i = 0; pParams && pParams[i].key; i++) {
1010          if (strcasecmp(pParams[i].key, pszParam) == 0)                  if (strcasecmp(pParams[i].key, pszParam) == 0)
1011              return (const char *) pParams[i].value;                          return (const char *) pParams[i].value;
1012      }          }
1013      return NULL;          return NULL;
1014  }  }
1015    
1016    

Legend:
Removed from v.951  
changed lines
  Added in v.952

  ViewVC Help
Powered by ViewVC