diff --git a/docs/JUCE changelist.txt b/docs/JUCE changelist.txt index 94073e3f40..5fde664eaf 100644 --- a/docs/JUCE changelist.txt +++ b/docs/JUCE changelist.txt @@ -8,6 +8,7 @@ Changelist for version 1.46 - new class: AudioProcessorGraph: This allows AudioProcessors to be efficiently wired together and run as a graph. I've converted the plugin host demo to now use this instead of its own graph rendering code. - new class: AudioProcessorPlayer: This allows an audio i/o device to stream through an AudioProcessor (or an AudioProcessorGraph). +- new class QuickTimeAudioFormat, which uses QuickTime to implement an AudioFormat that can read .mov files and other formats that QT supports (e.g. mp3, aac, etc) - AudioProcessor now has a few more pure virtual methods that you'll need to implement: acceptsMidi(), producesMidi() and getName() - moved all the audio plugin hosting classes into the main juce tree - Mac: the project now requires at least XCode V2.5 diff --git a/src/juce_appframework/audio/synthesisers/juce_Synthesiser.cpp b/src/juce_appframework/audio/synthesisers/juce_Synthesiser.cpp index 07908f197a..aa813b9af1 100644 --- a/src/juce_appframework/audio/synthesisers/juce_Synthesiser.cpp +++ b/src/juce_appframework/audio/synthesisers/juce_Synthesiser.cpp @@ -237,25 +237,33 @@ void Synthesiser::noteOn (const int midiChannel, SynthesiserSound* const sound = sounds.getUnchecked(i); if (sound->appliesToNote (midiNoteNumber) - && sound->appliesToChannel (midiChannel)) + && sound->appliesToChannel (midiChannel)) { - SynthesiserVoice* const voice = findFreeVoice (sound, shouldStealNotes); - - if (voice != 0) - { - voice->startNote (midiNoteNumber, - velocity, - sound, - lastPitchWheelValues [midiChannel - 1]); - - voice->currentlyPlayingNote = midiNoteNumber; - voice->noteOnTime = ++lastNoteOnCounter; - voice->currentlyPlayingSound = sound; - } + startVoice (findFreeVoice (sound, shouldStealNotes), + sound, midiChannel, midiNoteNumber, velocity); } } } +void Synthesiser::startVoice (SynthesiserVoice* const voice, + SynthesiserSound* const sound, + const int midiChannel, + const int midiNoteNumber, + const float velocity) +{ + if (voice != 0 && sound != 0) + { + voice->startNote (midiNoteNumber, + velocity, + sound, + lastPitchWheelValues [midiChannel - 1]); + + voice->currentlyPlayingNote = midiNoteNumber; + voice->noteOnTime = ++lastNoteOnCounter; + voice->currentlyPlayingSound = sound; + } +} + void Synthesiser::noteOff (const int midiChannel, const int midiNoteNumber, const bool allowTailOff) diff --git a/src/juce_appframework/audio/synthesisers/juce_Synthesiser.h b/src/juce_appframework/audio/synthesisers/juce_Synthesiser.h index 191b6b4d09..406841b8ea 100644 --- a/src/juce_appframework/audio/synthesisers/juce_Synthesiser.h +++ b/src/juce_appframework/audio/synthesisers/juce_Synthesiser.h @@ -230,6 +230,7 @@ protected: */ void clearCurrentNote(); + private: //============================================================================== friend class Synthesiser; @@ -330,6 +331,11 @@ public: */ void setNoteStealingEnabled (const bool shouldStealNotes); + /** Returns true if note-stealing is enabled. + @see setNoteStealingEnabled + */ + bool isNoteStealingEnabled() const throw() { return shouldStealNotes; } + //============================================================================== /** Triggers a note-on event. @@ -457,6 +463,16 @@ protected: virtual SynthesiserVoice* findFreeVoice (SynthesiserSound* soundToPlay, const bool stealIfNoneAvailable) const; + /** Starts a specified voice playing a particular sound. + + You'll probably never need to call this, it's used internally by noteOn(), but + may be needed by subclasses for custom behaviours. + */ + void startVoice (SynthesiserVoice* const voice, + SynthesiserSound* const sound, + const int midiChannel, + const int midiNoteNumber, + const float velocity); /** xxx Temporary method here to cause a compiler error - note the new parameters for this method. */ int findFreeVoice (const bool) const { return 0; }