/[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 869 by capela, Thu Jun 1 08:32:16 2006 UTC revision 975 by capela, Sun Dec 17 00:59:40 2006 UTC
# 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 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) == 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) == 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) == 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) == 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.          if (pClient == NULL)
279      lscp_mutex_lock(pClient->mutex);                  return -1;
280    
281      if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n") == LSCP_OK)          // Lock this section up.
282          iAudioDrivers = atoi(lscp_client_get_result(pClient));          lscp_mutex_lock(pClient->mutex);
283    
284      // Unlock this section down.          if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)
285      lscp_mutex_unlock(pClient->mutex);                  iAudioDrivers = atoi(lscp_client_get_result(pClient));
286    
287      return iAudioDrivers;          // Unlock this section down.
288            lscp_mutex_unlock(pClient->mutex);
289    
290            return iAudioDrivers;
291  }  }
292    
293    
# Line 299  int lscp_get_available_audio_drivers ( l Line 302  int lscp_get_available_audio_drivers ( l
302   */   */
303  const char ** lscp_list_available_audio_drivers ( lscp_client_t *pClient )  const char ** lscp_list_available_audio_drivers ( lscp_client_t *pClient )
304  {  {
305      const char *pszSeps = ",";          const char *pszSeps = ",";
306    
307            if (pClient == NULL)
308                    return NULL;
309    
310      // Lock this section up.          // Lock this section up.
311      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
312    
313      if (pClient->audio_drivers) {          if (pClient->audio_drivers) {
314          lscp_szsplit_destroy(pClient->audio_drivers);                  lscp_szsplit_destroy(pClient->audio_drivers);
315          pClient->audio_drivers = NULL;                  pClient->audio_drivers = NULL;
316      }          }
317    
318      if (lscp_client_call(pClient, "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n") == LSCP_OK)          if (lscp_client_call(pClient, "LIST AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n", 0) == LSCP_OK)
319          pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);                  pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);
320    
321      // Unlock this section down.          // Unlock this section down.
322      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
323    
324      return (const char **) pClient->audio_drivers;          return (const char **) pClient->audio_drivers;
325  }  }
326    
327    
# Line 331  const char ** lscp_list_available_audio_ Line 337  const char ** lscp_list_available_audio_
337   */   */
338  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 )
339  {  {
340      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
341    
342      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
343          return NULL;                  return NULL;
344    
345      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);          sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER INFO %s\r\n", pszAudioDriver);
346      return _lscp_driver_info_query(pClient, &(pClient->audio_driver_info), szQuery);          return _lscp_driver_info_query(pClient, &(pClient->audio_driver_info), szQuery);
347  }  }
348    
349    
# Line 355  lscp_driver_info_t* lscp_get_audio_drive Line 361  lscp_driver_info_t* lscp_get_audio_drive
361   */   */
362  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 )
363  {  {
364      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
365    
366      if (pClient == NULL)          if (pClient == NULL)
367          return NULL;                  return NULL;
368      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
369          return NULL;                  return NULL;
370      if (pszParam == NULL)          if (pszParam == NULL)
371          return NULL;                  return NULL;
372    
373      sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s", pszAudioDriver, pszParam);          sprintf(szQuery, "GET AUDIO_OUTPUT_DRIVER_PARAMETER INFO %s %s", pszAudioDriver, pszParam);
374      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);
375  }  }
376    
377    
# Line 385  lscp_param_info_t *lscp_get_audio_driver Line 391  lscp_param_info_t *lscp_get_audio_driver
391   */   */
392  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 )
393  {  {
394      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
395      int iAudioDevice = -1;          int iAudioDevice = -1;
396    
397      if (pClient == NULL)          if (pClient == NULL)
398          return iAudioDevice;                  return -1;
399      if (pszAudioDriver == NULL)          if (pszAudioDriver == NULL)
400          return iAudioDevice;                  return -1;
401    
402      // Lock this section up.          // Lock this section up.
403      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
404    
405      sprintf(szQuery, "CREATE AUDIO_OUTPUT_DEVICE %s", pszAudioDriver);          sprintf(szQuery, "CREATE AUDIO_OUTPUT_DEVICE %s", pszAudioDriver);
406      lscp_param_concat(szQuery, sizeof(szQuery), pParams);          lscp_param_concat(szQuery, sizeof(szQuery), pParams);
407      if (lscp_client_call(pClient, szQuery) == LSCP_OK)          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
408          iAudioDevice = atoi(lscp_client_get_result(pClient));                  iAudioDevice = atoi(lscp_client_get_result(pClient));
409    
410      // Unlock this section down.          // Unlock this section down.
411      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
412    
413      return iAudioDevice;          return iAudioDevice;
414  }  }
415    
416    
# Line 419  int lscp_create_audio_device ( lscp_clie Line 425  int lscp_create_audio_device ( lscp_clie
425   */   */
426  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 )
427  {  {
428      lscp_status_t ret = LSCP_FAILED;          lscp_status_t ret = LSCP_FAILED;
429      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
430    
431      if (pClient == NULL)          if (pClient == NULL)
432          return ret;                  return ret;
433      if (iAudioDevice < 0)          if (iAudioDevice < 0)
434          return ret;                  return ret;
435    
436      sprintf(szQuery, "DESTROY AUDIO_OUTPUT_DEVICE %d\r\n", iAudioDevice);          sprintf(szQuery, "DESTROY AUDIO_OUTPUT_DEVICE %d\r\n", iAudioDevice);
437      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
438  }  }
439    
440    
# Line 443  lscp_status_t lscp_destroy_audio_device Line 449  lscp_status_t lscp_destroy_audio_device
449   */   */
450  int lscp_get_audio_devices ( lscp_client_t *pClient )  int lscp_get_audio_devices ( lscp_client_t *pClient )
451  {  {
452      int iAudioDevices = -1;          int iAudioDevices = -1;
453    
454            if (pClient == NULL)
455                    return -1;
456    
457      // Lock this section up.          // Lock this section up.
458      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
459    
460      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)
461          iAudioDevices = atoi(lscp_client_get_result(pClient));                  iAudioDevices = atoi(lscp_client_get_result(pClient));
462    
463      // Unlock this section down.          // Unlock this section down.
464      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
465    
466      return iAudioDevices;          return iAudioDevices;
467  }  }
468    
469    
# Line 469  int lscp_get_audio_devices ( lscp_client Line 478  int lscp_get_audio_devices ( lscp_client
478   */   */
479  int *lscp_list_audio_devices ( lscp_client_t *pClient )  int *lscp_list_audio_devices ( lscp_client_t *pClient )
480  {  {
481      const char *pszSeps = ",";          const char *pszSeps = ",";
482    
483      if (pClient == NULL)          if (pClient == NULL)
484          return NULL;                  return NULL;
485    
486      // Lock this section up.          // Lock this section up.
487      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
488    
489      if (pClient->audio_devices) {          if (pClient->audio_devices) {
490          lscp_isplit_destroy(pClient->audio_devices);                  lscp_isplit_destroy(pClient->audio_devices);
491          pClient->audio_devices = NULL;                  pClient->audio_devices = NULL;
492      }          }
493    
494      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)
495          pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);                  pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);
496    
497      // Unlock this section down.          // Unlock this section down.
498      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
499    
500      return pClient->audio_devices;          return pClient->audio_devices;
501  }  }
502    
503    
# Line 504  int *lscp_list_audio_devices ( lscp_clie Line 513  int *lscp_list_audio_devices ( lscp_clie
513   */   */
514  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 )
515  {  {
516      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
517    
518      if (pClient == NULL)          if (pClient == NULL)
519          return NULL;                  return NULL;
520      if (iAudioDevice < 0)          if (iAudioDevice < 0)
521          return NULL;                  return NULL;
522    
523      sprintf(szQuery, "GET AUDIO_OUTPUT_DEVICE INFO %d\r\n", iAudioDevice);          sprintf(szQuery, "GET AUDIO_OUTPUT_DEVICE INFO %d\r\n", iAudioDevice);
524      return _lscp_device_info_query(pClient, &(pClient->audio_device_info), szQuery);          return _lscp_device_info_query(pClient, &(pClient->audio_device_info), szQuery);
525  }  }
526    
527    
# Line 528  lscp_device_info_t *lscp_get_audio_devic Line 537  lscp_device_info_t *lscp_get_audio_devic
537   */   */
538  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 )
539  {  {
540      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
541    
542      if (pClient == NULL)          if (pClient == NULL)
543          return LSCP_FAILED;                  return LSCP_FAILED;
544      if (iAudioDevice < 0)          if (iAudioDevice < 0)
545          return LSCP_FAILED;                  return LSCP_FAILED;
546      if (pParam == NULL)          if (pParam == NULL)
547          return LSCP_FAILED;                  return LSCP_FAILED;
548    
549      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);
550      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
551  }  }
552    
553    
# Line 555  lscp_status_t lscp_set_audio_device_para Line 564  lscp_status_t lscp_set_audio_device_para
564   */   */
565  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 )
566  {  {
567      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
568    
569      if (pClient == NULL)          if (pClient == NULL)
570          return NULL;                  return NULL;
571      if (iAudioDevice < 0)          if (iAudioDevice < 0)
572          return NULL;                  return NULL;
573      if (iAudioChannel < 0)          if (iAudioChannel < 0)
574          return NULL;                  return NULL;
575    
576      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);
577      return _lscp_device_port_info_query(pClient, &(pClient->audio_channel_info), szQuery);          return _lscp_device_port_info_query(pClient, &(pClient->audio_channel_info), szQuery);
578  }  }
579    
580    
# Line 583  lscp_device_port_info_t* lscp_get_audio_ Line 592  lscp_device_port_info_t* lscp_get_audio_
592   */   */
593  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 )
594  {  {
595      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
596    
597      if (pClient == NULL)          if (pClient == NULL)
598          return NULL;                  return NULL;
599      if (iAudioDevice < 0)          if (iAudioDevice < 0)
600          return NULL;                  return NULL;
601      if (iAudioChannel < 0)          if (iAudioChannel < 0)
602          return NULL;                  return NULL;
603      if (pszParam == NULL)          if (pszParam == NULL)
604          return NULL;                  return NULL;
605    
606      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);
607      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);
608  }  }
609    
610    
# Line 612  lscp_param_info_t* lscp_get_audio_channe Line 621  lscp_param_info_t* lscp_get_audio_channe
621   */   */
622  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 )
623  {  {
624      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
625    
626      if (pClient == NULL)          if (pClient == NULL)
627          return LSCP_FAILED;                  return LSCP_FAILED;
628      if (iAudioDevice < 0)          if (iAudioDevice < 0)
629          return LSCP_FAILED;                  return LSCP_FAILED;
630      if (iAudioChannel < 0)          if (iAudioChannel < 0)
631          return LSCP_FAILED;                  return LSCP_FAILED;
632      if (pParam == NULL)          if (pParam == NULL)
633          return LSCP_FAILED;                  return LSCP_FAILED;
634    
635      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);
636      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
637  }  }
638    
639    
# Line 642  lscp_status_t lscp_set_audio_channel_par Line 651  lscp_status_t lscp_set_audio_channel_par
651   */   */
652  int lscp_get_available_midi_drivers ( lscp_client_t *pClient )  int lscp_get_available_midi_drivers ( lscp_client_t *pClient )
653  {  {
654      int iMidiDrivers = -1;          int iMidiDrivers = -1;
655    
656      // Lock this section up.          if (pClient == NULL)
657      lscp_mutex_lock(pClient->mutex);                  return -1;
658    
659      if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n") == LSCP_OK)          // Lock this section up.
660          iMidiDrivers = atoi(lscp_client_get_result(pClient));          lscp_mutex_lock(pClient->mutex);
661    
662      // Unlock this section up.          if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)
663      lscp_mutex_unlock(pClient->mutex);                  iMidiDrivers = atoi(lscp_client_get_result(pClient));
664    
665      return iMidiDrivers;          // Unlock this section up.
666            lscp_mutex_unlock(pClient->mutex);
667    
668            return iMidiDrivers;
669  }  }
670    
671    
# Line 668  int lscp_get_available_midi_drivers ( ls Line 680  int lscp_get_available_midi_drivers ( ls
680   */   */
681  const char** lscp_list_available_midi_drivers ( lscp_client_t *pClient )  const char** lscp_list_available_midi_drivers ( lscp_client_t *pClient )
682  {  {
683      const char *pszSeps = ",";          const char *pszSeps = ",";
684    
685            if (pClient == NULL)
686                    return NULL;
687    
688      // Lock this section up.          // Lock this section up.
689      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
690    
691      if (pClient->midi_drivers) {          if (pClient->midi_drivers) {
692          lscp_szsplit_destroy(pClient->midi_drivers);                  lscp_szsplit_destroy(pClient->midi_drivers);
693          pClient->midi_drivers = NULL;                  pClient->midi_drivers = NULL;
694      }          }
695    
696      if (lscp_client_call(pClient, "LIST AVAILABLE_MIDI_INPUT_DRIVERS\r\n") == LSCP_OK)          if (lscp_client_call(pClient, "LIST AVAILABLE_MIDI_INPUT_DRIVERS\r\n", 0) == LSCP_OK)
697          pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);                  pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps);
698    
699      // Unlock this section up.          // Unlock this section up.
700      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
701    
702      return (const char **) pClient->midi_drivers;          return (const char **) pClient->midi_drivers;
703  }  }
704    
705    
# Line 700  const char** lscp_list_available_midi_dr Line 715  const char** lscp_list_available_midi_dr
715   */   */
716  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 )
717  {  {
718      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
719    
720      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
721          return NULL;                  return NULL;
722    
723      sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);          sprintf(szQuery, "GET MIDI_INPUT_DRIVER INFO %s\r\n", pszMidiDriver);
724      return _lscp_driver_info_query(pClient, &(pClient->midi_driver_info), szQuery);          return _lscp_driver_info_query(pClient, &(pClient->midi_driver_info), szQuery);
725  }  }
726    
727    
# Line 726  lscp_driver_info_t* lscp_get_midi_driver Line 741  lscp_driver_info_t* lscp_get_midi_driver
741   */   */
742  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 )
743  {  {
744      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
745    
746      if (pClient == NULL)          if (pClient == NULL)
747          return NULL;                  return NULL;
748      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
749          return NULL;                  return NULL;
750      if (pszParam == NULL)          if (pszParam == NULL)
751          return NULL;                  return NULL;
752    
753      sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s", pszMidiDriver, pszParam);          sprintf(szQuery, "GET MIDI_INPUT_DRIVER_PARAMETER INFO %s %s", pszMidiDriver, pszParam);
754      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);
755  }  }
756    
757    
# Line 756  lscp_param_info_t *lscp_get_midi_driver_ Line 771  lscp_param_info_t *lscp_get_midi_driver_
771   */   */
772  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 )
773  {  {
774      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
775      int iMidiDevice = -1;          int iMidiDevice = -1;
776    
777      if (pClient == NULL)          if (pClient == NULL)
778          return iMidiDevice;                  return -1;
779      if (pszMidiDriver == NULL)          if (pszMidiDriver == NULL)
780          return iMidiDevice;                  return -1;
781    
782      // Lock this section up.          // Lock this section up.
783      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
784    
785      sprintf(szQuery, "CREATE MIDI_INPUT_DEVICE %s", pszMidiDriver);          sprintf(szQuery, "CREATE MIDI_INPUT_DEVICE %s", pszMidiDriver);
786      lscp_param_concat(szQuery, sizeof(szQuery), pParams);          lscp_param_concat(szQuery, sizeof(szQuery), pParams);
787      if (lscp_client_call(pClient, szQuery) == LSCP_OK)          if (lscp_client_call(pClient, szQuery, 0) == LSCP_OK)
788          iMidiDevice = atoi(lscp_client_get_result(pClient));                  iMidiDevice = atoi(lscp_client_get_result(pClient));
789    
790      // Unlock this section down.          // Unlock this section down.
791      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
792    
793      return iMidiDevice;          return iMidiDevice;
794  }  }
795    
796    
# Line 790  int lscp_create_midi_device ( lscp_clien Line 805  int lscp_create_midi_device ( lscp_clien
805   */   */
806  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 )
807  {  {
808      lscp_status_t ret = LSCP_FAILED;          lscp_status_t ret = LSCP_FAILED;
809      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
810    
811      if (pClient == NULL)          if (pClient == NULL)
812          return ret;                  return ret;
813      if (iMidiDevice < 0)          if (iMidiDevice < 0)
814          return ret;                  return ret;
815    
816      sprintf(szQuery, "DESTROY MIDI_INPUT_DEVICE %d\r\n", iMidiDevice);          sprintf(szQuery, "DESTROY MIDI_INPUT_DEVICE %d\r\n", iMidiDevice);
817      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
818  }  }
819    
820    
# Line 814  lscp_status_t lscp_destroy_midi_device ( Line 829  lscp_status_t lscp_destroy_midi_device (
829   */   */
830  int lscp_get_midi_devices ( lscp_client_t *pClient )  int lscp_get_midi_devices ( lscp_client_t *pClient )
831  {  {
832      int iMidiDevices = -1;          int iMidiDevices = -1;
833    
834            if (pClient == NULL)
835                    return -1;
836    
837      // Lock this section up.          // Lock this section up.
838      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
839    
840      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)
841          iMidiDevices = atoi(lscp_client_get_result(pClient));                  iMidiDevices = atoi(lscp_client_get_result(pClient));
842                            
843      // Unlock this section down.          // Unlock this section down.
844      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
845    
846      return iMidiDevices;          return iMidiDevices;
847  }  }
848    
849    
# Line 840  int lscp_get_midi_devices ( lscp_client_ Line 858  int lscp_get_midi_devices ( lscp_client_
858   */   */
859  int *lscp_list_midi_devices ( lscp_client_t *pClient )  int *lscp_list_midi_devices ( lscp_client_t *pClient )
860  {  {
861      const char *pszSeps = ",";          const char *pszSeps = ",";
862    
863      if (pClient == NULL)          if (pClient == NULL)
864          return NULL;                  return NULL;
865    
866      // Lock this section up.          // Lock this section up.
867      lscp_mutex_lock(pClient->mutex);          lscp_mutex_lock(pClient->mutex);
868    
869      if (pClient->midi_devices) {          if (pClient->midi_devices) {
870          lscp_isplit_destroy(pClient->midi_devices);                  lscp_isplit_destroy(pClient->midi_devices);
871          pClient->midi_devices = NULL;                  pClient->midi_devices = NULL;
872      }          }
873    
874      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)
875          pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);                  pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps);
876    
877      // Unlock this section down.          // Unlock this section down.
878      lscp_mutex_unlock(pClient->mutex);          lscp_mutex_unlock(pClient->mutex);
879    
880      return pClient->midi_devices;          return pClient->midi_devices;
881  }  }
882    
883    
# Line 875  int *lscp_list_midi_devices ( lscp_clien Line 893  int *lscp_list_midi_devices ( lscp_clien
893   */   */
894  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 )
895  {  {
896      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
897    
898      if (pClient == NULL)          if (pClient == NULL)
899          return NULL;                  return NULL;
900      if (iMidiDevice < 0)          if (iMidiDevice < 0)
901          return NULL;                  return NULL;
902    
903      sprintf(szQuery, "GET MIDI_INPUT_DEVICE INFO %d\r\n", iMidiDevice);          sprintf(szQuery, "GET MIDI_INPUT_DEVICE INFO %d\r\n", iMidiDevice);
904      return _lscp_device_info_query(pClient, &(pClient->midi_device_info), szQuery);          return _lscp_device_info_query(pClient, &(pClient->midi_device_info), szQuery);
905  }  }
906    
907    
# Line 899  lscp_device_info_t* lscp_get_midi_device Line 917  lscp_device_info_t* lscp_get_midi_device
917   */   */
918  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 )
919  {  {
920      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
921    
922      if (pClient == NULL)          if (pClient == NULL)
923          return LSCP_FAILED;                  return LSCP_FAILED;
924      if (iMidiDevice < 0)          if (iMidiDevice < 0)
925          return LSCP_FAILED;                  return LSCP_FAILED;
926      if (pParam == NULL)          if (pParam == NULL)
927          return LSCP_FAILED;                  return LSCP_FAILED;
928    
929      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);
930      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
931  }  }
932    
933    
# Line 926  lscp_status_t lscp_set_midi_device_param Line 944  lscp_status_t lscp_set_midi_device_param
944   */   */
945  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 )
946  {  {
947      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
948    
949      if (pClient == NULL)          if (pClient == NULL)
950          return NULL;                  return NULL;
951      if (iMidiDevice < 0)          if (iMidiDevice < 0)
952          return NULL;                  return NULL;
953      if (iMidiPort < 0)          if (iMidiPort < 0)
954          return NULL;                  return NULL;
955    
956      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);
957      return _lscp_device_port_info_query(pClient, &(pClient->midi_port_info), szQuery);          return _lscp_device_port_info_query(pClient, &(pClient->midi_port_info), szQuery);
958  }  }
959    
960    
# Line 954  lscp_device_port_info_t* lscp_get_midi_p Line 972  lscp_device_port_info_t* lscp_get_midi_p
972   */   */
973  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 )
974  {  {
975      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
976    
977      if (pClient == NULL)          if (pClient == NULL)
978          return NULL;                  return NULL;
979      if (iMidiDevice < 0)          if (iMidiDevice < 0)
980          return NULL;                  return NULL;
981      if (iMidiPort < 0)          if (iMidiPort < 0)
982          return NULL;                  return NULL;
983      if (pszParam == NULL)          if (pszParam == NULL)
984          return NULL;                  return NULL;
985    
986      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);
987      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);
988  }  }
989    
990    
# Line 983  lscp_param_info_t* lscp_get_midi_port_pa Line 1001  lscp_param_info_t* lscp_get_midi_port_pa
1001   */   */
1002  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 )
1003  {  {
1004      char szQuery[LSCP_BUFSIZ];          char szQuery[LSCP_BUFSIZ];
1005    
1006      if (pClient == NULL)          if (pClient == NULL)
1007          return LSCP_FAILED;                  return LSCP_FAILED;
1008      if (iMidiDevice < 0)          if (iMidiDevice < 0)
1009          return LSCP_FAILED;                  return LSCP_FAILED;
1010      if (iMidiPort < 0)          if (iMidiPort < 0)
1011          return LSCP_FAILED;                  return LSCP_FAILED;
1012      if (pParam == NULL)          if (pParam == NULL)
1013          return LSCP_FAILED;                  return LSCP_FAILED;
1014    
1015      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);
1016      return lscp_client_query(pClient, szQuery);          return lscp_client_query(pClient, szQuery);
1017  }  }
1018    
1019    
# Line 1004  lscp_status_t lscp_set_midi_port_param ( Line 1022  lscp_status_t lscp_set_midi_port_param (
1022    
1023  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 )
1024  {  {
1025      int i;          int i;
1026    
1027      for (i = 0; pParams && pParams[i].key; i++) {          for (i = 0; pParams && pParams[i].key; i++) {
1028          if (strcasecmp(pParams[i].key, pszParam) == 0)                  if (strcasecmp(pParams[i].key, pszParam) == 0)
1029              return (const char *) pParams[i].value;                          return (const char *) pParams[i].value;
1030      }          }
1031      return NULL;          return NULL;
1032  }  }
1033    
1034    

Legend:
Removed from v.869  
changed lines
  Added in v.975

  ViewVC Help
Powered by ViewVC