- updated
git-svn-id: http://moon:8086/svn/software/trunk/projects/mpsk_rx_gui@117 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -50,6 +50,11 @@ void SynthesiserVoice::setCurrentPlaybackSampleRate (const double newRate)
|
||||
currentSampleRate = newRate;
|
||||
}
|
||||
|
||||
bool SynthesiserVoice::isVoiceActive() const
|
||||
{
|
||||
return getCurrentlyPlayingNote() >= 0;
|
||||
}
|
||||
|
||||
void SynthesiserVoice::clearCurrentNote()
|
||||
{
|
||||
currentlyPlayingNote = -1;
|
||||
@@ -426,7 +431,7 @@ SynthesiserVoice* Synthesiser::findFreeVoice (SynthesiserSound* soundToPlay,
|
||||
{
|
||||
SynthesiserVoice* const voice = voices.getUnchecked (i);
|
||||
|
||||
if (voice->getCurrentlyPlayingNote() < 0 && voice->canPlaySound (soundToPlay))
|
||||
if ((! voice->isVoiceActive()) && voice->canPlaySound (soundToPlay))
|
||||
return voice;
|
||||
}
|
||||
|
||||
|
||||
@@ -140,6 +140,12 @@ public:
|
||||
*/
|
||||
virtual void stopNote (float velocity, bool allowTailOff) = 0;
|
||||
|
||||
/** Returns true if this voice is currently busy playing a sound.
|
||||
By default this just checks the getCurrentlyPlayingNote() value, but can
|
||||
be overridden for more advanced checking.
|
||||
*/
|
||||
virtual bool isVoiceActive() const;
|
||||
|
||||
/** Called to let the voice know that the pitch wheel has been moved.
|
||||
This will be called during the rendering callback, so must be fast and thread-safe.
|
||||
*/
|
||||
@@ -185,17 +191,17 @@ public:
|
||||
*/
|
||||
virtual void setCurrentPlaybackSampleRate (double newRate);
|
||||
|
||||
/** Returns the current target sample rate at which rendering is being done.
|
||||
Subclasses may need to know this so that they can pitch things correctly.
|
||||
*/
|
||||
double getSampleRate() const noexcept { return currentSampleRate; }
|
||||
|
||||
/** Returns true if the voice is currently playing a sound which is mapped to the given
|
||||
midi channel.
|
||||
|
||||
If it's not currently playing, this will return false.
|
||||
*/
|
||||
bool isPlayingChannel (int midiChannel) const;
|
||||
virtual bool isPlayingChannel (int midiChannel) const;
|
||||
|
||||
/** Returns the current target sample rate at which rendering is being done.
|
||||
Subclasses may need to know this so that they can pitch things correctly.
|
||||
*/
|
||||
double getSampleRate() const noexcept { return currentSampleRate; }
|
||||
|
||||
/** Returns true if the key that triggered this voice is still held down.
|
||||
Note that the voice may still be playing after the key was released (e.g because the
|
||||
|
||||
Reference in New Issue
Block a user