27 |
|
|
28 |
namespace LinuxSampler { namespace gig { |
namespace LinuxSampler { namespace gig { |
29 |
|
|
30 |
// FIXME: no support for layers (nor crossfades) yet |
// TODO: no support for crossfades yet |
31 |
|
|
32 |
const float Voice::FILTER_CUTOFF_COEFF(CalculateFilterCutoffCoeff()); |
const float Voice::FILTER_CUTOFF_COEFF(CalculateFilterCutoffCoeff()); |
33 |
|
|
107 |
* @param pNoteOnEvent - event that caused triggering of this voice |
* @param pNoteOnEvent - event that caused triggering of this voice |
108 |
* @param PitchBend - MIDI detune factor (-8192 ... +8191) |
* @param PitchBend - MIDI detune factor (-8192 ... +8191) |
109 |
* @param pInstrument - points to the loaded instrument which provides sample wave(s) and articulation data |
* @param pInstrument - points to the loaded instrument which provides sample wave(s) and articulation data |
110 |
|
* @param iLayer - layer number this voice refers to (only if this is a layered sound of course) |
111 |
* @returns 0 on success, a value < 0 if something failed |
* @returns 0 on success, a value < 0 if something failed |
112 |
*/ |
*/ |
113 |
int Voice::Trigger(Event* pNoteOnEvent, int PitchBend, ::gig::Instrument* pInstrument) { |
int Voice::Trigger(Event* pNoteOnEvent, int PitchBend, ::gig::Instrument* pInstrument, int iLayer) { |
114 |
if (!pInstrument) { |
if (!pInstrument) { |
115 |
dmsg(1,("voice::trigger: !pInstrument\n")); |
dmsg(1,("voice::trigger: !pInstrument\n")); |
116 |
exit(EXIT_FAILURE); |
exit(EXIT_FAILURE); |
139 |
DimValues[i] = 0; //TODO: we currently ignore this dimension |
DimValues[i] = 0; //TODO: we currently ignore this dimension |
140 |
break; |
break; |
141 |
case ::gig::dimension_layer: |
case ::gig::dimension_layer: |
142 |
DimValues[i] = 0; //TODO: we currently ignore this dimension |
DimValues[i] = iLayer; |
143 |
|
// if this is the 1st layer then spawn further voices for all the other layers |
144 |
|
if (iLayer == 0) |
145 |
|
for (int iNewLayer = 1; iNewLayer < pRegion->pDimensionDefinitions[i].zones; iNewLayer++) |
146 |
|
pEngine->LaunchVoice(pNoteOnEvent, iNewLayer); |
147 |
break; |
break; |
148 |
case ::gig::dimension_velocity: |
case ::gig::dimension_velocity: |
149 |
DimValues[i] = pNoteOnEvent->Velocity; |
DimValues[i] = pNoteOnEvent->Velocity; |
273 |
{ |
{ |
274 |
double pitchbasecents = pDimRgn->FineTune * 10; |
double pitchbasecents = pDimRgn->FineTune * 10; |
275 |
if (pDimRgn->PitchTrack) pitchbasecents += (MIDIKey - (int) pDimRgn->UnityNote) * 100; |
if (pDimRgn->PitchTrack) pitchbasecents += (MIDIKey - (int) pDimRgn->UnityNote) * 100; |
276 |
this->PitchBase = RTMath::CentsToFreqRatio(pitchbasecents); |
this->PitchBase = RTMath::CentsToFreqRatio(pitchbasecents) * (double(pSample->SamplesPerSecond) / double(pEngine->pAudioOutputDevice->SampleRate())); |
277 |
this->PitchBend = RTMath::CentsToFreqRatio(((double) PitchBend / 8192.0) * 200.0); // pitchbend wheel +-2 semitones = 200 cents |
this->PitchBend = RTMath::CentsToFreqRatio(((double) PitchBend / 8192.0) * 200.0); // pitchbend wheel +-2 semitones = 200 cents |
278 |
} |
} |
279 |
|
|