/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

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

revision 36 by schoenebeck, Wed Mar 10 21:34:28 2004 UTC revision 231 by schoenebeck, Sun Sep 5 00:46:28 2004 UTC
# Line 2  Line 2 
2   *                                                                         *   *                                                                         *
3   *   libgig - C++ cross-platform Gigasampler format file loader library    *   *   libgig - C++ cross-platform Gigasampler format file loader library    *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003 by Christian Schoenebeck                           *   *   Copyright (C) 2003, 2004 by Christian Schoenebeck                     *
6   *                         <cuse@users.sourceforge.net>                    *   *                               <cuse@users.sourceforge.net>              *
7   *                                                                         *   *                                                                         *
8   *   This library is free software; you can redistribute it and/or modify  *   *   This library is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 841  namespace gig { Line 841  namespace gig {
841                  case curve_type_nonlinear:                  case curve_type_nonlinear:
842                      for (int velocity = 0; velocity < 128; velocity++) {                      for (int velocity = 0; velocity < 128; velocity++) {
843                          pVelocityAttenuationTable[velocity] =                          pVelocityAttenuationTable[velocity] =
844                              GIG_VELOCITY_TRANSFORM_NONLINEAR((double)(velocity+1),(double)(VelocityResponseDepth+1),(double)VelocityResponseCurveScaling);                              GIG_VELOCITY_TRANSFORM_NONLINEAR(((double)velocity),((double)VelocityResponseDepth),((double)VelocityResponseCurveScaling));
845                          if      (pVelocityAttenuationTable[velocity] > 1.0) pVelocityAttenuationTable[velocity] = 1.0;                          if      (pVelocityAttenuationTable[velocity] > 1.0)   pVelocityAttenuationTable[velocity] = 1.0;
846                          else if (pVelocityAttenuationTable[velocity] < 0.0) pVelocityAttenuationTable[velocity] = 0.0;                          else if (pVelocityAttenuationTable[velocity] < 1e-15) pVelocityAttenuationTable[velocity] = 0.0;
847                       }                       }
848                       break;                       break;
849                  case curve_type_linear:                  case curve_type_linear:
850                      for (int velocity = 0; velocity < 128; velocity++) {                      for (int velocity = 0; velocity < 128; velocity++) {
851                          pVelocityAttenuationTable[velocity] =                          pVelocityAttenuationTable[velocity] =
852                              GIG_VELOCITY_TRANSFORM_LINEAR((double)velocity,(double)(VelocityResponseDepth+1),(double)VelocityResponseCurveScaling);                              GIG_VELOCITY_TRANSFORM_LINEAR(((double)velocity),((double)VelocityResponseDepth),((double)VelocityResponseCurveScaling));
853                          if      (pVelocityAttenuationTable[velocity] > 1.0) pVelocityAttenuationTable[velocity] = 1.0;                          if      (pVelocityAttenuationTable[velocity] > 1.0)   pVelocityAttenuationTable[velocity] = 1.0;
854                          else if (pVelocityAttenuationTable[velocity] < 0.0) pVelocityAttenuationTable[velocity] = 0.0;                          else if (pVelocityAttenuationTable[velocity] < 1e-15) pVelocityAttenuationTable[velocity] = 0.0;
855                      }                      }
856                      break;                      break;
857                  case curve_type_special:                  case curve_type_special:
858                      for (int velocity = 0; velocity < 128; velocity++) {                      for (int velocity = 0; velocity < 128; velocity++) {
859                          pVelocityAttenuationTable[velocity] =                          pVelocityAttenuationTable[velocity] =
860                              GIG_VELOCITY_TRANSFORM_SPECIAL((double)(velocity+1),(double)(VelocityResponseDepth+1),(double)VelocityResponseCurveScaling);                              GIG_VELOCITY_TRANSFORM_SPECIAL(((double)velocity),((double)VelocityResponseDepth),((double)VelocityResponseCurveScaling));
861                          if      (pVelocityAttenuationTable[velocity] > 1.0) pVelocityAttenuationTable[velocity] = 1.0;                          if      (pVelocityAttenuationTable[velocity] > 1.0)   pVelocityAttenuationTable[velocity] = 1.0;
862                          else if (pVelocityAttenuationTable[velocity] < 0.0) pVelocityAttenuationTable[velocity] = 0.0;                          else if (pVelocityAttenuationTable[velocity] < 1e-15) pVelocityAttenuationTable[velocity] = 0.0;
863                      }                      }
864                      break;                      break;
865                  case curve_type_unknown:                  case curve_type_unknown:
# Line 869  namespace gig { Line 869  namespace gig {
869              (*pVelocityTables)[tableKey] = pVelocityAttenuationTable; // put the new table into the tables map              (*pVelocityTables)[tableKey] = pVelocityAttenuationTable; // put the new table into the tables map
870          }          }
871      }      }
872        
873      leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) {      leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) {
874          leverage_ctrl_t decodedcontroller;          leverage_ctrl_t decodedcontroller;
875          switch (EncodedController) {          switch (EncodedController) {
# Line 886  namespace gig { Line 886  namespace gig {
886                  decodedcontroller.type = leverage_ctrl_t::type_channelaftertouch;                  decodedcontroller.type = leverage_ctrl_t::type_channelaftertouch;
887                  decodedcontroller.controller_number = 0;                  decodedcontroller.controller_number = 0;
888                  break;                  break;
889                
890              // ordinary MIDI control change controller              // ordinary MIDI control change controller
891              case _lev_ctrl_modwheel:              case _lev_ctrl_modwheel:
892                  decodedcontroller.type = leverage_ctrl_t::type_controlchange;                  decodedcontroller.type = leverage_ctrl_t::type_controlchange;
# Line 980  namespace gig { Line 980  namespace gig {
980                  decodedcontroller.type = leverage_ctrl_t::type_controlchange;                  decodedcontroller.type = leverage_ctrl_t::type_controlchange;
981                  decodedcontroller.controller_number = 95;                  decodedcontroller.controller_number = 95;
982                  break;                  break;
983                
984              // unknown controller type              // unknown controller type
985              default:              default:
986                  throw gig::Exception("Unknown leverage controller type.");                  throw gig::Exception("Unknown leverage controller type.");

Legend:
Removed from v.36  
changed lines
  Added in v.231

  ViewVC Help
Powered by ViewVC