AnalogTapeModel

Physical modelling signal processing for analog tape recording
Log | Files | Refs | Submodules | README | LICENSE

commit b61cd9e8b60af7818f858175753abb1c57d8e83a
parent d57d277d595b7ca86c76260148c67f6099e77419
Author: jatinchowdhury18 <jatinchowdhury18@gmail.com>
Date:   Mon, 11 Mar 2019 12:43:35 -0700

v1.0 release (fixes) (#4)

* Clean release

* Fix Mac warnings and loss effects

* Save/reload Plugin state

* Win Binaries

* Update travis

* Travis build- 35

* Update travis

Diffstat:
MPlugin/Installers/Win/CHOWTapeModel-Win-1.0.0.exe | 0
MPlugin/Source/GUI Components/LossControls.h | 2+-
MPlugin/Source/GUI Extras/ChowSlider.h | 2+-
MPlugin/Source/PluginProcessor.cpp | 36+++++++++++++++++++++++++++++-------
MPlugin/Source/Processors/Loss Effects/LossEffects.cpp | 2+-
5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/Plugin/Installers/Win/CHOWTapeModel-Win-1.0.0.exe b/Plugin/Installers/Win/CHOWTapeModel-Win-1.0.0.exe Binary files differ. diff --git a/Plugin/Source/GUI Components/LossControls.h b/Plugin/Source/GUI Components/LossControls.h @@ -34,4 +34,4 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (LossControls) }; -#endif LOSSCONTROLS_H_INCLUDED +#endif //LOSSCONTROLS_H_INCLUDED diff --git a/Plugin/Source/GUI Extras/ChowSlider.h b/Plugin/Source/GUI Extras/ChowSlider.h @@ -21,4 +21,4 @@ private: JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR (ChowSlider) }; -#endif CHOWSLIDER_H_INCLUDED +#endif //CHOWSLIDER_H_INCLUDED diff --git a/Plugin/Source/PluginProcessor.cpp b/Plugin/Source/PluginProcessor.cpp @@ -225,17 +225,39 @@ AudioProcessorEditor* ChowtapeModelAudioProcessor::createEditor() } //============================================================================== -void ChowtapeModelAudioProcessor::getStateInformation (MemoryBlock& /*destData*/) +void ChowtapeModelAudioProcessor::getStateInformation (MemoryBlock& destData) { - // You should use this method to store your parameters in the memory block. - // You could do that either as raw data, or use the XML or ValueTree classes - // as intermediaries to make it easy to save and load complex data. + std::unique_ptr<XmlElement> xml (new XmlElement ("ChowTapeXmlData")); + + xml->setAttribute ("inGain", (double) *inGain); + xml->setAttribute ("outGain", (double) *outGain); + xml->setAttribute ("tapeSpeed", tapeSpeed->getIndex()); + xml->setAttribute ("biasGain", (double) *biasGain); + xml->setAttribute ("tapeSpacing", (double) *tapeSpacing); + xml->setAttribute ("tapeThickness", (double) *tapeThickness); + xml->setAttribute ("gapWidth", (double) *gapWidth); + xml->setAttribute ("flutterDepth", (double) *flutterDepth); + + copyXmlToBinary (*xml, destData); } -void ChowtapeModelAudioProcessor::setStateInformation (const void* /*data*/, int /*sizeInBytes*/) +void ChowtapeModelAudioProcessor::setStateInformation (const void* data, int sizeInBytes) { - // You should use this method to restore your parameters from this memory block, - // whose contents will have been created by the getStateInformation() call. + std::unique_ptr<XmlElement> xmlState (getXmlFromBinary (data, sizeInBytes)); + if (xmlState.get() != nullptr) + { + if (xmlState->hasTagName ("ChowTapeXmlData")) + { + *inGain = (float) xmlState->getDoubleAttribute ("inGain", 0.0); + *outGain = (float) xmlState->getDoubleAttribute ("outGain", 0.0); + *tapeSpeed = xmlState->getIntAttribute ("tapeSpeed", 0); + *biasGain= (float) xmlState->getDoubleAttribute ("biasGain", 0.0); + *tapeSpacing = (float) xmlState->getDoubleAttribute ("tapeSpacing", 0.0); + *tapeThickness = (float) xmlState->getDoubleAttribute ("tapeThickness", 0.0); + *gapWidth= (float) xmlState->getDoubleAttribute ("gapWidth", 0.0); + *flutterDepth= (float) xmlState->getDoubleAttribute ("flutterDepth", 0.0); + } + } } //============================================================================== diff --git a/Plugin/Source/Processors/Loss Effects/LossEffects.cpp b/Plugin/Source/Processors/Loss Effects/LossEffects.cpp @@ -14,7 +14,7 @@ void LossEffects::init (float sampleRate, float speed, float spacing, float thic for (int k = 0; k < order / 2; k++) { const auto freq = ((float) k * binWidth) + (binWidth / 2.0f); - const auto waveNumber = MathConstants<float>::twoPi * freq / speed; + const auto waveNumber = MathConstants<float>::twoPi * freq / speedMetric; const auto spacingLoss = std::expf (-1.0f * waveNumber * spacing); const auto gapLoss = std::sinf (waveNumber * gap / 2.0f) / (waveNumber * gap / 2.0f);