/[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 965 by capela, Mon Dec 4 23:56:27 2006 UTC revision 3663 by schoenebeck, Sun Dec 22 12:41:28 2019 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-2007, 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    
28    
29  // Split chunk size magic:  // Split chunk size magic:
# Line 754  lscp_midi_instrument_t *lscp_midi_instru Line 755  lscp_midi_instrument_t *lscp_midi_instru
755                  case '{':                  case '{':
756                          pchHead = pch + 1;                          pchHead = pch + 1;
757                          if (k == 0) {                          if (k == 0) {
758                                  pInstrs[i].bank_msb = atoi(pchHead);                                  pInstrs[i].map = atoi(pchHead);
759                                  k++;                                  k++;
760                          }                          }
761                          break;                          break;
762                  case ',':                  case ',':
763                          pchHead = pch + 1;                          pchHead = pch + 1;
764                          if (k == 1) {                          if (k == 1) {
765                                  pInstrs[i].bank_lsb = atoi(pchHead);                                  pInstrs[i].bank = atoi(pchHead);
766                                  k++;                                  k++;
767                          }                          }
768                          else                          else
769                          if (k == 2) {                          if (k == 2) {
770                                  pInstrs[i].program = atoi(pchHead);                                  pInstrs[i].prog = atoi(pchHead);
771                                  k++;                                  k++;
772                          }                          }
773                          break;                          break;
# Line 783  lscp_midi_instrument_t *lscp_midi_instru Line 784  lscp_midi_instrument_t *lscp_midi_instru
784                          pNewInstrs = (lscp_midi_instrument_t *) malloc(iSize * sizeof(lscp_midi_instrument_t));                          pNewInstrs = (lscp_midi_instrument_t *) malloc(iSize * sizeof(lscp_midi_instrument_t));
785                          if (pNewInstrs) {                          if (pNewInstrs) {
786                                  for (j = 0; j < i; j++) {                                  for (j = 0; j < i; j++) {
787                                          pNewInstrs[j].bank_msb = pInstrs[j].bank_msb;                                          pNewInstrs[j].map  = pInstrs[j].map;
788                                          pNewInstrs[j].bank_lsb = pInstrs[j].bank_lsb;                                          pNewInstrs[j].bank = pInstrs[j].bank;
789                                          pNewInstrs[j].program  = pInstrs[j].program;                                          pNewInstrs[j].prog = pInstrs[j].prog;
790                                  }                                  }
791                                  free(pInstrs);                                  free(pInstrs);
792                                  pInstrs = pNewInstrs;                                  pInstrs = pNewInstrs;
# Line 795  lscp_midi_instrument_t *lscp_midi_instru Line 796  lscp_midi_instrument_t *lscp_midi_instru
796                    
797          // Special terminate split array.          // Special terminate split array.
798          for ( ; i < iSize; i++) {          for ( ; i < iSize; i++) {
799                  pInstrs[i].bank_msb = -1;                  pInstrs[i].map  = -1;
800                  pInstrs[i].bank_lsb = -1;                  pInstrs[i].bank = -1;
801                  pInstrs[i].program  = -1;                  pInstrs[i].prog = -1;
802          }          }
803                    
804          return pInstrs;          return pInstrs;
# Line 835  int lscp_midi_instruments_size ( lscp_mi Line 836  int lscp_midi_instruments_size ( lscp_mi
836    
837  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )  void lscp_server_info_init ( lscp_server_info_t *pServerInfo )
838  {  {
839          pServerInfo->description = NULL;          pServerInfo->description      = NULL;
840          pServerInfo->version     = NULL;          pServerInfo->version          = NULL;
841            pServerInfo->protocol_version = NULL;
842  }  }
843    
844  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 847  void lscp_server_info_free ( lscp_server
847                  free(pServerInfo->description);                  free(pServerInfo->description);
848          if (pServerInfo->version)          if (pServerInfo->version)
849                  free(pServerInfo->version);                  free(pServerInfo->version);
850            if (pServerInfo->protocol_version)
851                    free(pServerInfo->protocol_version);
852  }  }
853    
854  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )  void lscp_server_info_reset ( lscp_server_info_t *pServerInfo )
# Line 894  void lscp_channel_info_init ( lscp_chann Line 898  void lscp_channel_info_init ( lscp_chann
898          pChannelInfo->midi_device       = 0;          pChannelInfo->midi_device       = 0;
899          pChannelInfo->midi_port         = 0;          pChannelInfo->midi_port         = 0;
900          pChannelInfo->midi_channel      = 0;          pChannelInfo->midi_channel      = 0;
901            pChannelInfo->midi_map          = 0;
902          pChannelInfo->volume            = 0.0;          pChannelInfo->volume            = 0.0;
903          pChannelInfo->mute              = 0;          pChannelInfo->mute              = 0;
904          pChannelInfo->solo              = 0;          pChannelInfo->solo              = 0;
# Line 904  void lscp_channel_info_free ( lscp_chann Line 909  void lscp_channel_info_free ( lscp_chann
909          if (pChannelInfo->engine_name)          if (pChannelInfo->engine_name)
910                  free(pChannelInfo->engine_name);                  free(pChannelInfo->engine_name);
911          if (pChannelInfo->audio_routing)          if (pChannelInfo->audio_routing)
912                  lscp_szsplit_destroy(pChannelInfo->audio_routing);                  lscp_isplit_destroy(pChannelInfo->audio_routing);
913          if (pChannelInfo->instrument_file)          if (pChannelInfo->instrument_file)
914                  free(pChannelInfo->instrument_file);                  free(pChannelInfo->instrument_file);
915          if (pChannelInfo->instrument_name)          if (pChannelInfo->instrument_name)
# Line 1058  int lscp_param_concat ( char *pszBuffer, Line 1063  int lscp_param_concat ( char *pszBuffer,
1063  }  }
1064    
1065    
1066    //-------------------------------------------------------------------------
1067    // Effect struct helper functions.
1068    
1069    void lscp_fxsend_info_init ( lscp_fxsend_info_t *pFxSendInfo )
1070    {
1071            pFxSendInfo->name            = NULL;
1072            pFxSendInfo->midi_controller = 0;
1073            pFxSendInfo->audio_routing   = NULL;
1074            pFxSendInfo->level           = 0.0f;
1075    }
1076    
1077    void lscp_fxsend_info_free ( lscp_fxsend_info_t *pFxSendInfo )
1078    {
1079            if (pFxSendInfo->name)
1080                    free(pFxSendInfo->name);
1081            if (pFxSendInfo->audio_routing)
1082                    lscp_isplit_destroy(pFxSendInfo->audio_routing);
1083    }
1084    
1085    void lscp_fxsend_info_reset (lscp_fxsend_info_t *pFxSendInfo )
1086    {
1087            lscp_fxsend_info_free(pFxSendInfo);
1088            lscp_fxsend_info_init(pFxSendInfo);
1089    }
1090    
1091    
1092  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
1093  // MIDI instrument info struct helper functions.  // MIDI instrument info struct helper functions.
1094    

Legend:
Removed from v.965  
changed lines
  Added in v.3663

  ViewVC Help
Powered by ViewVC