mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Updated the Synthesiser classes to store the current midi channel in the voice.
This commit is contained in:
parent
6682e07fe6
commit
7fe33baa20
2 changed files with 8 additions and 6 deletions
|
|
@ -29,6 +29,7 @@ SynthesiserSound::~SynthesiserSound() {}
|
|||
SynthesiserVoice::SynthesiserVoice()
|
||||
: currentSampleRate (44100.0),
|
||||
currentlyPlayingNote (-1),
|
||||
currentPlayingMidiChannel (0),
|
||||
noteOnTime (0),
|
||||
keyIsDown (false),
|
||||
sostenutoPedalDown (false)
|
||||
|
|
@ -41,8 +42,7 @@ SynthesiserVoice::~SynthesiserVoice()
|
|||
|
||||
bool SynthesiserVoice::isPlayingChannel (const int midiChannel) const
|
||||
{
|
||||
return currentlyPlayingSound != nullptr
|
||||
&& currentlyPlayingSound->appliesToChannel (midiChannel);
|
||||
return currentPlayingMidiChannel == midiChannel;
|
||||
}
|
||||
|
||||
void SynthesiserVoice::setCurrentPlaybackSampleRate (const double newRate)
|
||||
|
|
@ -59,6 +59,7 @@ void SynthesiserVoice::clearCurrentNote()
|
|||
{
|
||||
currentlyPlayingNote = -1;
|
||||
currentlyPlayingSound = nullptr;
|
||||
currentPlayingMidiChannel = 0;
|
||||
}
|
||||
|
||||
void SynthesiserVoice::aftertouchChanged (int) {}
|
||||
|
|
@ -258,14 +259,15 @@ void Synthesiser::startVoice (SynthesiserVoice* const voice,
|
|||
if (voice->currentlyPlayingSound != nullptr)
|
||||
voice->stopNote (0.0f, false);
|
||||
|
||||
voice->startNote (midiNoteNumber, velocity, sound,
|
||||
lastPitchWheelValues [midiChannel - 1]);
|
||||
|
||||
voice->currentlyPlayingNote = midiNoteNumber;
|
||||
voice->currentPlayingMidiChannel = midiChannel;
|
||||
voice->noteOnTime = ++lastNoteOnCounter;
|
||||
voice->currentlyPlayingSound = sound;
|
||||
voice->keyIsDown = true;
|
||||
voice->sostenutoPedalDown = false;
|
||||
|
||||
voice->startNote (midiNoteNumber, velocity, sound,
|
||||
lastPitchWheelValues [midiChannel - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ private:
|
|||
friend class Synthesiser;
|
||||
|
||||
double currentSampleRate;
|
||||
int currentlyPlayingNote;
|
||||
int currentlyPlayingNote, currentPlayingMidiChannel;
|
||||
uint32 noteOnTime;
|
||||
SynthesiserSound::Ptr currentlyPlayingSound;
|
||||
bool keyIsDown, sostenutoPedalDown;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue