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

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

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

revision 975 by capela, Sun Dec 17 00:59:40 2006 UTC revision 3842 by capela, Thu Dec 17 08:36:44 2020 UTC
# Line 2  Line 2 
2  //  //
3  /****************************************************************************  /****************************************************************************
4     liblscp - LinuxSampler Control Protocol API     liblscp - LinuxSampler Control Protocol API
5     Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2020, rncbc aka Rui Nuno Capela. All rights reserved.
6    
7     This library is free software; you can redistribute it and/or     This library is free software; you can redistribute it and/or
8     modify it under the terms of the GNU Lesser General Public     modify it under the terms of the GNU Lesser General Public
# Line 23  Line 23 
23  #include "common.h"  #include "common.h"
24    
25  #include <ctype.h>  #include <ctype.h>
26    #include <sys/time.h>
27    #ifdef WIN32
28    # include <errno.h>
29    #else
30    # include <sys/errno.h>
31    #endif
32    
33    
34  // Split chunk size magic:  // Split chunk size magic:
# Line 119  lscp_status_t lscp_client_call ( lscp_cl Line 125  lscp_status_t lscp_client_call ( lscp_cl
125          int    iErrno;          int    iErrno;
126          char  *pszResult;          char  *pszResult;
127          int    cchResult;          int    cchResult;
128            ssize_t sz;
129                    
130          lscp_status_t ret = LSCP_FAILED;          lscp_status_t ret = LSCP_FAILED;
131                    
# Line 155  lscp_status_t lscp_client_call ( lscp_cl Line 162  lscp_status_t lscp_client_call ( lscp_cl
162    
163          // Send data, and then, wait for the result...          // Send data, and then, wait for the result...
164          cchQuery = strlen(pszQuery);          cchQuery = strlen(pszQuery);
165          if (send(pClient->cmd.sock, pszQuery, cchQuery, 0) < cchQuery) {          sz = send(pClient->cmd.sock, pszQuery, cchQuery, 0);
166            if (sz < cchQuery) {
167                  lscp_socket_perror("lscp_client_call: send");                  lscp_socket_perror("lscp_client_call: send");
168                  pszResult = "Failure during send operation";                  pszResult = "Failure during send operation";
169                    if (sz < 0)
170                            iErrno = -errno;
171                  lscp_client_set_result(pClient, pszResult, iErrno);                  lscp_client_set_result(pClient, pszResult, iErrno);
172                  return ret;                  return ret;
173          }          }
# Line 835  int lscp_midi_instruments_size ( lscp_mi Line 845  int lscp_midi_instruments_size ( lscp_mi
845    
846  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )
847  {  {
848          pServerInfo->description = NULL;          pServerInfo->description      = NULL;
849          pServerInfo->version     = NULL;          pServerInfo->version          = NULL;
850            pServerInfo->protocol_version = NULL;
851  }  }
852    
853  void lscp_server_info_free ( lscp_server_info_t *pServerInfo )  void lscp_server_info_free ( lscp_server_info_t *pServerInfo )
# Line 845  void lscp_server_info_free ( lscp_server Line 856  void lscp_server_info_free ( lscp_server
856                  free(pServerInfo->description);                  free(pServerInfo->description);
857          if (pServerInfo->version)          if (pServerInfo->version)
858                  free(pServerInfo->version);                  free(pServerInfo->version);
859            if (pServerInfo->protocol_version)
860                    free(pServerInfo->protocol_version);
861  }  }
862    
863  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )
# Line 905  void lscp_channel_info_free ( lscp_chann Line 918  void lscp_channel_info_free ( lscp_chann
918          if (pChannelInfo->engine_name)          if (pChannelInfo->engine_name)
919                  free(pChannelInfo->engine_name);                  free(pChannelInfo->engine_name);
920          if (pChannelInfo->audio_routing)          if (pChannelInfo->audio_routing)
921                  lscp_szsplit_destroy(pChannelInfo->audio_routing);                  lscp_isplit_destroy(pChannelInfo->audio_routing);
922          if (pChannelInfo->instrument_file)          if (pChannelInfo->instrument_file)
923                  free(pChannelInfo->instrument_file);                  free(pChannelInfo->instrument_file);
924          if (pChannelInfo->instrument_name)          if (pChannelInfo->instrument_name)
# Line 1059  int lscp_param_concat ( char *pszBuffer, Line 1072  int lscp_param_concat ( char *pszBuffer,
1072  }  }
1073    
1074    
1075    //-------------------------------------------------------------------------
1076    // Effect struct helper functions.
1077    
1078    void lscp_fxsend_info_init ( lscp_fxsend_info_t *pFxSendInfo )
1079    {
1080            pFxSendInfo->name            = NULL;
1081            pFxSendInfo->midi_controller = 0;
1082            pFxSendInfo->audio_routing   = NULL;
1083            pFxSendInfo->level           = 0.0f;
1084    }
1085    
1086    void lscp_fxsend_info_free ( lscp_fxsend_info_t *pFxSendInfo )
1087    {
1088            if (pFxSendInfo->name)
1089                    free(pFxSendInfo->name);
1090            if (pFxSendInfo->audio_routing)
1091                    lscp_isplit_destroy(pFxSendInfo->audio_routing);
1092    }
1093    
1094    void lscp_fxsend_info_reset (lscp_fxsend_info_t *pFxSendInfo )
1095    {
1096            lscp_fxsend_info_free(pFxSendInfo);
1097            lscp_fxsend_info_init(pFxSendInfo);
1098    }
1099    
1100    
1101  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1102  // MIDI instrument info struct helper functions.  // MIDI instrument info struct helper functions.
1103    

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

  ViewVC Help
Powered by ViewVC