/[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 518 by schoenebeck, Sun May 8 16:19:34 2005 UTC revision 613 by persson, Mon Jun 6 16:50:58 2005 UTC
# Line 1161  namespace { Line 1161  namespace {
1161                  VCFType = vcf_type_lowpassturbo;                  VCFType = vcf_type_lowpassturbo;
1162          }          }
1163    
1164          // get the corresponding velocity->volume table from the table map or create & calculate that table if it doesn't exist yet          pVelocityAttenuationTable = GetVelocityTable(VelocityResponseCurve,
1165          uint32_t tableKey = (VelocityResponseCurve<<16) | (VelocityResponseDepth<<8) | VelocityResponseCurveScaling;                                                       VelocityResponseDepth,
1166                                                         VelocityResponseCurveScaling);
1167    
1168            curve_type_t curveType = ReleaseVelocityResponseCurve;
1169            uint8_t depth = ReleaseVelocityResponseDepth;
1170    
1171            // this models a strange behaviour or bug in GSt: two of the
1172            // velocity response curves for release time are not used even
1173            // if specified, instead another curve is chosen.
1174    
1175            if ((curveType == curve_type_nonlinear && depth == 0) ||
1176                (curveType == curve_type_special   && depth == 4)) {
1177                curveType = curve_type_nonlinear;
1178                depth = 3;
1179            }
1180            pVelocityReleaseTable = GetVelocityTable(curveType, depth, 0);
1181    
1182            SampleAttenuation = pow(10.0, -Gain / (20.0 * 655360));
1183        }
1184    
1185        // get the corresponding velocity table from the table map or create & calculate that table if it doesn't exist yet
1186        double* DimensionRegion::GetVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling)
1187        {
1188            double* table;
1189            uint32_t tableKey = (curveType<<16) | (depth<<8) | scaling;
1190          if (pVelocityTables->count(tableKey)) { // if key exists          if (pVelocityTables->count(tableKey)) { // if key exists
1191              pVelocityAttenuationTable = (*pVelocityTables)[tableKey];              table = (*pVelocityTables)[tableKey];
1192          }          }
1193          else {          else {
1194              pVelocityAttenuationTable =              table = CreateVelocityTable(curveType, depth, scaling);
1195                  CreateVelocityTable(VelocityResponseCurve,              (*pVelocityTables)[tableKey] = table; // put the new table into the tables map
                                     VelocityResponseDepth,  
                                     VelocityResponseCurveScaling);  
             (*pVelocityTables)[tableKey] = pVelocityAttenuationTable; // put the new table into the tables map  
1196          }          }
1197            return table;
         SampleAttenuation = pow(10.0, -Gain / (20.0 * 655360));  
1198      }      }
1199    
1200      leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) {      leverage_ctrl_t DimensionRegion::DecodeLeverageController(_lev_ctrl_t EncodedController) {
# Line 1325  namespace { Line 1345  namespace {
1345          return pVelocityAttenuationTable[MIDIKeyVelocity];          return pVelocityAttenuationTable[MIDIKeyVelocity];
1346      }      }
1347    
1348        double DimensionRegion::GetVelocityRelease(uint8_t MIDIKeyVelocity) {
1349            return pVelocityReleaseTable[MIDIKeyVelocity];
1350        }
1351    
1352      double* DimensionRegion::CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling) {      double* DimensionRegion::CreateVelocityTable(curve_type_t curveType, uint8_t depth, uint8_t scaling) {
1353    
1354          // line-segment approximations of the 15 velocity curves          // line-segment approximations of the 15 velocity curves

Legend:
Removed from v.518  
changed lines
  Added in v.613

  ViewVC Help
Powered by ViewVC