| @@ -98,7 +98,7 @@ class AudioInputDeviceFilter : public InternalFilterBase | |||||
| public: | public: | ||||
| AudioInputDeviceFilter (const int numChannels) | AudioInputDeviceFilter (const int numChannels) | ||||
| { | { | ||||
| numOutputChannels = numChannels; | |||||
| setPlayConfigDetails (0, numChannels, getSampleRate(), getBlockSize()); | |||||
| } | } | ||||
| ~AudioInputDeviceFilter() {} | ~AudioInputDeviceFilter() {} | ||||
| @@ -115,7 +115,7 @@ public: | |||||
| AudioIODevice* const dev = getAudioDevice(); | AudioIODevice* const dev = getAudioDevice(); | ||||
| if (dev != 0) | if (dev != 0) | ||||
| numOutputChannels = dev->getActiveInputChannels().countNumberOfSetBits(); | |||||
| setPlayConfigDetails (0, dev->getActiveInputChannels().countNumberOfSetBits(), getSampleRate(), getBlockSize()); | |||||
| } | } | ||||
| void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | ||||
| @@ -178,7 +178,7 @@ class AudioOutputDeviceFilter : public InternalFilterBase | |||||
| public: | public: | ||||
| AudioOutputDeviceFilter (const int numChannels) | AudioOutputDeviceFilter (const int numChannels) | ||||
| { | { | ||||
| numInputChannels = numChannels; | |||||
| setPlayConfigDetails (numChannels, 0, getSampleRate(), getBlockSize()); | |||||
| } | } | ||||
| ~AudioOutputDeviceFilter() {} | ~AudioOutputDeviceFilter() {} | ||||
| @@ -195,7 +195,7 @@ public: | |||||
| AudioIODevice* const dev = getAudioDevice(); | AudioIODevice* const dev = getAudioDevice(); | ||||
| if (dev != 0) | if (dev != 0) | ||||
| numInputChannels = dev->getActiveOutputChannels().countNumberOfSetBits(); | |||||
| setPlayConfigDetails (dev->getActiveOutputChannels().countNumberOfSetBits(), 0, getSampleRate(), getBlockSize()); | |||||
| } | } | ||||
| void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | ||||
| @@ -44,7 +44,7 @@ AudioPluginInstance::AudioPluginInstance() | |||||
| { | { | ||||
| internalAsyncUpdater = new InternalAsyncUpdater (*this); | internalAsyncUpdater = new InternalAsyncUpdater (*this); | ||||
| initialiseInternal (this); | |||||
| setHostCallbacks (this); | |||||
| } | } | ||||
| AudioPluginInstance::~AudioPluginInstance() | AudioPluginInstance::~AudioPluginInstance() | ||||
| @@ -127,7 +127,7 @@ void JUCE_CALLTYPE AudioPluginInstance::informHostOfParameterChange (int index, | |||||
| queueChangeMessage (index); | queueChangeMessage (index); | ||||
| } | } | ||||
| void JUCE_CALLTYPE AudioPluginInstance::updateHostDisplay() | |||||
| void JUCE_CALLTYPE AudioPluginInstance::informHostOfStateChange() | |||||
| { | { | ||||
| queueChangeMessage (-1); | queueChangeMessage (-1); | ||||
| } | } | ||||
| @@ -67,7 +67,7 @@ public: | |||||
| @see AudioFilterBase, AudioPluginFormat | @see AudioFilterBase, AudioPluginFormat | ||||
| */ | */ | ||||
| class AudioPluginInstance : public AudioFilterBase, | class AudioPluginInstance : public AudioFilterBase, | ||||
| private AudioFilterBase::FilterNativeCallbacks | |||||
| private AudioFilterBase::HostCallbacks | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -168,7 +168,7 @@ protected: | |||||
| bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | ||||
| void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue); | void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue); | ||||
| void JUCE_CALLTYPE updateHostDisplay(); | |||||
| void JUCE_CALLTYPE informHostOfStateChange(); | |||||
| }; | }; | ||||
| @@ -640,22 +640,22 @@ void VSTPluginInstance::initialise() | |||||
| dispatch (effIdentify, 0, 0, 0, 0); | dispatch (effIdentify, 0, 0, 0, 0); | ||||
| { | { | ||||
| char buffer [kVstMaxEffectNameLen + 8]; | |||||
| char buffer [256]; | |||||
| zerostruct (buffer); | zerostruct (buffer); | ||||
| dispatch (effGetEffectName, 0, 0, buffer, 0); | dispatch (effGetEffectName, 0, 0, buffer, 0); | ||||
| name = String (buffer); | |||||
| if (name.trim().isEmpty()) | |||||
| name = String (buffer).trim(); | |||||
| if (name.isEmpty()) | |||||
| name = module->pluginName; | name = module->pluginName; | ||||
| } | } | ||||
| dispatch (effSetSampleRate, 0, 0, 0, (float) sampleRate); | |||||
| dispatch (effSetBlockSize, 0, jmax (16, blockSize), 0, 0); | |||||
| dispatch (effSetSampleRate, 0, 0, 0, (float) getSampleRate()); | |||||
| dispatch (effSetBlockSize, 0, jmax (32, getBlockSize()), 0, 0); | |||||
| dispatch (effOpen, 0, 0, 0, 0); | dispatch (effOpen, 0, 0, 0, 0); | ||||
| numOutputChannels = effect->numOutputs; | |||||
| numInputChannels = effect->numInputs; | |||||
| setPlayConfigDetails (effect->numInputs, effect->numOutputs, | |||||
| getSampleRate(), getBlockSize()); | |||||
| if (getNumPrograms() > 1) | if (getNumPrograms() > 1) | ||||
| setCurrentProgram (0); | setCurrentProgram (0); | ||||
| @@ -676,11 +676,13 @@ void VSTPluginInstance::initialise() | |||||
| //============================================================================== | //============================================================================== | ||||
| void JUCE_CALLTYPE VSTPluginInstance::prepareToPlay (double sampleRate_, int samplesPerBlockExpected) | |||||
| void JUCE_CALLTYPE VSTPluginInstance::prepareToPlay (double sampleRate_, | |||||
| int samplesPerBlockExpected) | |||||
| { | { | ||||
| sampleRate = sampleRate_; | |||||
| blockSize = samplesPerBlockExpected; | |||||
| midiCollector.reset (sampleRate); | |||||
| setPlayConfigDetails (effect->numInputs, effect->numOutputs, | |||||
| sampleRate_, samplesPerBlockExpected); | |||||
| midiCollector.reset (sampleRate_); | |||||
| juce_free (channels); | juce_free (channels); | ||||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (16, getNumOutputChannels() + 2, getNumInputChannels() + 2)); | channels = (float**) juce_calloc (sizeof (float*) * jmax (16, getNumOutputChannels() + 2, getNumInputChannels() + 2)); | ||||
| @@ -688,7 +690,7 @@ void JUCE_CALLTYPE VSTPluginInstance::prepareToPlay (double sampleRate_, int sam | |||||
| vstHostTime.tempo = 120.0; | vstHostTime.tempo = 120.0; | ||||
| vstHostTime.timeSigNumerator = 4; | vstHostTime.timeSigNumerator = 4; | ||||
| vstHostTime.timeSigDenominator = 4; | vstHostTime.timeSigDenominator = 4; | ||||
| vstHostTime.sampleRate = sampleRate; | |||||
| vstHostTime.sampleRate = sampleRate_; | |||||
| vstHostTime.samplePos = 0; | vstHostTime.samplePos = 0; | ||||
| vstHostTime.flags = kVstNanosValid; /*| kVstTransportPlaying | kVstTempoValid | kVstTimeSigValid*/; | vstHostTime.flags = kVstNanosValid; /*| kVstTransportPlaying | kVstTempoValid | kVstTimeSigValid*/; | ||||
| @@ -706,10 +708,10 @@ void JUCE_CALLTYPE VSTPluginInstance::prepareToPlay (double sampleRate_, int sam | |||||
| incomingMidi.clear(); | incomingMidi.clear(); | ||||
| dispatch (effSetSampleRate, 0, 0, 0, (float) sampleRate); | |||||
| dispatch (effSetBlockSize, 0, jmax (16, blockSize), 0, 0); | |||||
| dispatch (effSetSampleRate, 0, 0, 0, (float) sampleRate_); | |||||
| dispatch (effSetBlockSize, 0, jmax (16, samplesPerBlockExpected), 0, 0); | |||||
| tempBuffer.setSize (effect->numOutputs, blockSize); | |||||
| tempBuffer.setSize (effect->numOutputs, samplesPerBlockExpected); | |||||
| if (! isPowerOn) | if (! isPowerOn) | ||||
| setPower (true); | setPower (true); | ||||
| @@ -734,7 +736,7 @@ void JUCE_CALLTYPE VSTPluginInstance::releaseResources() | |||||
| setPower (false); | setPower (false); | ||||
| } | } | ||||
| midiCollector.reset (sampleRate); | |||||
| midiCollector.reset (getSampleRate()); | |||||
| tempBuffer.setSize (1, 1); | tempBuffer.setSize (1, 1); | ||||
| incomingMidi.clear(); | incomingMidi.clear(); | ||||
| @@ -1274,7 +1276,7 @@ private: | |||||
| checkPluginWindowSize(); | checkPluginWindowSize(); | ||||
| #endif | #endif | ||||
| startTimer (18 + juce::Random::getSystemRandom().nextInt (5)); | |||||
| startTimer (18 + JUCE_NAMESPACE::Random::getSystemRandom().nextInt (5)); | |||||
| repaint(); | repaint(); | ||||
| } | } | ||||
| @@ -1417,8 +1419,7 @@ AudioFilterEditor* JUCE_CALLTYPE VSTPluginInstance::createEditor() | |||||
| void VSTPluginInstance::handleAsyncUpdate() | void VSTPluginInstance::handleAsyncUpdate() | ||||
| { | { | ||||
| // indicates that something about the plugin has changed.. | // indicates that something about the plugin has changed.. | ||||
| if (callbacks != 0) | |||||
| callbacks->updateHostDisplay(); | |||||
| updateHostDisplay(); | |||||
| } | } | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -1547,7 +1548,7 @@ void VSTPluginInstance::setParamsInProgramBlock (fxProgram* const prog) throw() | |||||
| prog->params[i] = swapFloat (getParameter (i)); | prog->params[i] = swapFloat (getParameter (i)); | ||||
| } | } | ||||
| bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int maxSizeMB) | |||||
| bool VSTPluginInstance::saveToFXBFile (JUCE_NAMESPACE::MemoryBlock& dest, bool isFXB, int maxSizeMB) | |||||
| { | { | ||||
| const int numPrograms = getNumPrograms(); | const int numPrograms = getNumPrograms(); | ||||
| const int numParams = getNumParameters(); | const int numParams = getNumParameters(); | ||||
| @@ -1556,7 +1557,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||||
| { | { | ||||
| if (isFXB) | if (isFXB) | ||||
| { | { | ||||
| juce::MemoryBlock chunk; | |||||
| JUCE_NAMESPACE::MemoryBlock chunk; | |||||
| getChunkData (chunk, false, maxSizeMB); | getChunkData (chunk, false, maxSizeMB); | ||||
| const int totalLen = sizeof (fxChunkSet) + chunk.getSize() - 8; | const int totalLen = sizeof (fxChunkSet) + chunk.getSize() - 8; | ||||
| @@ -1576,7 +1577,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||||
| } | } | ||||
| else | else | ||||
| { | { | ||||
| juce::MemoryBlock chunk; | |||||
| JUCE_NAMESPACE::MemoryBlock chunk; | |||||
| getChunkData (chunk, true, maxSizeMB); | getChunkData (chunk, true, maxSizeMB); | ||||
| const int totalLen = sizeof (fxProgramSet) + chunk.getSize() - 8; | const int totalLen = sizeof (fxProgramSet) + chunk.getSize() - 8; | ||||
| @@ -1614,7 +1615,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||||
| set->numPrograms = swap (numPrograms); | set->numPrograms = swap (numPrograms); | ||||
| const int oldProgram = getCurrentProgram(); | const int oldProgram = getCurrentProgram(); | ||||
| juce::MemoryBlock oldSettings; | |||||
| JUCE_NAMESPACE::MemoryBlock oldSettings; | |||||
| createTempParameterStore (oldSettings); | createTempParameterStore (oldSettings); | ||||
| setParamsInProgramBlock ((fxProgram*) (((char*) (set->programs)) + oldProgram * progLen)); | setParamsInProgramBlock ((fxProgram*) (((char*) (set->programs)) + oldProgram * progLen)); | ||||
| @@ -1643,7 +1644,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||||
| return true; | return true; | ||||
| } | } | ||||
| void VSTPluginInstance::getChunkData (juce::MemoryBlock& mb, bool isPreset, int maxSizeMB) const | |||||
| void VSTPluginInstance::getChunkData (JUCE_NAMESPACE::MemoryBlock& mb, bool isPreset, int maxSizeMB) const | |||||
| { | { | ||||
| if (usesChunks()) | if (usesChunks()) | ||||
| { | { | ||||
| @@ -1856,10 +1857,10 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||||
| return 1; | return 1; | ||||
| case audioMasterGetSampleRate: | case audioMasterGetSampleRate: | ||||
| return (VstIntPtr) sampleRate; | |||||
| return (VstIntPtr) getSampleRate(); | |||||
| case audioMasterGetBlockSize: | case audioMasterGetBlockSize: | ||||
| return (VstIntPtr) blockSize; | |||||
| return (VstIntPtr) getBlockSize(); | |||||
| case audioMasterWantMidi: | case audioMasterWantMidi: | ||||
| wantsMidiMessages = true; | wantsMidiMessages = true; | ||||
| @@ -2142,7 +2143,7 @@ bool VSTPluginInstance::isParameterAutomatable (int index) const | |||||
| return false; | return false; | ||||
| } | } | ||||
| void VSTPluginInstance::createTempParameterStore (juce::MemoryBlock& dest) | |||||
| void VSTPluginInstance::createTempParameterStore (JUCE_NAMESPACE::MemoryBlock& dest) | |||||
| { | { | ||||
| dest.setSize (64 + 4 * getNumParameters()); | dest.setSize (64 + 4 * getNumParameters()); | ||||
| dest.fillWith (0); | dest.fillWith (0); | ||||
| @@ -2154,7 +2155,7 @@ void VSTPluginInstance::createTempParameterStore (juce::MemoryBlock& dest) | |||||
| p[i] = getParameter(i); | p[i] = getParameter(i); | ||||
| } | } | ||||
| void VSTPluginInstance::restoreFromTempParameterStore (const juce::MemoryBlock& m) | |||||
| void VSTPluginInstance::restoreFromTempParameterStore (const JUCE_NAMESPACE::MemoryBlock& m) | |||||
| { | { | ||||
| changeProgramName (getCurrentProgram(), (const char*) m); | changeProgramName (getCurrentProgram(), (const char*) m); | ||||
| @@ -2226,7 +2227,7 @@ void VSTPluginInstance::updateStoredProgramNames() | |||||
| if (dispatch (effGetProgramNameIndexed, 0, -1, nm, 0) == 0) | if (dispatch (effGetProgramNameIndexed, 0, -1, nm, 0) == 0) | ||||
| { | { | ||||
| const int oldProgram = getCurrentProgram(); | const int oldProgram = getCurrentProgram(); | ||||
| juce::MemoryBlock oldSettings; | |||||
| JUCE_NAMESPACE::MemoryBlock oldSettings; | |||||
| createTempParameterStore (oldSettings); | createTempParameterStore (oldSettings); | ||||
| for (int i = 0; i < getNumPrograms(); ++i) | for (int i = 0; i < getNumPrograms(); ++i) | ||||
| @@ -2345,11 +2346,6 @@ bool VSTPluginInstance::canMono() const throw() | |||||
| return effect != 0 && (effect->flags & effFlagsCanMono) != 0; | return effect != 0 && (effect->flags & effFlagsCanMono) != 0; | ||||
| } | } | ||||
| bool VSTPluginInstance::canReplace() const throw() | |||||
| { | |||||
| return effect != 0 && (effect->flags & effFlagsCanReplacing) != 0; | |||||
| } | |||||
| bool VSTPluginInstance::isOffline() const throw() | bool VSTPluginInstance::isOffline() const throw() | ||||
| { | { | ||||
| return dispatch (effCanDo, 0, 0, (void*) "offline", 0) > 0; | return dispatch (effCanDo, 0, 0, (void*) "offline", 0) > 0; | ||||
| @@ -172,7 +172,6 @@ private: | |||||
| int getVersionNumber() const throw(); | int getVersionNumber() const throw(); | ||||
| bool hasEditor() const throw(); | bool hasEditor() const throw(); | ||||
| bool canMono() const throw(); | bool canMono() const throw(); | ||||
| bool canReplace() const throw(); | |||||
| bool isOffline() const throw(); | bool isOffline() const throw(); | ||||
| void setPower (const bool on); | void setPower (const bool on); | ||||
| @@ -50,7 +50,7 @@ END_JUCE_NAMESPACE | |||||
| //============================================================================== | //============================================================================== | ||||
| class JuceAU : public AUMIDIEffectBase, | class JuceAU : public AUMIDIEffectBase, | ||||
| public AudioFilterBase::FilterNativeCallbacks | |||||
| public AudioFilterBase::HostCallbacks | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -75,7 +75,7 @@ public: | |||||
| } | } | ||||
| juceFilter = createPluginFilter(); | juceFilter = createPluginFilter(); | ||||
| juceFilter->initialiseInternal (this); | |||||
| juceFilter->setHostCallbacks (this); | |||||
| jassert (juceFilter != 0); | jassert (juceFilter != 0); | ||||
| Globals()->UseIndexedParameters (juceFilter->getNumParameters()); | Globals()->UseIndexedParameters (juceFilter->getNumParameters()); | ||||
| @@ -396,7 +396,7 @@ public: | |||||
| } | } | ||||
| } | } | ||||
| void updateHostDisplay() | |||||
| void informHostOfStateChange() | |||||
| { | { | ||||
| // xxx is there an AU equivalent? | // xxx is there an AU equivalent? | ||||
| } | } | ||||
| @@ -433,10 +433,12 @@ public: | |||||
| { | { | ||||
| if (juceFilter != 0) | if (juceFilter != 0) | ||||
| { | { | ||||
| juceFilter->numInputChannels = GetInput(0)->GetStreamFormat().mChannelsPerFrame; | |||||
| juceFilter->numOutputChannels = GetOutput(0)->GetStreamFormat().mChannelsPerFrame; | |||||
| juceFilter->setPlayConfigDetails (GetInput(0)->GetStreamFormat().mChannelsPerFrame, | |||||
| GetOutput(0)->GetStreamFormat().mChannelsPerFrame, | |||||
| GetSampleRate(), | |||||
| GetMaxFramesPerSlice()); | |||||
| bufferSpace.setSize (juceFilter->numInputChannels + juceFilter->numOutputChannels, | |||||
| bufferSpace.setSize (juceFilter->getNumInputChannels() + juceFilter->getNumOutputChannels(), | |||||
| GetMaxFramesPerSlice() + 32); | GetMaxFramesPerSlice() + 32); | ||||
| juceFilter->prepareToPlay (GetSampleRate(), | juceFilter->prepareToPlay (GetSampleRate(), | ||||
| @@ -445,8 +447,8 @@ public: | |||||
| midiEvents.clear(); | midiEvents.clear(); | ||||
| juce_free (channels); | juce_free (channels); | ||||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (juceFilter->numInputChannels, | |||||
| juceFilter->numOutputChannels) + 4); | |||||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (juceFilter->getNumInputChannels(), | |||||
| juceFilter->getNumOutputChannels()) + 4); | |||||
| prepared = true; | prepared = true; | ||||
| } | } | ||||
| @@ -474,8 +476,8 @@ public: | |||||
| int numOutChans = 0; | int numOutChans = 0; | ||||
| int nextSpareBufferChan = 0; | int nextSpareBufferChan = 0; | ||||
| bool needToReinterleave = false; | bool needToReinterleave = false; | ||||
| const int numIn = juceFilter->numInputChannels; | |||||
| const int numOut = juceFilter->numOutputChannels; | |||||
| const int numIn = juceFilter->getNumInputChannels(); | |||||
| const int numOut = juceFilter->getNumOutputChannels(); | |||||
| unsigned int i; | unsigned int i; | ||||
| for (i = 0; i < outBuffer.mNumberBuffers; ++i) | for (i = 0; i < outBuffer.mNumberBuffers; ++i) | ||||
| @@ -547,7 +549,7 @@ public: | |||||
| const ScopedLock sl (juceFilter->getCallbackLock()); | const ScopedLock sl (juceFilter->getCallbackLock()); | ||||
| if (juceFilter->suspended) | |||||
| if (juceFilter->isSuspended()) | |||||
| { | { | ||||
| for (int i = 0; i < numOut; ++i) | for (int i = 0; i < numOut; ++i) | ||||
| zeromem (channels [i], sizeof (float) * numSamples); | zeromem (channels [i], sizeof (float) * numSamples); | ||||
| @@ -114,7 +114,7 @@ static long floatToLong (const float n) throw() | |||||
| //============================================================================== | //============================================================================== | ||||
| class JucePlugInProcess : public CEffectProcessMIDI, | class JucePlugInProcess : public CEffectProcessMIDI, | ||||
| public CEffectProcessRTAS, | public CEffectProcessRTAS, | ||||
| public AudioFilterBase::FilterNativeCallbacks, | |||||
| public AudioFilterBase::HostCallbacks, | |||||
| public AsyncUpdater | public AsyncUpdater | ||||
| { | { | ||||
| public: | public: | ||||
| @@ -537,8 +537,8 @@ protected: | |||||
| SFicPlugInStemFormats stems; | SFicPlugInStemFormats stems; | ||||
| GetProcessType()->GetStemFormats (&stems); | GetProcessType()->GetStemFormats (&stems); | ||||
| juceFilter->numInputChannels = fNumInputs; | |||||
| juceFilter->numOutputChannels = fNumOutputs; | |||||
| juceFilter->setPlayConfigDetails (fNumInputs, fNumOutputs, | |||||
| juceFilter->getSampleRate(), juceFilter->getBlockSize()); | |||||
| AddControl (new CPluginControl_OnOff ('bypa', "Master Bypass\nMastrByp\nMByp\nByp", false, true)); | AddControl (new CPluginControl_OnOff ('bypa', "Master Bypass\nMastrByp\nMByp\nByp", false, true)); | ||||
| DefineMasterBypassControlIndex (bypassControlIndex); | DefineMasterBypassControlIndex (bypassControlIndex); | ||||
| @@ -572,7 +572,7 @@ protected: | |||||
| midiTransport = new CEffectMIDITransport (&mMIDIWorld); | midiTransport = new CEffectMIDITransport (&mMIDIWorld); | ||||
| juceFilter->initialiseInternal (this); | |||||
| juceFilter->setHostCallbacks (this); | |||||
| } | } | ||||
| void handleAsyncUpdate() | void handleAsyncUpdate() | ||||
| @@ -586,6 +586,9 @@ protected: | |||||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (juceFilter->getNumInputChannels(), | channels = (float**) juce_calloc (sizeof (float*) * jmax (juceFilter->getNumInputChannels(), | ||||
| juceFilter->getNumOutputChannels())); | juceFilter->getNumOutputChannels())); | ||||
| juceFilter->setPlayConfigDetails (fNumInputs, fNumOutputs, | |||||
| sampleRate, mRTGlobals->mHWBufferSizeInSamples); | |||||
| juceFilter->prepareToPlay (sampleRate, | juceFilter->prepareToPlay (sampleRate, | ||||
| mRTGlobals->mHWBufferSizeInSamples); | mRTGlobals->mHWBufferSizeInSamples); | ||||
| @@ -640,11 +643,11 @@ protected: | |||||
| { | { | ||||
| const ScopedLock sl (juceFilter->getCallbackLock()); | const ScopedLock sl (juceFilter->getCallbackLock()); | ||||
| const int numIn = juceFilter->numInputChannels; | |||||
| const int numOut = juceFilter->numOutputChannels; | |||||
| const int numIn = juceFilter->getNumInputChannels(); | |||||
| const int numOut = juceFilter->getNumOutputChannels(); | |||||
| const int totalChans = jmax (numIn, numOut); | const int totalChans = jmax (numIn, numOut); | ||||
| if (juceFilter->suspended) | |||||
| if (juceFilter->isSuspended()) | |||||
| { | { | ||||
| for (int i = 0; i < numOut; ++i) | for (int i = 0; i < numOut; ++i) | ||||
| zeromem (outputs [i], sizeof (float) * numSamples); | zeromem (outputs [i], sizeof (float) * numSamples); | ||||
| @@ -845,7 +848,7 @@ protected: | |||||
| SetControlValue (index + 2, floatToLong (newValue)); | SetControlValue (index + 2, floatToLong (newValue)); | ||||
| } | } | ||||
| void JUCE_CALLTYPE updateHostDisplay() | |||||
| void JUCE_CALLTYPE informHostOfStateChange() | |||||
| { | { | ||||
| // xxx is there an RTAS equivalent? | // xxx is there an RTAS equivalent? | ||||
| } | } | ||||
| @@ -40,10 +40,9 @@ AudioFilterStreamer::AudioFilterStreamer (AudioFilterBase& filterToUse) | |||||
| sampleRate (0), | sampleRate (0), | ||||
| emptyBuffer (1, 32) | emptyBuffer (1, 32) | ||||
| { | { | ||||
| filter.numInputChannels = JucePlugin_MaxNumInputChannels; | |||||
| filter.numOutputChannels = JucePlugin_MaxNumOutputChannels; | |||||
| filter.setPlayConfigDetails (JucePlugin_MaxNumInputChannels, JucePlugin_MaxNumOutputChannels, 0, 0); | |||||
| filter.initialiseInternal (this); | |||||
| filter.setHostCallbacks (this); | |||||
| } | } | ||||
| AudioFilterStreamer::~AudioFilterStreamer() | AudioFilterStreamer::~AudioFilterStreamer() | ||||
| @@ -85,7 +84,7 @@ void AudioFilterStreamer::audioDeviceIOCallback (const float** inputChannelData, | |||||
| { | { | ||||
| const ScopedLock sl (filter.getCallbackLock()); | const ScopedLock sl (filter.getCallbackLock()); | ||||
| if (filter.suspended) | |||||
| if (filter.isSuspended()) | |||||
| { | { | ||||
| output.clear(); | output.clear(); | ||||
| } | } | ||||
| @@ -144,7 +143,7 @@ void AudioFilterStreamer::informHostOfParameterChange (int index, float newValue | |||||
| } | } | ||||
| void JUCE_CALLTYPE AudioFilterStreamer::updateHostDisplay() | |||||
| void JUCE_CALLTYPE AudioFilterStreamer::informHostOfStateChange() | |||||
| { | { | ||||
| } | } | ||||
| @@ -51,7 +51,7 @@ | |||||
| */ | */ | ||||
| class AudioFilterStreamer : public AudioIODeviceCallback, | class AudioFilterStreamer : public AudioIODeviceCallback, | ||||
| public MidiInputCallback, | public MidiInputCallback, | ||||
| public AudioFilterBase::FilterNativeCallbacks | |||||
| public AudioFilterBase::HostCallbacks | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -73,7 +73,7 @@ public: | |||||
| bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | ||||
| void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue); | void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue); | ||||
| void JUCE_CALLTYPE updateHostDisplay(); | |||||
| void JUCE_CALLTYPE informHostOfStateChange(); | |||||
| juce_UseDebuggingNewOperator | juce_UseDebuggingNewOperator | ||||
| @@ -299,7 +299,7 @@ static VoidArray activePlugins; | |||||
| */ | */ | ||||
| class JuceVSTWrapper : public AudioEffectX, | class JuceVSTWrapper : public AudioEffectX, | ||||
| private Timer, | private Timer, | ||||
| public AudioFilterBase::FilterNativeCallbacks | |||||
| public AudioFilterBase::HostCallbacks | |||||
| { | { | ||||
| public: | public: | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -310,10 +310,11 @@ public: | |||||
| filter_->getNumParameters()), | filter_->getNumParameters()), | ||||
| filter (filter_) | filter (filter_) | ||||
| { | { | ||||
| filter->numInputChannels = JucePlugin_MaxNumInputChannels; | |||||
| filter->numOutputChannels = JucePlugin_MaxNumOutputChannels; | |||||
| filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels, | |||||
| JucePlugin_MaxNumOutputChannels, | |||||
| 0, 0); | |||||
| filter_->initialiseInternal (this); | |||||
| filter_->setHostCallbacks (this); | |||||
| editorComp = 0; | editorComp = 0; | ||||
| outgoingEvents = 0; | outgoingEvents = 0; | ||||
| @@ -336,8 +337,8 @@ public: | |||||
| wantEvents(); | wantEvents(); | ||||
| #endif | #endif | ||||
| setNumInputs (filter->numInputChannels); | |||||
| setNumOutputs (filter->numOutputChannels); | |||||
| setNumInputs (filter->getNumInputChannels()); | |||||
| setNumOutputs (filter->getNumOutputChannels()); | |||||
| canProcessReplacing (true); | canProcessReplacing (true); | ||||
| @@ -531,16 +532,19 @@ public: | |||||
| void process (float** inputs, float** outputs, VstInt32 numSamples) | void process (float** inputs, float** outputs, VstInt32 numSamples) | ||||
| { | { | ||||
| AudioSampleBuffer temp (filter->numInputChannels, numSamples); | |||||
| const int numIn = filter->getNumInputChannels(); | |||||
| const int numOut = filter->getNumOutputChannels(); | |||||
| AudioSampleBuffer temp (numIn, numSamples); | |||||
| int i; | int i; | ||||
| for (i = filter->numInputChannels; --i >= 0;) | |||||
| for (i = numIn; --i >= 0;) | |||||
| memcpy (temp.getSampleData (i), outputs[i], sizeof (float) * numSamples); | memcpy (temp.getSampleData (i), outputs[i], sizeof (float) * numSamples); | ||||
| processReplacing (inputs, outputs, numSamples); | processReplacing (inputs, outputs, numSamples); | ||||
| AudioSampleBuffer dest (outputs, filter->numOutputChannels, numSamples); | |||||
| AudioSampleBuffer dest (outputs, numOut, numSamples); | |||||
| for (i = jmin (filter->numOutputChannels, filter->numInputChannels); --i >= 0;) | |||||
| for (i = jmin (numIn, numOut); --i >= 0;) | |||||
| dest.addFrom (i, 0, temp, i, 0, numSamples); | dest.addFrom (i, 0, temp, i, 0, numSamples); | ||||
| } | } | ||||
| @@ -564,11 +568,11 @@ public: | |||||
| { | { | ||||
| const ScopedLock sl (filter->getCallbackLock()); | const ScopedLock sl (filter->getCallbackLock()); | ||||
| const int numIn = filter->numInputChannels; | |||||
| const int numOut = filter->numOutputChannels; | |||||
| const int numIn = filter->getNumInputChannels(); | |||||
| const int numOut = filter->getNumOutputChannels(); | |||||
| const int totalChans = jmax (numIn, numOut); | const int totalChans = jmax (numIn, numOut); | ||||
| if (filter->suspended) | |||||
| if (filter->isSuspended()) | |||||
| { | { | ||||
| for (int i = 0; i < numOut; ++i) | for (int i = 0; i < numOut; ++i) | ||||
| zeromem (outputs [i], sizeof (float) * numSamples); | zeromem (outputs [i], sizeof (float) * numSamples); | ||||
| @@ -650,16 +654,19 @@ public: | |||||
| juce_free (channels); | juce_free (channels); | ||||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (filter->getNumInputChannels(), filter->getNumOutputChannels())); | channels = (float**) juce_calloc (sizeof (float*) * jmax (filter->getNumInputChannels(), filter->getNumOutputChannels())); | ||||
| filter->sampleRate = getSampleRate(); | |||||
| double rate = getSampleRate(); | |||||
| jassert (rate > 0); | |||||
| if (rate <= 0.0) | |||||
| rate = 44100.0; | |||||
| jassert (filter->sampleRate > 0); | |||||
| if (filter->sampleRate <= 0) | |||||
| filter->sampleRate = 44100.0; | |||||
| const int blockSize = getBlockSize(); | |||||
| jassert (blockSize > 0); | |||||
| filter->blockSize = getBlockSize(); | |||||
| jassert (filter->blockSize > 0); | |||||
| filter->setPlayConfigDetails (JucePlugin_MaxNumInputChannels, | |||||
| JucePlugin_MaxNumOutputChannels, | |||||
| rate, blockSize); | |||||
| filter->prepareToPlay (filter->sampleRate, filter->blockSize); | |||||
| filter->prepareToPlay (rate, blockSize); | |||||
| midiEvents.clear(); | midiEvents.clear(); | ||||
| AudioEffectX::resume(); | AudioEffectX::resume(); | ||||
| @@ -807,7 +814,7 @@ public: | |||||
| setParameterAutomated (index, newValue); | setParameterAutomated (index, newValue); | ||||
| } | } | ||||
| void JUCE_CALLTYPE updateHostDisplay() | |||||
| void JUCE_CALLTYPE informHostOfStateChange() | |||||
| { | { | ||||
| updateDisplay(); | updateDisplay(); | ||||
| } | } | ||||
| @@ -34,13 +34,13 @@ | |||||
| //============================================================================== | //============================================================================== | ||||
| AudioFilterBase::AudioFilterBase() | AudioFilterBase::AudioFilterBase() | ||||
| : sampleRate (0), | |||||
| : callbacks (0), | |||||
| activeEditor (0), | |||||
| sampleRate (0), | |||||
| blockSize (0), | blockSize (0), | ||||
| numInputChannels (0), | numInputChannels (0), | ||||
| numOutputChannels (0), | numOutputChannels (0), | ||||
| callbacks (0), | |||||
| suspended (false), | |||||
| activeEditor (0) | |||||
| suspended (false) | |||||
| { | { | ||||
| } | } | ||||
| @@ -51,11 +51,22 @@ AudioFilterBase::~AudioFilterBase() | |||||
| jassert (activeEditor == 0); | jassert (activeEditor == 0); | ||||
| } | } | ||||
| void AudioFilterBase::initialiseInternal (FilterNativeCallbacks* const callbacks_) | |||||
| void AudioFilterBase::setHostCallbacks (HostCallbacks* const callbacks_) | |||||
| { | { | ||||
| callbacks = callbacks_; | callbacks = callbacks_; | ||||
| } | } | ||||
| void AudioFilterBase::setPlayConfigDetails (const int numIns, | |||||
| const int numOuts, | |||||
| const double sampleRate_, | |||||
| const int blockSize_) throw() | |||||
| { | |||||
| numInputChannels = numIns; | |||||
| numOutputChannels = numOuts; | |||||
| sampleRate = sampleRate_; | |||||
| blockSize = blockSize_; | |||||
| } | |||||
| void AudioFilterBase::setParameterNotifyingHost (const int parameterIndex, | void AudioFilterBase::setParameterNotifyingHost (const int parameterIndex, | ||||
| const float newValue) | const float newValue) | ||||
| { | { | ||||
| @@ -70,7 +81,7 @@ void AudioFilterBase::setParameterNotifyingHost (const int parameterIndex, | |||||
| void JUCE_CALLTYPE AudioFilterBase::updateHostDisplay() | void JUCE_CALLTYPE AudioFilterBase::updateHostDisplay() | ||||
| { | { | ||||
| if (callbacks != 0) | if (callbacks != 0) | ||||
| callbacks->updateHostDisplay(); | |||||
| callbacks->informHostOfStateChange(); | |||||
| } | } | ||||
| bool AudioFilterBase::isParameterAutomatable (int /*index*/) const | bool AudioFilterBase::isParameterAutomatable (int /*index*/) const | ||||
| @@ -40,6 +40,7 @@ | |||||
| #include "juce_AudioFilterEditor.h" | #include "juce_AudioFilterEditor.h" | ||||
| #undef MemoryBlock | #undef MemoryBlock | ||||
| //============================================================================== | //============================================================================== | ||||
| /** | /** | ||||
| Base class for audio filters or plugins written using JUCE. | Base class for audio filters or plugins written using JUCE. | ||||
| @@ -313,6 +314,11 @@ public: | |||||
| */ | */ | ||||
| void JUCE_CALLTYPE suspendProcessing (const bool shouldBeSuspended); | void JUCE_CALLTYPE suspendProcessing (const bool shouldBeSuspended); | ||||
| /** Returns true if processing is currently suspended. | |||||
| @see suspendProcessing | |||||
| */ | |||||
| bool JUCE_CALLTYPE isSuspended() const throw() { return suspended; } | |||||
| //============================================================================== | //============================================================================== | ||||
| /** Creates the filter's UI. | /** Creates the filter's UI. | ||||
| @@ -493,16 +499,17 @@ public: | |||||
| //============================================================================== | //============================================================================== | ||||
| /** @internal */ | /** @internal */ | ||||
| class FilterNativeCallbacks | |||||
| class HostCallbacks | |||||
| { | { | ||||
| public: | public: | ||||
| virtual ~FilterNativeCallbacks() {} | |||||
| virtual ~HostCallbacks() {} | |||||
| virtual bool JUCE_CALLTYPE getCurrentPositionInfo (CurrentPositionInfo& info) = 0; | virtual bool JUCE_CALLTYPE getCurrentPositionInfo (CurrentPositionInfo& info) = 0; | ||||
| virtual void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue) = 0; | virtual void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue) = 0; | ||||
| /** Callback to indicate that something (other than a parameter) has changed in the | /** Callback to indicate that something (other than a parameter) has changed in the | ||||
| filter, such as its current program, parameter list, etc. */ | filter, such as its current program, parameter list, etc. */ | ||||
| virtual void JUCE_CALLTYPE updateHostDisplay() = 0; | |||||
| virtual void JUCE_CALLTYPE informHostOfStateChange() = 0; | |||||
| }; | }; | ||||
| @@ -512,10 +519,17 @@ public: | |||||
| */ | */ | ||||
| void JUCE_CALLTYPE editorBeingDeleted (AudioFilterEditor* const editor); | void JUCE_CALLTYPE editorBeingDeleted (AudioFilterEditor* const editor); | ||||
| /** Not for public use - this is called by the wrapper code to initialised the | |||||
| /** Not for public use - this is called by the wrapper code to initialise the | |||||
| filter. | filter. | ||||
| */ | */ | ||||
| void JUCE_CALLTYPE initialiseInternal (FilterNativeCallbacks* const); | |||||
| void JUCE_CALLTYPE setHostCallbacks (HostCallbacks* const); | |||||
| /** Not for public use - this is called by the wrapper code to initialise the | |||||
| filter. | |||||
| */ | |||||
| void setPlayConfigDetails (const int numIns, const int numOuts, | |||||
| const double sampleRate, | |||||
| const int blockSize) throw(); | |||||
| //============================================================================== | //============================================================================== | ||||
| juce_UseDebuggingNewOperator | juce_UseDebuggingNewOperator | ||||
| @@ -542,24 +556,14 @@ protected: | |||||
| const int sizeInBytes); | const int sizeInBytes); | ||||
| /** @internal */ | /** @internal */ | ||||
| double sampleRate; | |||||
| /** @internal */ | |||||
| int blockSize, numInputChannels, numOutputChannels; | |||||
| /** @internal */ | |||||
| FilterNativeCallbacks* callbacks; | |||||
| HostCallbacks* callbacks; | |||||
| private: | private: | ||||
| friend class JuceVSTWrapper; | |||||
| friend class JuceAU; | |||||
| friend class JuceAUView; | |||||
| friend class AudioFilterEditor; | |||||
| friend class AudioFilterStreamer; | |||||
| friend class JucePlugInProcess; | |||||
| CriticalSection callbackLock; | |||||
| bool suspended; | |||||
| AudioFilterEditor* activeEditor; | AudioFilterEditor* activeEditor; | ||||
| double sampleRate; | |||||
| int blockSize, numInputChannels, numOutputChannels; | |||||
| bool suspended; | |||||
| CriticalSection callbackLock; | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -45,5 +45,5 @@ AudioFilterEditor::~AudioFilterEditor() | |||||
| { | { | ||||
| // if this fails, then the wrapper hasn't called editorBeingDeleted() on the | // if this fails, then the wrapper hasn't called editorBeingDeleted() on the | ||||
| // filter for some reason.. | // filter for some reason.. | ||||
| jassert (ownerFilter->activeEditor != this); | |||||
| jassert (ownerFilter->getActiveEditor() != this); | |||||
| } | } | ||||