--- linuxsampler/trunk/src/engines/gig/Engine.cpp 2007/02/03 20:46:44 1039 +++ linuxsampler/trunk/src/engines/gig/Engine.cpp 2007/02/07 17:45:19 1041 @@ -709,6 +709,9 @@ if (!pEngineChannel->pInstrument) return; // ignore if no instrument loaded + //HACK: we should better add the transpose value only to the most mandatory places (like for retrieving the region and calculating the tuning), because otherwise voices will unintendedly survive when changing transpose while playing + itNoteOnEvent->Param.Note.Key += pEngineChannel->GlobalTranspose; + const int key = itNoteOnEvent->Param.Note.Key; midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[key]; @@ -796,6 +799,9 @@ if (pEngineChannel->GetMute()) return; // skip if sampler channel is muted #endif + //HACK: we should better add the transpose value only to the most mandatory places (like for retrieving the region and calculating the tuning), because otherwise voices will unintendedly survive when changing transpose while playing + itNoteOffEvent->Param.Note.Key += pEngineChannel->GlobalTranspose; + const int iKey = itNoteOffEvent->Param.Note.Key; midi_key_info_t* pKey = &pEngineChannel->pMIDIKeyInfo[iKey]; pKey->KeyPressed = false; // the MIDI key was now released @@ -1356,6 +1362,16 @@ pEngineChannel->PortamentoTime = (float) itControlChangeEvent->Param.CC.Value / 127.0f * (float) CONFIG_PORTAMENTO_TIME_MAX + (float) CONFIG_PORTAMENTO_TIME_MIN; break; } + case 6: { // data entry (currently only used for RPN controllers) + if (pEngineChannel->GetMidiRpnController() == 2) { // coarse tuning in half tones + int transpose = (int) itControlChangeEvent->Param.CC.Value - 64; + // limit to +- two octaves for now + transpose = RTMath::Min(transpose, 24); + transpose = RTMath::Max(transpose, -24); + pEngineChannel->GlobalTranspose = transpose; + } + break; + } case 7: { // volume //TODO: not sample accurate yet pEngineChannel->MidiVolume = VolumeCurve[itControlChangeEvent->Param.CC.Value]; @@ -1460,6 +1476,14 @@ } break; } + case 100: { // RPN controller LSB + pEngineChannel->SetMidiRpnControllerLsb(itControlChangeEvent->Param.CC.Value); + break; + } + case 101: { // RPN controller MSB + pEngineChannel->SetMidiRpnControllerMsb(itControlChangeEvent->Param.CC.Value); + break; + } // Channel Mode Messages @@ -1692,7 +1716,7 @@ } String Engine::Version() { - String s = "$Revision: 1.72 $"; + String s = "$Revision: 1.73 $"; return s.substr(11, s.size() - 13); // cut dollar signs, spaces and CVS macro keyword }