| @@ -98,7 +98,7 @@ class AudioInputDeviceFilter : public InternalFilterBase | |||
| public: | |||
| AudioInputDeviceFilter (const int numChannels) | |||
| { | |||
| numOutputChannels = numChannels; | |||
| setPlayConfigDetails (0, numChannels, getSampleRate(), getBlockSize()); | |||
| } | |||
| ~AudioInputDeviceFilter() {} | |||
| @@ -115,7 +115,7 @@ public: | |||
| AudioIODevice* const dev = getAudioDevice(); | |||
| if (dev != 0) | |||
| numOutputChannels = dev->getActiveInputChannels().countNumberOfSetBits(); | |||
| setPlayConfigDetails (0, dev->getActiveInputChannels().countNumberOfSetBits(), getSampleRate(), getBlockSize()); | |||
| } | |||
| void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | |||
| @@ -178,7 +178,7 @@ class AudioOutputDeviceFilter : public InternalFilterBase | |||
| public: | |||
| AudioOutputDeviceFilter (const int numChannels) | |||
| { | |||
| numInputChannels = numChannels; | |||
| setPlayConfigDetails (numChannels, 0, getSampleRate(), getBlockSize()); | |||
| } | |||
| ~AudioOutputDeviceFilter() {} | |||
| @@ -195,7 +195,7 @@ public: | |||
| AudioIODevice* const dev = getAudioDevice(); | |||
| if (dev != 0) | |||
| numInputChannels = dev->getActiveOutputChannels().countNumberOfSetBits(); | |||
| setPlayConfigDetails (dev->getActiveOutputChannels().countNumberOfSetBits(), 0, getSampleRate(), getBlockSize()); | |||
| } | |||
| void JUCE_CALLTYPE prepareToPlay (double /*sampleRate*/, int /*estimatedSamplesPerBlock*/) | |||
| @@ -44,7 +44,7 @@ AudioPluginInstance::AudioPluginInstance() | |||
| { | |||
| internalAsyncUpdater = new InternalAsyncUpdater (*this); | |||
| initialiseInternal (this); | |||
| setHostCallbacks (this); | |||
| } | |||
| AudioPluginInstance::~AudioPluginInstance() | |||
| @@ -127,7 +127,7 @@ void JUCE_CALLTYPE AudioPluginInstance::informHostOfParameterChange (int index, | |||
| queueChangeMessage (index); | |||
| } | |||
| void JUCE_CALLTYPE AudioPluginInstance::updateHostDisplay() | |||
| void JUCE_CALLTYPE AudioPluginInstance::informHostOfStateChange() | |||
| { | |||
| queueChangeMessage (-1); | |||
| } | |||
| @@ -67,7 +67,7 @@ public: | |||
| @see AudioFilterBase, AudioPluginFormat | |||
| */ | |||
| class AudioPluginInstance : public AudioFilterBase, | |||
| private AudioFilterBase::FilterNativeCallbacks | |||
| private AudioFilterBase::HostCallbacks | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -168,7 +168,7 @@ protected: | |||
| bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | |||
| 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); | |||
| { | |||
| char buffer [kVstMaxEffectNameLen + 8]; | |||
| char buffer [256]; | |||
| zerostruct (buffer); | |||
| dispatch (effGetEffectName, 0, 0, buffer, 0); | |||
| name = String (buffer); | |||
| if (name.trim().isEmpty()) | |||
| name = String (buffer).trim(); | |||
| if (name.isEmpty()) | |||
| 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); | |||
| numOutputChannels = effect->numOutputs; | |||
| numInputChannels = effect->numInputs; | |||
| setPlayConfigDetails (effect->numInputs, effect->numOutputs, | |||
| getSampleRate(), getBlockSize()); | |||
| if (getNumPrograms() > 1) | |||
| 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); | |||
| 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.timeSigNumerator = 4; | |||
| vstHostTime.timeSigDenominator = 4; | |||
| vstHostTime.sampleRate = sampleRate; | |||
| vstHostTime.sampleRate = sampleRate_; | |||
| vstHostTime.samplePos = 0; | |||
| vstHostTime.flags = kVstNanosValid; /*| kVstTransportPlaying | kVstTempoValid | kVstTimeSigValid*/; | |||
| @@ -706,10 +708,10 @@ void JUCE_CALLTYPE VSTPluginInstance::prepareToPlay (double sampleRate_, int sam | |||
| 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) | |||
| setPower (true); | |||
| @@ -734,7 +736,7 @@ void JUCE_CALLTYPE VSTPluginInstance::releaseResources() | |||
| setPower (false); | |||
| } | |||
| midiCollector.reset (sampleRate); | |||
| midiCollector.reset (getSampleRate()); | |||
| tempBuffer.setSize (1, 1); | |||
| incomingMidi.clear(); | |||
| @@ -1274,7 +1276,7 @@ private: | |||
| checkPluginWindowSize(); | |||
| #endif | |||
| startTimer (18 + juce::Random::getSystemRandom().nextInt (5)); | |||
| startTimer (18 + JUCE_NAMESPACE::Random::getSystemRandom().nextInt (5)); | |||
| repaint(); | |||
| } | |||
| @@ -1417,8 +1419,7 @@ AudioFilterEditor* JUCE_CALLTYPE VSTPluginInstance::createEditor() | |||
| void VSTPluginInstance::handleAsyncUpdate() | |||
| { | |||
| // 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)); | |||
| } | |||
| 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 numParams = getNumParameters(); | |||
| @@ -1556,7 +1557,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||
| { | |||
| if (isFXB) | |||
| { | |||
| juce::MemoryBlock chunk; | |||
| JUCE_NAMESPACE::MemoryBlock chunk; | |||
| getChunkData (chunk, false, maxSizeMB); | |||
| const int totalLen = sizeof (fxChunkSet) + chunk.getSize() - 8; | |||
| @@ -1576,7 +1577,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||
| } | |||
| else | |||
| { | |||
| juce::MemoryBlock chunk; | |||
| JUCE_NAMESPACE::MemoryBlock chunk; | |||
| getChunkData (chunk, true, maxSizeMB); | |||
| 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); | |||
| const int oldProgram = getCurrentProgram(); | |||
| juce::MemoryBlock oldSettings; | |||
| JUCE_NAMESPACE::MemoryBlock oldSettings; | |||
| createTempParameterStore (oldSettings); | |||
| setParamsInProgramBlock ((fxProgram*) (((char*) (set->programs)) + oldProgram * progLen)); | |||
| @@ -1643,7 +1644,7 @@ bool VSTPluginInstance::saveToFXBFile (juce::MemoryBlock& dest, bool isFXB, int | |||
| 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()) | |||
| { | |||
| @@ -1856,10 +1857,10 @@ VstIntPtr VSTPluginInstance::handleCallback (VstInt32 opcode, VstInt32 index, Vs | |||
| return 1; | |||
| case audioMasterGetSampleRate: | |||
| return (VstIntPtr) sampleRate; | |||
| return (VstIntPtr) getSampleRate(); | |||
| case audioMasterGetBlockSize: | |||
| return (VstIntPtr) blockSize; | |||
| return (VstIntPtr) getBlockSize(); | |||
| case audioMasterWantMidi: | |||
| wantsMidiMessages = true; | |||
| @@ -2142,7 +2143,7 @@ bool VSTPluginInstance::isParameterAutomatable (int index) const | |||
| return false; | |||
| } | |||
| void VSTPluginInstance::createTempParameterStore (juce::MemoryBlock& dest) | |||
| void VSTPluginInstance::createTempParameterStore (JUCE_NAMESPACE::MemoryBlock& dest) | |||
| { | |||
| dest.setSize (64 + 4 * getNumParameters()); | |||
| dest.fillWith (0); | |||
| @@ -2154,7 +2155,7 @@ void VSTPluginInstance::createTempParameterStore (juce::MemoryBlock& dest) | |||
| p[i] = getParameter(i); | |||
| } | |||
| void VSTPluginInstance::restoreFromTempParameterStore (const juce::MemoryBlock& m) | |||
| void VSTPluginInstance::restoreFromTempParameterStore (const JUCE_NAMESPACE::MemoryBlock& m) | |||
| { | |||
| changeProgramName (getCurrentProgram(), (const char*) m); | |||
| @@ -2226,7 +2227,7 @@ void VSTPluginInstance::updateStoredProgramNames() | |||
| if (dispatch (effGetProgramNameIndexed, 0, -1, nm, 0) == 0) | |||
| { | |||
| const int oldProgram = getCurrentProgram(); | |||
| juce::MemoryBlock oldSettings; | |||
| JUCE_NAMESPACE::MemoryBlock oldSettings; | |||
| createTempParameterStore (oldSettings); | |||
| for (int i = 0; i < getNumPrograms(); ++i) | |||
| @@ -2345,11 +2346,6 @@ bool VSTPluginInstance::canMono() const throw() | |||
| return effect != 0 && (effect->flags & effFlagsCanMono) != 0; | |||
| } | |||
| bool VSTPluginInstance::canReplace() const throw() | |||
| { | |||
| return effect != 0 && (effect->flags & effFlagsCanReplacing) != 0; | |||
| } | |||
| bool VSTPluginInstance::isOffline() const throw() | |||
| { | |||
| return dispatch (effCanDo, 0, 0, (void*) "offline", 0) > 0; | |||
| @@ -172,7 +172,6 @@ private: | |||
| int getVersionNumber() const throw(); | |||
| bool hasEditor() const throw(); | |||
| bool canMono() const throw(); | |||
| bool canReplace() const throw(); | |||
| bool isOffline() const throw(); | |||
| void setPower (const bool on); | |||
| @@ -50,7 +50,7 @@ END_JUCE_NAMESPACE | |||
| //============================================================================== | |||
| class JuceAU : public AUMIDIEffectBase, | |||
| public AudioFilterBase::FilterNativeCallbacks | |||
| public AudioFilterBase::HostCallbacks | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -75,7 +75,7 @@ public: | |||
| } | |||
| juceFilter = createPluginFilter(); | |||
| juceFilter->initialiseInternal (this); | |||
| juceFilter->setHostCallbacks (this); | |||
| jassert (juceFilter != 0); | |||
| Globals()->UseIndexedParameters (juceFilter->getNumParameters()); | |||
| @@ -396,7 +396,7 @@ public: | |||
| } | |||
| } | |||
| void updateHostDisplay() | |||
| void informHostOfStateChange() | |||
| { | |||
| // xxx is there an AU equivalent? | |||
| } | |||
| @@ -433,10 +433,12 @@ public: | |||
| { | |||
| 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); | |||
| juceFilter->prepareToPlay (GetSampleRate(), | |||
| @@ -445,8 +447,8 @@ public: | |||
| midiEvents.clear(); | |||
| 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; | |||
| } | |||
| @@ -474,8 +476,8 @@ public: | |||
| int numOutChans = 0; | |||
| int nextSpareBufferChan = 0; | |||
| 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; | |||
| for (i = 0; i < outBuffer.mNumberBuffers; ++i) | |||
| @@ -547,7 +549,7 @@ public: | |||
| const ScopedLock sl (juceFilter->getCallbackLock()); | |||
| if (juceFilter->suspended) | |||
| if (juceFilter->isSuspended()) | |||
| { | |||
| for (int i = 0; i < numOut; ++i) | |||
| zeromem (channels [i], sizeof (float) * numSamples); | |||
| @@ -114,7 +114,7 @@ static long floatToLong (const float n) throw() | |||
| //============================================================================== | |||
| class JucePlugInProcess : public CEffectProcessMIDI, | |||
| public CEffectProcessRTAS, | |||
| public AudioFilterBase::FilterNativeCallbacks, | |||
| public AudioFilterBase::HostCallbacks, | |||
| public AsyncUpdater | |||
| { | |||
| public: | |||
| @@ -537,8 +537,8 @@ protected: | |||
| SFicPlugInStemFormats 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)); | |||
| DefineMasterBypassControlIndex (bypassControlIndex); | |||
| @@ -572,7 +572,7 @@ protected: | |||
| midiTransport = new CEffectMIDITransport (&mMIDIWorld); | |||
| juceFilter->initialiseInternal (this); | |||
| juceFilter->setHostCallbacks (this); | |||
| } | |||
| void handleAsyncUpdate() | |||
| @@ -586,6 +586,9 @@ protected: | |||
| channels = (float**) juce_calloc (sizeof (float*) * jmax (juceFilter->getNumInputChannels(), | |||
| juceFilter->getNumOutputChannels())); | |||
| juceFilter->setPlayConfigDetails (fNumInputs, fNumOutputs, | |||
| sampleRate, mRTGlobals->mHWBufferSizeInSamples); | |||
| juceFilter->prepareToPlay (sampleRate, | |||
| mRTGlobals->mHWBufferSizeInSamples); | |||
| @@ -640,11 +643,11 @@ protected: | |||
| { | |||
| 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); | |||
| if (juceFilter->suspended) | |||
| if (juceFilter->isSuspended()) | |||
| { | |||
| for (int i = 0; i < numOut; ++i) | |||
| zeromem (outputs [i], sizeof (float) * numSamples); | |||
| @@ -845,7 +848,7 @@ protected: | |||
| SetControlValue (index + 2, floatToLong (newValue)); | |||
| } | |||
| void JUCE_CALLTYPE updateHostDisplay() | |||
| void JUCE_CALLTYPE informHostOfStateChange() | |||
| { | |||
| // xxx is there an RTAS equivalent? | |||
| } | |||
| @@ -40,10 +40,9 @@ AudioFilterStreamer::AudioFilterStreamer (AudioFilterBase& filterToUse) | |||
| sampleRate (0), | |||
| 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() | |||
| @@ -85,7 +84,7 @@ void AudioFilterStreamer::audioDeviceIOCallback (const float** inputChannelData, | |||
| { | |||
| const ScopedLock sl (filter.getCallbackLock()); | |||
| if (filter.suspended) | |||
| if (filter.isSuspended()) | |||
| { | |||
| 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, | |||
| public MidiInputCallback, | |||
| public AudioFilterBase::FilterNativeCallbacks | |||
| public AudioFilterBase::HostCallbacks | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -73,7 +73,7 @@ public: | |||
| bool JUCE_CALLTYPE getCurrentPositionInfo (AudioFilterBase::CurrentPositionInfo& info); | |||
| void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue); | |||
| void JUCE_CALLTYPE updateHostDisplay(); | |||
| void JUCE_CALLTYPE informHostOfStateChange(); | |||
| juce_UseDebuggingNewOperator | |||
| @@ -299,7 +299,7 @@ static VoidArray activePlugins; | |||
| */ | |||
| class JuceVSTWrapper : public AudioEffectX, | |||
| private Timer, | |||
| public AudioFilterBase::FilterNativeCallbacks | |||
| public AudioFilterBase::HostCallbacks | |||
| { | |||
| public: | |||
| //============================================================================== | |||
| @@ -310,10 +310,11 @@ public: | |||
| filter_->getNumParameters()), | |||
| 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; | |||
| outgoingEvents = 0; | |||
| @@ -336,8 +337,8 @@ public: | |||
| wantEvents(); | |||
| #endif | |||
| setNumInputs (filter->numInputChannels); | |||
| setNumOutputs (filter->numOutputChannels); | |||
| setNumInputs (filter->getNumInputChannels()); | |||
| setNumOutputs (filter->getNumOutputChannels()); | |||
| canProcessReplacing (true); | |||
| @@ -531,16 +532,19 @@ public: | |||
| 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; | |||
| for (i = filter->numInputChannels; --i >= 0;) | |||
| for (i = numIn; --i >= 0;) | |||
| memcpy (temp.getSampleData (i), outputs[i], sizeof (float) * 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); | |||
| } | |||
| @@ -564,11 +568,11 @@ public: | |||
| { | |||
| 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); | |||
| if (filter->suspended) | |||
| if (filter->isSuspended()) | |||
| { | |||
| for (int i = 0; i < numOut; ++i) | |||
| zeromem (outputs [i], sizeof (float) * numSamples); | |||
| @@ -650,16 +654,19 @@ public: | |||
| juce_free (channels); | |||
| 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(); | |||
| AudioEffectX::resume(); | |||
| @@ -807,7 +814,7 @@ public: | |||
| setParameterAutomated (index, newValue); | |||
| } | |||
| void JUCE_CALLTYPE updateHostDisplay() | |||
| void JUCE_CALLTYPE informHostOfStateChange() | |||
| { | |||
| updateDisplay(); | |||
| } | |||
| @@ -34,13 +34,13 @@ | |||
| //============================================================================== | |||
| AudioFilterBase::AudioFilterBase() | |||
| : sampleRate (0), | |||
| : callbacks (0), | |||
| activeEditor (0), | |||
| sampleRate (0), | |||
| blockSize (0), | |||
| numInputChannels (0), | |||
| numOutputChannels (0), | |||
| callbacks (0), | |||
| suspended (false), | |||
| activeEditor (0) | |||
| suspended (false) | |||
| { | |||
| } | |||
| @@ -51,11 +51,22 @@ AudioFilterBase::~AudioFilterBase() | |||
| jassert (activeEditor == 0); | |||
| } | |||
| void AudioFilterBase::initialiseInternal (FilterNativeCallbacks* const callbacks_) | |||
| void AudioFilterBase::setHostCallbacks (HostCallbacks* const 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, | |||
| const float newValue) | |||
| { | |||
| @@ -70,7 +81,7 @@ void AudioFilterBase::setParameterNotifyingHost (const int parameterIndex, | |||
| void JUCE_CALLTYPE AudioFilterBase::updateHostDisplay() | |||
| { | |||
| if (callbacks != 0) | |||
| callbacks->updateHostDisplay(); | |||
| callbacks->informHostOfStateChange(); | |||
| } | |||
| bool AudioFilterBase::isParameterAutomatable (int /*index*/) const | |||
| @@ -40,6 +40,7 @@ | |||
| #include "juce_AudioFilterEditor.h" | |||
| #undef MemoryBlock | |||
| //============================================================================== | |||
| /** | |||
| Base class for audio filters or plugins written using JUCE. | |||
| @@ -313,6 +314,11 @@ public: | |||
| */ | |||
| 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. | |||
| @@ -493,16 +499,17 @@ public: | |||
| //============================================================================== | |||
| /** @internal */ | |||
| class FilterNativeCallbacks | |||
| class HostCallbacks | |||
| { | |||
| public: | |||
| virtual ~FilterNativeCallbacks() {} | |||
| virtual ~HostCallbacks() {} | |||
| virtual bool JUCE_CALLTYPE getCurrentPositionInfo (CurrentPositionInfo& info) = 0; | |||
| virtual void JUCE_CALLTYPE informHostOfParameterChange (int index, float newValue) = 0; | |||
| /** Callback to indicate that something (other than a parameter) has changed in the | |||
| 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); | |||
| /** 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. | |||
| */ | |||
| 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 | |||
| @@ -542,24 +556,14 @@ protected: | |||
| const int sizeInBytes); | |||
| /** @internal */ | |||
| double sampleRate; | |||
| /** @internal */ | |||
| int blockSize, numInputChannels, numOutputChannels; | |||
| /** @internal */ | |||
| FilterNativeCallbacks* callbacks; | |||
| HostCallbacks* callbacks; | |||
| 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; | |||
| 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 | |||
| // filter for some reason.. | |||
| jassert (ownerFilter->activeEditor != this); | |||
| jassert (ownerFilter->getActiveEditor() != this); | |||
| } | |||