From 3e6e052b3d6cd12fad5cd1b62e8b954d7a7c35da Mon Sep 17 00:00:00 2001 From: Oli Larkin Date: Sun, 26 Mar 2023 12:11:41 +0200 Subject: [PATCH] Format Examples/Test src --- Examples/IPlugChunks/IPlugChunks.cpp | 58 +- Examples/IPlugChunks/IPlugChunks.h | 12 +- .../IPlugChunks/resources/AUv3Framework.h | 4 +- Examples/IPlugCocoaUI/IPlugCocoaUI-Shared.h | 4 +- Examples/IPlugCocoaUI/IPlugCocoaUI.h | 7 +- .../IPlugCocoaUI/resources/AUv3Framework.h | 4 +- Examples/IPlugControls/IPlugControls.cpp | 605 +++++++++--------- Examples/IPlugControls/IPlugControls.h | 11 +- Examples/IPlugControls/config.h | 3 +- .../IPlugControls/resources/AUv3Framework.h | 4 +- .../IPlugConvoEngine/IPlugConvoEngine.cpp | 52 +- Examples/IPlugConvoEngine/IPlugConvoEngine.h | 17 +- Examples/IPlugConvoEngine/ir.h | 562 ++-------------- .../resources/AUv3Framework.h | 4 +- Examples/IPlugDrumSynth/IPlugDrumSynth.cpp | 110 ++-- Examples/IPlugDrumSynth/IPlugDrumSynth.h | 3 +- Examples/IPlugDrumSynth/IPlugDrumSynth_DSP.h | 98 ++- Examples/IPlugDrumSynth/config.h | 3 +- .../IPlugDrumSynth/resources/AUv3Framework.h | 4 +- Examples/IPlugEffect/IPlugEffect.cpp | 14 +- .../IPlugEffect/resources/AUv3Framework.h | 4 +- Examples/IPlugFaustDSP/IPlugFaustDSP.cpp | 47 +- Examples/IPlugFaustDSP/IPlugFaustDSP.h | 5 +- .../IPlugFaustDSP/resources/AUv3Framework.h | 4 +- Examples/IPlugInstrument/IPlugInstrument.cpp | 93 ++- Examples/IPlugInstrument/IPlugInstrument.h | 6 +- .../IPlugInstrument/IPlugInstrument_DSP.h | 106 ++- .../IPlugInstrument/resources/AUv3Framework.h | 4 +- Examples/IPlugMidiEffect/IPlugMidiEffect.cpp | 38 +- .../IPlugMidiEffect/resources/AUv3Framework.h | 4 +- Examples/IPlugOSCEditor/IPlugOSCEditor.cpp | 93 +-- Examples/IPlugOSCEditor/IPlugOSCEditor.h | 4 +- .../IPlugOSCEditor/resources/AUv3Framework.h | 4 +- .../IPlugReaperExtension.cpp | 99 +-- .../IPlugReaperExtension.h | 3 +- .../IPlugResponsiveUI/IPlugResponsiveUI.cpp | 59 +- .../IPlugResponsiveUI/IPlugResponsiveUI.h | 9 +- .../resources/AUv3Framework.h | 4 +- Examples/IPlugSideChain/IPlugSideChain.cpp | 64 +- Examples/IPlugSideChain/IPlugSideChain.h | 2 +- Examples/IPlugSideChain/config.h | 3 +- .../IPlugSideChain/resources/AUv3Framework.h | 4 +- .../IPlugSurroundEffect.cpp | 26 +- .../IPlugSurroundEffect/IPlugSurroundEffect.h | 2 +- .../resources/AUv3Framework.h | 4 +- Examples/IPlugSwiftUI/IPlugSwiftUI-Shared.h | 2 +- Examples/IPlugSwiftUI/IPlugSwiftUI.h | 2 +- .../IPlugSwiftUI/resources/AUv3Framework.h | 4 +- Examples/IPlugWebUI/IPlugWebUI.cpp | 30 +- Examples/IPlugWebUI/IPlugWebUI.h | 4 +- Examples/IPlugWebUI/resources/AUv3Framework.h | 4 +- .../IGraphicsStressTest.cpp | 209 +++--- .../IGraphicsStressTest/IGraphicsStressTest.h | 1 + .../resources/AUv3Framework.h | 4 +- Tests/IGraphicsTest/IGraphicsTest.cpp | 159 +++-- Tests/IGraphicsTest/IGraphicsTest.h | 2 +- Tests/IGraphicsTest/resources/AUv3Framework.h | 4 +- Tests/MetaParamTest/MetaParamTest.cpp | 131 ++-- Tests/MetaParamTest/resources/AUv3Framework.h | 4 +- 59 files changed, 1175 insertions(+), 1655 deletions(-) diff --git a/Examples/IPlugChunks/IPlugChunks.cpp b/Examples/IPlugChunks/IPlugChunks.cpp index c5ad40a659..9a245a0713 100644 --- a/Examples/IPlugChunks/IPlugChunks.cpp +++ b/Examples/IPlugChunks/IPlugChunks.cpp @@ -9,10 +9,8 @@ IPlugChunks::IPlugChunks(const InstanceInfo& info) GetParam(kParamGain)->InitDouble("Gain", 0., 0., 100.0, 0.01, "%"); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); @@ -21,10 +19,10 @@ IPlugChunks::IPlugChunks(const InstanceInfo& info) const IVStyle style = DEFAULT_STYLE.WithDrawShadows(false); pGraphics->AttachControl(new IVBakedPresetManagerControl(b.ReduceFromTop(30.f), style)); pGraphics->AttachControl(new IVMultiSliderControl(b, "", style), kCtrlMultiSlider)->SetActionFunction([pGraphics](IControl* pCaller) { - double vals[kNumSteps]; - for (int i = 0; i < kNumSteps; i++) { + for (int i = 0; i < kNumSteps; i++) + { vals[i] = pCaller->GetValue(i); } pGraphics->GetDelegate()->SendArbitraryMsgFromUI(kMsgTagSliderChanged, kCtrlMultiSlider, sizeof(vals), &vals); @@ -33,33 +31,33 @@ IPlugChunks::IPlugChunks(const InstanceInfo& info) #endif } -bool IPlugChunks::SerializeState(IByteChunk &chunk) const +bool IPlugChunks::SerializeState(IByteChunk& chunk) const { // serialize the multislider state state before serializing the regular params - for (int i = 0; i< kNumSteps; i++) + for (int i = 0; i < kNumSteps; i++) { chunk.Put(&mSteps[i]); } - + return SerializeParams(chunk); // must remember to call SerializeParams at the end } // this over-ridden method is called when the host is trying to load the plug-in state and you need to unpack the data into your algorithm -int IPlugChunks::UnserializeState(const IByteChunk &chunk, int startPos) +int IPlugChunks::UnserializeState(const IByteChunk& chunk, int startPos) { double v = 0.; - + // unserialize the steps state before unserializing the regular params - for (int i = 0; i< kNumSteps; i++) + for (int i = 0; i < kNumSteps; i++) { startPos = chunk.Get(&v, startPos); mSteps[i] = v; } - + // If UI exists - if(GetUI()) + if (GetUI()) UpdateUIControls(); - + // must remember to call UnserializeParams at the end return UnserializeParams(chunk, startPos); } @@ -67,47 +65,45 @@ int IPlugChunks::UnserializeState(const IByteChunk &chunk, int startPos) #if IPLUG_DSP void IPlugChunks::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { - int samplesPerBeat = (int) GetSamplesPerBeat(); - int samplePos = (int) GetSamplePos(); - + int samplesPerBeat = (int)GetSamplesPerBeat(); + int samplePos = (int)GetSamplePos(); + for (int s = 0; s < nFrames; s++) { int mod = (samplePos + s) % (samplesPerBeat * kBeatDiv); - + mStepPos = mod / (samplesPerBeat / kBeatDiv); - + if (mStepPos >= kNumSteps) { mStepPos = 0; } - - for (int c = 0; c < 2; c++) { + + for (int c = 0; c < 2; c++) + { outputs[c][s] = inputs[c][s]; } } } #endif -void IPlugChunks::OnUIOpen() -{ - UpdateUIControls(); -} +void IPlugChunks::OnUIOpen() { UpdateUIControls(); } void IPlugChunks::UpdateUIControls() { auto* pMultiSlider = GetUI()->GetControlWithTag(kCtrlMultiSlider); - - for (int i = 0; i< kNumSteps; i++) + + for (int i = 0; i < kNumSteps; i++) { pMultiSlider->SetValue(mSteps[i], i); } - + GetUI()->SetAllControlsDirty(); } bool IPlugChunks::OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pData) { - if(msgTag == kMsgTagSliderChanged) + if (msgTag == kMsgTagSliderChanged) { auto* pVals = reinterpret_cast(pData); memcpy(mSteps, pVals, kNumSteps * sizeof(double)); @@ -118,7 +114,7 @@ bool IPlugChunks::OnMessage(int msgTag, int ctrlTag, int dataSize, const void* p void IPlugChunks::OnIdle() { - if(mStepPos != mPrevPos) + if (mStepPos != mPrevPos) { mPrevPos = mStepPos; SendControlMsgFromDelegate(kCtrlMultiSlider, IVMultiSliderControl<>::kMsgTagSetHighlight, sizeof(int), &mPrevPos); diff --git a/Examples/IPlugChunks/IPlugChunks.h b/Examples/IPlugChunks/IPlugChunks.h index 6a29bceb53..1229d1afb9 100644 --- a/Examples/IPlugChunks/IPlugChunks.h +++ b/Examples/IPlugChunks/IPlugChunks.h @@ -30,10 +30,10 @@ class IPlugChunks final : public Plugin public: IPlugChunks(const InstanceInfo& info); - bool SerializeState(IByteChunk &chunk) const override; - int UnserializeState(const IByteChunk &chunk, int startPos) override; -// bool CompareState(const uint8_t* pIncomingState, int startPos) const override; - + bool SerializeState(IByteChunk& chunk) const override; + int UnserializeState(const IByteChunk& chunk, int startPos) override; + // bool CompareState(const uint8_t* pIncomingState, int startPos) const override; + void OnIdle() override; void OnUIOpen() override; bool OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pData) override; @@ -41,10 +41,10 @@ class IPlugChunks final : public Plugin #if IPLUG_DSP // http://bit.ly/2S64BDd void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; #endif - + private: void UpdateUIControls(); - + std::atomic mStepPos; int mPrevPos = -1; double mSteps[kNumSteps] = {}; diff --git a/Examples/IPlugChunks/resources/AUv3Framework.h b/Examples/IPlugChunks/resources/AUv3Framework.h index c10fd04411..50b83144d6 100644 --- a/Examples/IPlugChunks/resources/AUv3Framework.h +++ b/Examples/IPlugChunks/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugCocoaUI/IPlugCocoaUI-Shared.h b/Examples/IPlugCocoaUI/IPlugCocoaUI-Shared.h index fd3bfe7187..115b623f4f 100644 --- a/Examples/IPlugCocoaUI/IPlugCocoaUI-Shared.h +++ b/Examples/IPlugCocoaUI/IPlugCocoaUI-Shared.h @@ -6,7 +6,7 @@ const NSInteger kNumPresets = 3; const NSInteger kParamGain = 0; const NSInteger kNumParams = 1; -//tags in interface builder default to 0, so avoid using that control tag +// tags in interface builder default to 0, so avoid using that control tag const NSInteger kCtrlTagVolumeSlider = 1; const NSInteger kCtrlTagButton = 2; const NSInteger kCtrlTagVUMeter = 3; @@ -15,7 +15,7 @@ const NSInteger kUpdateMessage = 0; const NSInteger kMsgTagHello = 1; const NSInteger kMsgTagRestorePreset = 2; -const NSInteger kDataPacketSize = 1024; //floats +const NSInteger kDataPacketSize = 1024; // floats #endif diff --git a/Examples/IPlugCocoaUI/IPlugCocoaUI.h b/Examples/IPlugCocoaUI/IPlugCocoaUI.h index 6726bb96a3..3d42e2d989 100644 --- a/Examples/IPlugCocoaUI/IPlugCocoaUI.h +++ b/Examples/IPlugCocoaUI/IPlugCocoaUI.h @@ -10,17 +10,16 @@ class IPlugCocoaUI final : public Plugin public: IPlugCocoaUI(const InstanceInfo& info); ~IPlugCocoaUI(); - + void* OpenWindow(void* pParent) override; - + void OnParentWindowResize(int width, int height) override; bool OnHostRequestingSupportedViewConfiguration(int width, int height) override; bool OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pData) override; void OnParamChange(int paramIdx) override; void OnIdle() override; void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; - + private: - IPeakSender<> mSender; }; diff --git a/Examples/IPlugCocoaUI/resources/AUv3Framework.h b/Examples/IPlugCocoaUI/resources/AUv3Framework.h index 3959f18701..0514abce13 100644 --- a/Examples/IPlugCocoaUI/resources/AUv3Framework.h +++ b/Examples/IPlugCocoaUI/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif #import diff --git a/Examples/IPlugControls/IPlugControls.cpp b/Examples/IPlugControls/IPlugControls.cpp index 0f3292743b..f2e89976c8 100644 --- a/Examples/IPlugControls/IPlugControls.cpp +++ b/Examples/IPlugControls/IPlugControls.cpp @@ -13,18 +13,16 @@ IPlugControls::IPlugControls(const InstanceInfo& info) GetParam(kParamFreq2)->InitDouble("Freq 2 - Y", 0.5, 0.001, 10., 0.01, "Hz", IParam::kFlagsNone, "", IParam::ShapePowCurve(1.)); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { - if(pGraphics->NControls()) + if (pGraphics->NControls()) { - //Could handle new layout here + // Could handle new layout here return; } - -// pGraphics->EnableLiveEdit(true); + + // pGraphics->EnableLiveEdit(true); pGraphics->EnableMouseOver(true); pGraphics->EnableMultiTouch(true); pGraphics->EnableTooltips(true); @@ -32,14 +30,14 @@ IPlugControls::IPlugControls(const InstanceInfo& info) pGraphics->AttachCornerResizer(EUIResizerMode::Scale, true); pGraphics->AttachPanelBackground(mBGControlPattern); pGraphics->AttachTextEntryControl(); - -#ifndef OS_IOS + + #ifndef OS_IOS pGraphics->AttachPopupMenuControl(DEFAULT_LABEL_TEXT); -#endif + #endif pGraphics->AttachBubbleControl(); - + IRECT b = pGraphics->GetBounds().GetPadded(-5); - + pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->LoadFont("ForkAwesome", FORK_AWESOME_FN); pGraphics->LoadFont("Fontaudio", FONTAUDIO_FN); @@ -56,8 +54,8 @@ IPlugControls::IPlugControls(const InstanceInfo& info) const ISVG hsliderHandleSVG = pGraphics->LoadSVG(SVGHSLIDERHANDLE_FN); const ISVG hsliderTrackSVG = pGraphics->LoadSVG(SVGHSLIDERTRACK_FN); const ISVG knobSVG = pGraphics->LoadSVG(SVGKNOBROTATE_FN); - - const IVStyle style { + + const IVStyle style{ true, // Show label true, // Show value { @@ -69,330 +67,361 @@ IPlugControls::IPlugControls(const InstanceInfo& info) DEFAULT_SHCOLOR, // Shadow COLOR_BLACK, // Extra 1 DEFAULT_X2COLOR, // Extra 2 - DEFAULT_X3COLOR // Extra 3 + DEFAULT_X3COLOR // Extra 3 }, // Colors IText(12.f, EAlign::Center) // Label text }; - - const IText forkAwesomeText {16.f, "ForkAwesome"}; - const IText bigLabel {24, COLOR_WHITE, "Roboto-Regular", EAlign::Near, EVAlign::Top, 0}; - const IText fontaudioText {32.f, "Fontaudio"}; + + const IText forkAwesomeText{16.f, "ForkAwesome"}; + const IText bigLabel{24, COLOR_WHITE, "Roboto-Regular", EAlign::Near, EVAlign::Top, 0}; + const IText fontaudioText{32.f, "Fontaudio"}; const int nRows = 5; const int nCols = 8; - + int cellIdx = -1; - - auto nextCell = [&](){ - return b.GetGridCell(++cellIdx, nRows, nCols).GetPadded(-5.); - }; - auto sameCell = [&](){ - return b.GetGridCell(cellIdx, nRows, nCols).GetPadded(-5.); - }; - - auto AddLabel = [&](const char* label){ - pGraphics->AttachControl(new ITextControl(nextCell().GetFromTop(20.f), label, style.labelText)); - }; - - -#pragma mark MiscControls - - + auto nextCell = [&]() { return b.GetGridCell(++cellIdx, nRows, nCols).GetPadded(-5.); }; + + auto sameCell = [&]() { return b.GetGridCell(cellIdx, nRows, nCols).GetPadded(-5.); }; + + auto AddLabel = [&](const char* label) { pGraphics->AttachControl(new ITextControl(nextCell().GetFromTop(20.f), label, style.labelText)); }; + + + #pragma mark MiscControls - + AddLabel("ITextControl"); pGraphics->AttachControl(new ITextControl(sameCell().SubRectVertical(4, 1).GetMidVPadded(10.f), "Result...", DEFAULT_TEXT, COLOR_LIGHT_GRAY), kCtrlTagDialogResult, "misccontrols"); - + pGraphics->AttachControl(new IURLControl(sameCell().SubRectVertical(4, 2).GetMidVPadded(10.f), "IURLControl", "https://iplug2.github.io", DEFAULT_TEXT), kNoTag, "misccontrols"); pGraphics->AttachControl(new IEditableTextControl(sameCell().SubRectVertical(4, 3).GetMidVPadded(10.f), "IEditableTextControl", DEFAULT_TEXT), kNoTag, "misccontrols"); - + AddLabel("ITextToggleControl"); - pGraphics->AttachControl(new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 0, 3, 3), nullptr, ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE, forkAwesomeText), kNoTag, "misccontrols"); - pGraphics->AttachControl(new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 1, 3, 3), nullptr, ICON_FK_CIRCLE_O, ICON_FK_CHECK_CIRCLE, forkAwesomeText), kNoTag, "misccontrols"); - pGraphics->AttachControl(new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 2, 3, 3), nullptr, ICON_FK_PLUS_SQUARE, ICON_FK_MINUS_SQUARE, forkAwesomeText), kNoTag, "misccontrols"); + pGraphics->AttachControl( + new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 0, 3, 3), nullptr, ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE, forkAwesomeText), kNoTag, "misccontrols"); + pGraphics->AttachControl( + new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 1, 3, 3), nullptr, ICON_FK_CIRCLE_O, ICON_FK_CHECK_CIRCLE, forkAwesomeText), kNoTag, "misccontrols"); + pGraphics->AttachControl( + new ITextToggleControl(sameCell().SubRectVertical(4, 1).GetGridCell(1, 2, 3, 3), nullptr, ICON_FK_PLUS_SQUARE, ICON_FK_MINUS_SQUARE, forkAwesomeText), kNoTag, "misccontrols"); pGraphics->AttachControl(new IRTTextControl<1, float>(sameCell().SubRectVertical(4, 2), "IRTTextControl: %0.2f", ":", "IRTTextControl"), kCtrlTagRTText); AddLabel("ICaptionControl"); pGraphics->AttachControl(new ICaptionControl(sameCell().SubRectVertical(4, 1).GetMidVPadded(10.f), kParamGain, IText(24.f), DEFAULT_FGCOLOR, false), kNoTag, "misccontrols"); pGraphics->AttachControl(new ICaptionControl(sameCell().SubRectVertical(4, 2).GetMidVPadded(10.f), kParamMode, IText(24.f), DEFAULT_FGCOLOR, false), kNoTag, "misccontrols"); - - //pGraphics->AttachControl(new IVGroupControl("Misc Controls", "misccontrols", 5.f, 35.f, 10.f, 15.f)); -#pragma mark IBControls - - + // pGraphics->AttachControl(new IVGroupControl("Misc Controls", "misccontrols", 5.f, 35.f, 10.f, 15.f)); + + #pragma mark IBControls - + AddLabel("IBKnobControl"); pGraphics->AttachControl(new IBKnobControl(sameCell().GetPadded(-5.), knobBitmap, kParamGain), kNoTag, "bcontrols"); AddLabel("IBKnobRotaterControl"); pGraphics->AttachControl(new IBKnobRotaterControl(sameCell().GetPadded(-5.), knobRotateBitmap, kParamGain), kNoTag, "bcontrols"); AddLabel("IBButtonControl"); - pGraphics->AttachControl(new IBButtonControl(sameCell().FracRectVertical(0.6f, true), buttonBitmap, [](IControl* pCaller) { - pCaller->SetAnimation([](IControl* pCaller){ - auto progress = pCaller->GetAnimationProgress(); - if(progress > 1.) { - pCaller->OnEndAnimation(); - return; - } - pCaller->SetValue(Clip(progress + .5, 0., 1.)); - }, 100); - }), kNoTag, "bcontrols"); -// AddLabel("IBSwitchControl"); + pGraphics->AttachControl(new IBButtonControl(sameCell().FracRectVertical(0.6f, true), buttonBitmap, + [](IControl* pCaller) { + pCaller->SetAnimation( + [](IControl* pCaller) { + auto progress = pCaller->GetAnimationProgress(); + if (progress > 1.) + { + pCaller->OnEndAnimation(); + return; + } + pCaller->SetValue(Clip(progress + .5, 0., 1.)); + }, + 100); + }), + kNoTag, "bcontrols"); + // AddLabel("IBSwitchControl"); pGraphics->AttachControl(new ITextControl(sameCell().FracRectVertical(0.5f, false).GetFromTop(20.f), "IBSwitchControl", style.labelText)); pGraphics->AttachControl(new IBSwitchControl(sameCell().FracRectVertical(0.5f, false), switchBitmap), kNoTag, "bcontrols"); AddLabel("IBSliderControl"); - pGraphics->AttachControl(new IBSliderControl(sameCell().GetCentredInside((float) sliderHandleBitmap.W(), 100.f), sliderHandleBitmap, sliderTrackBitmap, kParamGain, EDirection::Vertical), kNoTag, "bcontrols"); - //pGraphics->AttachControl(new IVGroupControl("Bitmap Controls", "bcontrols", 10.f, 30.f, 30.f, 10.f)); + pGraphics->AttachControl( + new IBSliderControl(sameCell().GetCentredInside((float)sliderHandleBitmap.W(), 100.f), sliderHandleBitmap, sliderTrackBitmap, kParamGain, EDirection::Vertical), kNoTag, "bcontrols"); + // pGraphics->AttachControl(new IVGroupControl("Bitmap Controls", "bcontrols", 10.f, 30.f, 30.f, 10.f)); AddLabel("IBTextControl"); pGraphics->AttachControl(new IBTextControl(sameCell(), bitmapText, DEFAULT_LABEL_TEXT, "HELLO", 10, 16, 0, false)); -#pragma mark ISVGControls - - + #pragma mark ISVGControls - + AddLabel("ISVGKnobControl"); pGraphics->AttachControl(new ISVGKnobControl(sameCell().GetCentredInside(100), knobSVG, kParamGain), kNoTag, "svgcontrols"); - + AddLabel("ISVGSliderControl"); pGraphics->AttachControl(new ISVGSliderControl(sameCell().GetCentredInside(30, 100), sliderHandleSVG, sliderTrackSVG, kParamGain, EDirection::Vertical), kNoTag, "svgcontrols"); - //pGraphics->AttachControl(new IVGroupControl("SVG Controls", "svgcontrols", 10.f, 30.f, 10.f, 10.f)); + // pGraphics->AttachControl(new IVGroupControl("SVG Controls", "svgcontrols", 10.f, 30.f, 10.f, 10.f)); -#pragma mark IVControls - + #pragma mark IVControls - pGraphics->AttachControl(new IVKnobControl(nextCell().GetCentredInside(110.), kParamGain, "IVKnobControl", style, true), kNoTag, "vcontrols"); - - pGraphics->AttachControl(new IVSliderControl(nextCell(), kParamGain, "IVSliderControl", style.WithRoundness(1.f), true, EDirection::Vertical, DEFAULT_GEARING, 6.f, 6.f, true), kCtrlTagVectorSliderV, "vcontrols"); + + pGraphics->AttachControl( + new IVSliderControl(nextCell(), kParamGain, "IVSliderControl", style.WithRoundness(1.f), true, EDirection::Vertical, DEFAULT_GEARING, 6.f, 6.f, true), kCtrlTagVectorSliderV, "vcontrols"); pGraphics->AttachControl(new IVSliderControl(nextCell().SubRectVertical(3, 0), kParamGain, "IVSliderControl H", style, true, EDirection::Horizontal), kCtrlTagVectorSliderH, "vcontrols"); - pGraphics->AttachControl(new IVRangeSliderControl(sameCell().SubRectVertical(3, 1), {kParamFreq1, kParamFreq2}, "IVRangeSliderControl", style, EDirection::Horizontal, true, 8.f, 2.f), kNoTag, "vcontrols"); - pGraphics->AttachControl(new ISVGSliderControl(sameCell().SubRectVertical(3, 2), hsliderHandleSVG, hsliderTrackSVG, kParamGain, EDirection::Horizontal), kNoTag, "svgcontrols")->SetTooltip("ISVGSlider H"); - + pGraphics->AttachControl( + new IVRangeSliderControl(sameCell().SubRectVertical(3, 1), {kParamFreq1, kParamFreq2}, "IVRangeSliderControl", style, EDirection::Horizontal, true, 8.f, 2.f), kNoTag, "vcontrols"); + pGraphics->AttachControl(new ISVGSliderControl(sameCell().SubRectVertical(3, 2), hsliderHandleSVG, hsliderTrackSVG, kParamGain, EDirection::Horizontal), kNoTag, "svgcontrols") + ->SetTooltip("ISVGSlider H"); + auto button1action = [pGraphics](IControl* pCaller) { SplashClickActionFunc(pCaller); pGraphics->ShowMessageBox("Message Title", "Message", kMB_YESNO, [&](EMsgBoxResult result) { - WDL_String str; - str.SetFormatted(32, "%s pressed", kMessageResultStrs[result]); - pGraphics->GetControlWithTag(kCtrlTagDialogResult)->As()->SetStr(str.Get()); - }); + WDL_String str; + str.SetFormatted(32, "%s pressed", kMessageResultStrs[result]); + pGraphics->GetControlWithTag(kCtrlTagDialogResult)->As()->SetStr(str.Get()); + }); }; - + pGraphics->AttachControl(new IVButtonControl(nextCell().SubRectVertical(3, 0), button1action, "IVButtonControl", style, false), kCtrlTagVectorButton, "vcontrols"); pGraphics->AttachControl(new IVButtonControl(sameCell().SubRectVertical(3, 1), button1action, "Label in button", style, true), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVButtonControl(sameCell().SubRectVertical(3, 2), [pGraphics](IControl* pCaller){ - SplashClickActionFunc(pCaller); - static IPopupMenu menu {"Menu", {"one", "two", "three"}, [pCaller](IPopupMenu* pMenu) { - auto* itemChosen = pMenu->GetChosenItem(); - if(itemChosen) - pCaller->As()->SetValueStr(itemChosen->GetText()); - } - }; - - float x, y; - pGraphics->GetMouseDownPoint(x, y); - pGraphics->CreatePopupMenu(*pCaller, menu, x, y); - - }, "", style.WithValueText(IText(24.f, EVAlign::Middle)), false, true), kNoTag, "vcontrols"); - pGraphics->GetControl(pGraphics->NControls()-1)->As()->SetValueStr("one"); - + pGraphics->AttachControl(new IVButtonControl( + sameCell().SubRectVertical(3, 2), + [pGraphics](IControl* pCaller) { + SplashClickActionFunc(pCaller); + static IPopupMenu menu{"Menu", {"one", "two", "three"}, [pCaller](IPopupMenu* pMenu) { + auto* itemChosen = pMenu->GetChosenItem(); + if (itemChosen) + pCaller->As()->SetValueStr(itemChosen->GetText()); + }}; + + float x, y; + pGraphics->GetMouseDownPoint(x, y); + pGraphics->CreatePopupMenu(*pCaller, menu, x, y); + }, + "", style.WithValueText(IText(24.f, EVAlign::Middle)), false, true), + kNoTag, "vcontrols"); + pGraphics->GetControl(pGraphics->NControls() - 1)->As()->SetValueStr("one"); + pGraphics->AttachControl(new IVSwitchControl(nextCell().SubRectVertical(3, 0), kParamMode, "IVSwitchControl", style.WithValueText(IText(24.f, EAlign::Center))), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVToggleControl(sameCell().SubRectVertical(3, 1), SplashClickActionFunc, "IVToggleControl", style.WithValueText(forkAwesomeText), "", ICON_FK_CHECK), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVRadioButtonControl(nextCell().GetCentredInside(110.), kParamMode, {"one", "two", "three", "four"}, "IVRadioButtonControl", style, EVShape::Ellipse, EDirection::Vertical, 10.f), kCtrlTagRadioButton, "vcontrols"); - pGraphics->AttachControl(new IVTabSwitchControl(nextCell().SubRectVertical(3, 0), SplashClickActionFunc, {ICON_FAU_FILTER_LOWPASS, ICON_FAU_FILTER_BANDPASS, ICON_FAU_FILTER_HIGHPASS}, "IVTabSwitchControl", style.WithValueText(fontaudioText), EVShape::EndsRounded), kCtrlTagTabSwitch, "vcontrols"); + pGraphics->AttachControl( + new IVToggleControl(sameCell().SubRectVertical(3, 1), SplashClickActionFunc, "IVToggleControl", style.WithValueText(forkAwesomeText), "", ICON_FK_CHECK), kNoTag, "vcontrols"); + pGraphics->AttachControl( + new IVRadioButtonControl(nextCell().GetCentredInside(110.), kParamMode, {"one", "two", "three", "four"}, "IVRadioButtonControl", style, EVShape::Ellipse, EDirection::Vertical, 10.f), + kCtrlTagRadioButton, "vcontrols"); + pGraphics->AttachControl(new IVTabSwitchControl(nextCell().SubRectVertical(3, 0), SplashClickActionFunc, {ICON_FAU_FILTER_LOWPASS, ICON_FAU_FILTER_BANDPASS, ICON_FAU_FILTER_HIGHPASS}, + "IVTabSwitchControl", style.WithValueText(fontaudioText), EVShape::EndsRounded), + kCtrlTagTabSwitch, "vcontrols"); pGraphics->AttachControl(new IVSlideSwitchControl(sameCell().SubRectVertical(3, 1), kParamMode, "IVSlideSwitchControl", style, true), kNoTag, "vcontrols"); pGraphics->AttachControl(new IVXYPadControl(nextCell(), {kParamFreq1, kParamFreq2}, "IVXYPadControl", style), kNoTag, "vcontrols"); pGraphics->AttachControl(new IVMultiSliderControl<4>(nextCell(), "IVMultiSliderControl", style), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVMeterControl<2>(nextCell(), "IVMeterControl - Lin", style.WithColor(kFG, COLOR_WHITE.WithOpacity(0.3f)), EDirection::Vertical, {"L", "R"}), kCtrlTagMeter, "vcontrols"); + pGraphics->AttachControl( + new IVMeterControl<2>(nextCell(), "IVMeterControl - Lin", style.WithColor(kFG, COLOR_WHITE.WithOpacity(0.3f)), EDirection::Vertical, {"L", "R"}), kCtrlTagMeter, "vcontrols"); pGraphics->AttachControl(new IVPeakAvgMeterControl<2>(nextCell(), "IVPeakAvgMeterControl - Log", style.WithColor(kFG, COLOR_WHITE.WithOpacity(0.3f))), kCtrlTagPeakAvgMeter, "vcontrols"); - pGraphics->AttachControl(new IVScopeControl<2, kScopeBufferSize*2>(nextCell(), "IVScopeControl", style.WithColor(kFG, COLOR_BLACK)), kCtrlTagScope, "vcontrols"); + pGraphics->AttachControl(new IVScopeControl<2, kScopeBufferSize * 2>(nextCell(), "IVScopeControl", style.WithColor(kFG, COLOR_BLACK)), kCtrlTagScope, "vcontrols"); pGraphics->AttachControl(new IVDisplayControl(nextCell(), "IVDisplayControl", style, EDirection::Vertical, -1., 1., 0., 512), kCtrlTagDisplay, "vcontrols"); pGraphics->AttachControl(new IVLabelControl(nextCell().SubRectVertical(3, 0).GetMidVPadded(10.f), "IVLabelControl"), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVColorSwatchControl(sameCell().SubRectVertical(3, 1), "IVColorSwatchControl", [](int, IColor){}, style, IVColorSwatchControl::ECellLayout::kHorizontal, {kX1, kX2, kX3}, {"", "", ""}), kNoTag, "vcontrols"); + pGraphics->AttachControl( + new IVColorSwatchControl(sameCell().SubRectVertical(3, 1), "IVColorSwatchControl", [](int, IColor) {}, style, IVColorSwatchControl::ECellLayout::kHorizontal, {kX1, kX2, kX3}, {"", "", ""}), + kNoTag, "vcontrols"); pGraphics->AttachControl(new IVNumberBoxControl(sameCell().SubRectVertical(3, 2), kParamGain, nullptr, "IVNumberBoxControl", style), kNoTag, "vcontrols"); - pGraphics->AttachControl(new IVPlotControl(nextCell(), {{COLOR_RED, [](double x){ return std::sin(x * 6.2);} }, - {COLOR_BLUE, [](double x){ return std::cos(x * 6.2);} }, - {COLOR_GREEN, [](double x){ return x > 0.5;} } + pGraphics->AttachControl( + new IVPlotControl(nextCell(), + {{COLOR_RED, [](double x) { return std::sin(x * 6.2); }}, {COLOR_BLUE, [](double x) { return std::cos(x * 6.2); }}, {COLOR_GREEN, [](double x) { return x > 0.5; }} - }, 32, "IVPlotControl", style), kNoTag, "vcontrols"); + }, + 32, "IVPlotControl", style), + kNoTag, "vcontrols"); IRECT wideCell; wideCell = nextCell().Union(nextCell()).Union(nextCell()).Union(nextCell()); pGraphics->AttachControl(new ITextControl(wideCell.GetFromTop(20.f), "IVKeyboardControl", style.labelText)); pGraphics->AttachControl(new IWheelControl(wideCell.GetFromLeft(25.f).GetMidVPadded(40.f))); - pGraphics->AttachControl(new IVKeyboardControl(wideCell.GetPadded(-25), 36, 72), kNoTag)->SetActionFunction([this](IControl* pControl){ - this->FlashBlueLED(); - }); - + pGraphics->AttachControl(new IVKeyboardControl(wideCell.GetPadded(-25), 36, 72), kNoTag)->SetActionFunction([this](IControl* pControl) { this->FlashBlueLED(); }); + AddLabel("ILEDControl"); pGraphics->AttachControl(new ILEDControl(sameCell().SubRectVertical(4, 1).SubRectHorizontal(3, 0).GetCentredInside(20.f), COLOR_RED), kCtrlTagRedLED); pGraphics->AttachControl(new ILEDControl(sameCell().SubRectVertical(4, 1).SubRectHorizontal(3, 1).GetCentredInside(20.f), COLOR_GREEN), kCtrlTagGreenLED); pGraphics->AttachControl(new ILEDControl(sameCell().SubRectVertical(4, 1).SubRectHorizontal(3, 2).GetCentredInside(20.f), 0.5f), kCtrlTagBlueLED); -// #pragma mark IWebViewControl - -// -// AddLabel("IWebViewControl"); -// -// auto readyFunc = [](IWebViewControl* pCaller){ -// pCaller->LoadHTML(R"()"); -// }; -// -// auto msgFunc = [](IWebViewControl* pCaller, const char* json){ -// auto j = json::parse(json, nullptr, false); -// pCaller->GetUI()->GetBackgroundControl()->As()->SetPattern(IColor::GetRandomColor()); -// }; -// -// pGraphics->AttachControl(new IWebViewControl(b.GetCentredInside(200), false, readyFunc, msgFunc, "C:\\Users\\oli\\Dev\\iPlug2\\Examples\\IPlugControls\\WebView2Loader.dll", "C:\\Users\\oli\\Dev\\iPlug2\\Examples\\IPlugControls\\")); - -// pGraphics->AttachControl(new IVButtonControl(b.GetFromTRHC(50, 50)))->SetAnimationEndActionFunction([b](IControl* pCaller){ -// /* TODO: get webview control */->EvaluateJavaScript(R"(document.body.style.background = "#000";)"); -// }); - - //pGraphics->AttachControl(new IVGroupControl("Vector Controls", "vcontrols", 10.f, 30.f, 10.f, 10.f)); + // #pragma mark IWebViewControl - + // + // AddLabel("IWebViewControl"); + // + // auto readyFunc = [](IWebViewControl* pCaller){ + // pCaller->LoadHTML(R"()"); + // }; + // + // auto msgFunc = [](IWebViewControl* pCaller, const char* json){ + // auto j = json::parse(json, nullptr, false); + // pCaller->GetUI()->GetBackgroundControl()->As()->SetPattern(IColor::GetRandomColor()); + // }; + // + // pGraphics->AttachControl(new IWebViewControl(b.GetCentredInside(200), false, readyFunc, msgFunc, "C:\\Users\\oli\\Dev\\iPlug2\\Examples\\IPlugControls\\WebView2Loader.dll", + // "C:\\Users\\oli\\Dev\\iPlug2\\Examples\\IPlugControls\\")); + + // pGraphics->AttachControl(new IVButtonControl(b.GetFromTRHC(50, 50)))->SetAnimationEndActionFunction([b](IControl* pCaller){ + // /* TODO: get webview control */->EvaluateJavaScript(R"(document.body.style.background = "#000";)"); + // }); + + // pGraphics->AttachControl(new IVGroupControl("Vector Controls", "vcontrols", 10.f, 30.f, 10.f, 10.f)); AddLabel("ILambdaControl"); - pGraphics->AttachControl(new ILambdaControl(sameCell().GetScaledAboutCentre(0.5), - [](ILambdaControl* pCaller, IGraphics& g, IRECT& r) { - const float radius = r.W(); - const float x = r.MW(); - const float y = r.MH(); - const float rotate = float(pCaller->GetAnimationProgress() * PI); - - for(int index = 0, limit = 40; index < limit; ++index) - { - float firstAngle = float ((index * 2 * PI) / limit); - float secondAngle = float (((index + 1) * 2 * PI) / limit); - - g.PathTriangle(x, y, - x + std::sin(firstAngle + rotate) * radius, y + std::cos(firstAngle + rotate) * radius, - x + std::sin(secondAngle + rotate) * radius, y + std::cos(secondAngle + rotate) * radius); - - if(index % 2) - g.PathFill(COLOR_RED); - else - g.PathFill(pCaller->mMouseInfo.ms.L ? COLOR_VIOLET : COLOR_BLUE); - } - - }, 1000, false)); - - #pragma mark IVControl panel - + pGraphics->AttachControl(new ILambdaControl( + sameCell().GetScaledAboutCentre(0.5), + [](ILambdaControl* pCaller, IGraphics& g, IRECT& r) { + const float radius = r.W(); + const float x = r.MW(); + const float y = r.MH(); + const float rotate = float(pCaller->GetAnimationProgress() * PI); + + for (int index = 0, limit = 40; index < limit; ++index) + { + float firstAngle = float((index * 2 * PI) / limit); + float secondAngle = float(((index + 1) * 2 * PI) / limit); + + g.PathTriangle( + x, y, x + std::sin(firstAngle + rotate) * radius, y + std::cos(firstAngle + rotate) * radius, x + std::sin(secondAngle + rotate) * radius, y + std::cos(secondAngle + rotate) * radius); + + if (index % 2) + g.PathFill(COLOR_RED); + else + g.PathFill(pCaller->mMouseInfo.ms.L ? COLOR_VIOLET : COLOR_BLUE); + } + }, + 1000, false)); + + #pragma mark IVControl panel - cellIdx = 31; - + nextCell(); - + int slider = 0; - + pGraphics->AttachControl(new IPanelControl(b.GetGridCell(4, 5, 1), COLOR_MID_GRAY)); - - for(auto label : {"Widget Frac", "Roundness", "Shadow Offset", "Frame Thickness", "Angle"}) + + for (auto label : {"Widget Frac", "Roundness", "Shadow Offset", "Frame Thickness", "Angle"}) { - pGraphics->AttachControl(new IVSliderControl(sameCell().GetGridCell(slider, 0, 5, 1), [pGraphics, slider](IControl* pCaller){ - SplashClickActionFunc(pCaller); - pGraphics->ForControlInGroup("vcontrols", [pCaller, slider](IControl* pControl) { - - IVectorBase* pVControl = pControl->As(); - float val = static_cast(pCaller->GetValue()); - - switch (slider) { - case 0 : pVControl->SetWidgetFrac(val); break; - case 1 : pVControl->SetRoundness(val); break; - case 2 : pVControl->SetShadowOffset(val * 5.f); break; - case 3 : pVControl->SetFrameThickness(val * 5.f); break; - case 4 : pVControl->SetAngle(val * 360.f); break; - default: break; - } - }); - }, label, style, true, EDirection::Horizontal))->SetValue(slider == 0 ? 1.f : 0.f); - + pGraphics + ->AttachControl(new IVSliderControl( + sameCell().GetGridCell(slider, 0, 5, 1), + [pGraphics, slider](IControl* pCaller) { + SplashClickActionFunc(pCaller); + pGraphics->ForControlInGroup("vcontrols", [pCaller, slider](IControl* pControl) { + IVectorBase* pVControl = pControl->As(); + float val = static_cast(pCaller->GetValue()); + + switch (slider) + { + case 0: pVControl->SetWidgetFrac(val); break; + case 1: pVControl->SetRoundness(val); break; + case 2: pVControl->SetShadowOffset(val * 5.f); break; + case 3: pVControl->SetFrameThickness(val * 5.f); break; + case 4: pVControl->SetAngle(val * 360.f); break; + default: break; + } + }); + }, + label, style, true, EDirection::Horizontal)) + ->SetValue(slider == 0 ? 1.f : 0.f); + slider++; } - + nextCell(); - + int toggle = 0; - + IRECT toggleRects = sameCell().FracRectHorizontal(0.49f); - for(auto label : {"Frame", "Shadows", "Emboss", "Show Label", "Show Value"}) + for (auto label : {"Frame", "Shadows", "Emboss", "Show Label", "Show Value"}) { - pGraphics->AttachControl(new IVToggleControl(toggleRects.GetGridCell(toggle, 0, 5, 1), [pGraphics, toggle](IControl* pCaller){ - SplashClickActionFunc(pCaller); - pGraphics->ForControlInGroup("vcontrols", [pCaller, toggle](IControl* pControl) { - - IVectorBase* pVControl = pControl->As(); - bool val = (bool) pCaller->GetValue(); - - switch (toggle) { - case 0 : pVControl->SetDrawFrame(val); break; - case 1 : pVControl->SetDrawShadows(val); break; - case 2 : pVControl->SetEmboss(val); break; - case 3 : pVControl->SetShowLabel(val); break; - case 4 : pVControl->SetShowValue(val); break; - default: break; - } - }); - }, label, style.WithValueText(forkAwesomeText.WithSize(12.f)).WithDrawFrame(false).WithDrawShadows(false), ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE, toggle == 2 ? false : true)); - + pGraphics->AttachControl(new IVToggleControl( + toggleRects.GetGridCell(toggle, 0, 5, 1), + [pGraphics, toggle](IControl* pCaller) { + SplashClickActionFunc(pCaller); + pGraphics->ForControlInGroup("vcontrols", [pCaller, toggle](IControl* pControl) { + IVectorBase* pVControl = pControl->As(); + bool val = (bool)pCaller->GetValue(); + + switch (toggle) + { + case 0: pVControl->SetDrawFrame(val); break; + case 1: pVControl->SetDrawShadows(val); break; + case 2: pVControl->SetEmboss(val); break; + case 3: pVControl->SetShowLabel(val); break; + case 4: pVControl->SetShowValue(val); break; + default: break; + } + }); + }, + label, style.WithValueText(forkAwesomeText.WithSize(12.f)).WithDrawFrame(false).WithDrawShadows(false), ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE, toggle == 2 ? false : true)); + toggle++; } - + toggle = 0; toggleRects = sameCell().FracRectHorizontal(0.49f, true); - for(auto label : {"Disable", "Show Bubble", "OS Text Entry", "OS Menu"}) + for (auto label : {"Disable", "Show Bubble", "OS Text Entry", "OS Menu"}) { - pGraphics->AttachControl(new IVToggleControl(toggleRects.GetGridCell(toggle, 0, 5, 1), [pGraphics, toggle](IControl* pCaller){ - SplashClickActionFunc(pCaller); - bool state = pCaller->GetValue() > 0.5f; - switch (toggle) { - case 0: - pGraphics->ForStandardControlsFunc([pCaller, toggle, state](IControl* pControl) { - if(pControl != pCaller) - pControl->SetDisabled(state); - }); - break; - case 1: - pGraphics->ForStandardControlsFunc([pCaller, toggle, state](IControl* pControl) { - if(pControl != pCaller && pControl->GetParamIdx() == kParamGain){ - pControl->SetActionFunction(state ? ShowBubbleHorizontalActionFunc : nullptr); - }}); - break; - case 2: - if(state) - pGraphics->RemoveTextEntryControl(); - else - pGraphics->AttachTextEntryControl(); - break; - case 3: - if(state) - pGraphics->RemovePopupMenuControl(); - else - pGraphics->AttachPopupMenuControl(); - break; - default: - break; - } - }, label, style.WithValueText(forkAwesomeText.WithSize(12.f)).WithDrawFrame(false).WithDrawShadows(false), ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE)); - + pGraphics->AttachControl(new IVToggleControl( + toggleRects.GetGridCell(toggle, 0, 5, 1), + [pGraphics, toggle](IControl* pCaller) { + SplashClickActionFunc(pCaller); + bool state = pCaller->GetValue() > 0.5f; + switch (toggle) + { + case 0: + pGraphics->ForStandardControlsFunc([pCaller, toggle, state](IControl* pControl) { + if (pControl != pCaller) + pControl->SetDisabled(state); + }); + break; + case 1: + pGraphics->ForStandardControlsFunc([pCaller, toggle, state](IControl* pControl) { + if (pControl != pCaller && pControl->GetParamIdx() == kParamGain) + { + pControl->SetActionFunction(state ? ShowBubbleHorizontalActionFunc : nullptr); + } + }); + break; + case 2: + if (state) + pGraphics->RemoveTextEntryControl(); + else + pGraphics->AttachTextEntryControl(); + break; + case 3: + if (state) + pGraphics->RemovePopupMenuControl(); + else + pGraphics->AttachPopupMenuControl(); + break; + default: break; + } + }, + label, style.WithValueText(forkAwesomeText.WithSize(12.f)).WithDrawFrame(false).WithDrawShadows(false), ICON_FK_SQUARE_O, ICON_FK_CHECK_SQUARE)); + toggle++; } - pGraphics->AttachControl(new IVRadioButtonControl(nextCell(), [pGraphics](IControl* pCaller) { - SplashClickActionFunc(pCaller); - EVShape shape = (EVShape) pCaller->As()->GetSelectedIdx(); - pGraphics->ForControlInGroup("vcontrols", [pCaller, shape](IControl* pControl) { - IVectorBase* pVControl = pControl->As(); - pVControl->SetShape(shape); - }); - }, {"Rect", "Ellipse", "Triangle", "EndsRounded", "AllRounded"}, "Shape", style, EVShape::Ellipse, EDirection::Vertical, 10.f), kNoTag); + pGraphics->AttachControl(new IVRadioButtonControl( + nextCell(), + [pGraphics](IControl* pCaller) { + SplashClickActionFunc(pCaller); + EVShape shape = (EVShape)pCaller->As()->GetSelectedIdx(); + pGraphics->ForControlInGroup("vcontrols", [pCaller, shape](IControl* pControl) { + IVectorBase* pVControl = pControl->As(); + pVControl->SetShape(shape); + }); + }, + {"Rect", "Ellipse", "Triangle", "EndsRounded", "AllRounded"}, "Shape", style, EVShape::Ellipse, EDirection::Vertical, 10.f), + kNoTag); auto setColors = [pGraphics](int cell, IColor color) { - pGraphics->ForControlInGroup("vcontrols", [cell, color](IControl* pControl) { - pControl->As()->SetColor(static_cast(cell), color); - }); + pGraphics->ForControlInGroup("vcontrols", [cell, color](IControl* pControl) { pControl->As()->SetColor(static_cast(cell), color); }); }; pGraphics->AttachControl(new IVColorSwatchControl(nextCell(), "ColorSpec", setColors, style, IVColorSwatchControl::ECellLayout::kVertical)); - auto setBGColor = [pGraphics](int cell, IColor color) { - pGraphics->GetBackgroundControl()->As()->SetPattern(color); - }; + auto setBGColor = [pGraphics](int cell, IColor color) { pGraphics->GetBackgroundControl()->As()->SetPattern(color); }; - pGraphics->AttachControl(new IVColorSwatchControl(nextCell().SubRectVertical(5, 0), "", setBGColor, style.WithColors({COLOR_GRAY}), IVColorSwatchControl::ECellLayout::kVertical, {kBG}, { "Background" })); + pGraphics->AttachControl( + new IVColorSwatchControl(nextCell().SubRectVertical(5, 0), "", setBGColor, style.WithColors({COLOR_GRAY}), IVColorSwatchControl::ECellLayout::kVertical, {kBG}, {"Background"})); auto setLabelTextColor = [pGraphics](int cell, IColor color) { pGraphics->ForControlInGroup("vcontrols", [cell, color](IControl* pControl) { @@ -401,25 +430,27 @@ IPlugControls::IPlugControls(const InstanceInfo& info) pVControl->SetStyle(pVControl->GetStyle().WithLabelText(newText)); pControl->SetText(newText); pControl->SetDirty(false); - }); + }); }; - - pGraphics->AttachControl(new IVColorSwatchControl(sameCell().SubRectVertical(5, 1), "", setLabelTextColor, style.WithColor(kBG, DEFAULT_TEXT_FGCOLOR), IVColorSwatchControl::ECellLayout::kVertical, { kBG }, { "Label Text" })); + + pGraphics->AttachControl(new IVColorSwatchControl( + sameCell().SubRectVertical(5, 1), "", setLabelTextColor, style.WithColor(kBG, DEFAULT_TEXT_FGCOLOR), IVColorSwatchControl::ECellLayout::kVertical, {kBG}, {"Label Text"})); auto setValueTextColor = [pGraphics](int cell, IColor color) { - pGraphics->ForControlInGroup("vcontrols", [cell, color](IControl* pControl) { - IVectorBase* pVControl = pControl->As(); - IText newText = pVControl->GetStyle().valueText.WithFGColor(color); - pVControl->SetStyle(pVControl->GetStyle().WithValueText(newText)); -// pControl->SetText(newText); - pControl->SetDirty(false); - }); - }; - - pGraphics->AttachControl(new IVColorSwatchControl(sameCell().SubRectVertical(5, 2), "", setValueTextColor, style.WithColor(kBG, DEFAULT_TEXT_FGCOLOR), IVColorSwatchControl::ECellLayout::kVertical, { kBG }, { "Value Text" })); - + pGraphics->ForControlInGroup("vcontrols", [cell, color](IControl* pControl) { + IVectorBase* pVControl = pControl->As(); + IText newText = pVControl->GetStyle().valueText.WithFGColor(color); + pVControl->SetStyle(pVControl->GetStyle().WithValueText(newText)); + // pControl->SetText(newText); + pControl->SetDirty(false); + }); + }; + + pGraphics->AttachControl(new IVColorSwatchControl( + sameCell().SubRectVertical(5, 2), "", setValueTextColor, style.WithColor(kBG, DEFAULT_TEXT_FGCOLOR), IVColorSwatchControl::ECellLayout::kVertical, {kBG}, {"Value Text"})); + auto setLabelTextSize = [pGraphics](IControl* pCaller) { - float newSize = (float) pCaller->As()->GetRealValue(); + float newSize = (float)pCaller->As()->GetRealValue(); pGraphics->ForControlInGroup("vcontrols", [newSize](IControl* pControl) { IVectorBase* pVControl = pControl->As(); IText newText = pVControl->GetStyle().labelText.WithSize(newSize); @@ -428,11 +459,11 @@ IPlugControls::IPlugControls(const InstanceInfo& info) pControl->SetDirty(false); }); }; - - pGraphics->AttachControl(new IVNumberBoxControl(sameCell().SubRectVertical(5, 3), kNoParameter, setLabelTextSize, "Label Text Size", style, (double) style.labelText.mSize, 12., 100.)); - + + pGraphics->AttachControl(new IVNumberBoxControl(sameCell().SubRectVertical(5, 3), kNoParameter, setLabelTextSize, "Label Text Size", style, (double)style.labelText.mSize, 12., 100.)); + auto setValueTextSize = [pGraphics](IControl* pCaller) { - float newSize = (float) pCaller->As()->GetRealValue(); + float newSize = (float)pCaller->As()->GetRealValue(); pGraphics->ForControlInGroup("vcontrols", [newSize](IControl* pControl) { IVectorBase* pVControl = pControl->As(); IText newText = pVControl->GetStyle().valueText.WithSize(newSize); @@ -442,8 +473,8 @@ IPlugControls::IPlugControls(const InstanceInfo& info) pControl->SetDirty(false); }); }; - - pGraphics->AttachControl(new IVNumberBoxControl(sameCell().SubRectVertical(5, 4), kNoParameter, setValueTextSize, "Value Text Size", style, (double) style.valueText.mSize, 12., 100.)); + + pGraphics->AttachControl(new IVNumberBoxControl(sameCell().SubRectVertical(5, 4), kNoParameter, setValueTextSize, "Value Text Size", style, (double)style.valueText.mSize, 12., 100.)); auto promptLabelFont = [pGraphics](IControl* pCaller) { auto completionHandler = [pGraphics](const WDL_String& fileName, const WDL_String& path) { @@ -461,15 +492,15 @@ IPlugControls::IPlugControls(const InstanceInfo& info) } } }; - + WDL_String fileName, path; pGraphics->PromptForFile(fileName, path, EFileAction::Open, "ttf", completionHandler); }; - + pGraphics->AttachControl(new IVButtonControl(nextCell().SubRectVertical(5, 1), SplashClickActionFunc, "Choose label font...", style))->SetAnimationEndActionFunction(promptLabelFont); - + auto promptValueFont = [pGraphics](IControl* pCaller) { - auto completionHandler = [pGraphics](const WDL_String& fileName, const WDL_String& path){ + auto completionHandler = [pGraphics](const WDL_String& fileName, const WDL_String& path) { if (fileName.GetLength()) { if (pGraphics->LoadFont(fileName.get_filepart(), fileName.Get())) @@ -485,32 +516,27 @@ IPlugControls::IPlugControls(const InstanceInfo& info) } } }; - + WDL_String fileName, path; pGraphics->PromptForFile(fileName, path, EFileAction::Open, "ttf", completionHandler); }; - + pGraphics->AttachControl(new IVButtonControl(sameCell().SubRectVertical(5, 2), SplashClickActionFunc, "Choose value font...", style))->SetAnimationEndActionFunction(promptValueFont); }; #endif } #if IPLUG_EDITOR -void IPlugControls::FlashBlueLED() -{ - GetUI()->GetControlWithTag(kCtrlTagBlueLED)->As()->TriggerWithDecay(1000); -} +void IPlugControls::FlashBlueLED() { GetUI()->GetControlWithTag(kCtrlTagBlueLED)->As()->TriggerWithDecay(1000); } void IPlugControls::OnMidiMsgUI(const IMidiMsg& msg) { - if(GetUI()) + if (GetUI()) { - switch (msg.StatusMsg()) { - case iplug::IMidiMsg::kNoteOn: - FlashBlueLED(); - break; - default: - break; + switch (msg.StatusMsg()) + { + case iplug::IMidiMsg::kNoteOn: FlashBlueLED(); break; + default: break; } } } @@ -531,40 +557,39 @@ void IPlugControls::OnIdle() mRTTextSender.TransmitData(*this); mDisplaySender.TransmitData(*this); mPeakAvgMeterSender.TransmitData(*this); - + float val = std::fabs(mLastOutputData.vals[0]); SendControlValueFromDelegate(kCtrlTagRedLED, std::copysign(val, mLastOutputData.vals[0])); SendControlValueFromDelegate(kCtrlTagGreenLED, std::copysign(val, -mLastOutputData.vals[0])); } -void IPlugControls::OnReset() -{ - mPeakAvgMeterSender.Reset(GetSampleRate()); -} +void IPlugControls::OnReset() { mPeakAvgMeterSender.Reset(GetSampleRate()); } void IPlugControls::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double phaseIncr1 = (1. / GetSampleRate()) * GetParam(kParamFreq1)->Value(); const double phaseIncr2 = (1. / GetSampleRate()) * GetParam(kParamFreq2)->Value(); - for (int s = 0; s < nFrames; s++) { + for (int s = 0; s < nFrames; s++) + { static double phase1 = 0.; static double phase2 = 0.; outputs[0][s] = cos(phase1 += phaseIncr1); outputs[1][s] = sin(phase2 += phaseIncr2); } - + mDisplaySender.ProcessBlock(outputs, nFrames, kCtrlTagDisplay); mScopeSender.ProcessBlock(outputs, nFrames, kCtrlTagScope); mMeterSender.ProcessBlock(outputs, nFrames, kCtrlTagMeter); mPeakAvgMeterSender.ProcessBlock(outputs, nFrames, kCtrlTagPeakAvgMeter); - mLastOutputData.vals[0] = (float) outputs[0][0]; // just take first value in block + mLastOutputData.vals[0] = (float)outputs[0][0]; // just take first value in block mRTTextSender.PushData(mLastOutputData); - for (int s = 0; s < nFrames; s++) { + for (int s = 0; s < nFrames; s++) + { outputs[0][s] = 0.; outputs[1][s] = 0.; } diff --git a/Examples/IPlugControls/IPlugControls.h b/Examples/IPlugControls/IPlugControls.h index a4bff62cfc..4c9eedd1dc 100644 --- a/Examples/IPlugControls/IPlugControls.h +++ b/Examples/IPlugControls/IPlugControls.h @@ -50,20 +50,21 @@ class IPlugControls final : public Plugin void FlashBlueLED(); IPattern mBGControlPattern = COLOR_GRAY; #endif - + #if IPLUG_DSP // http://bit.ly/2S64BDd public: void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; void OnIdle() override; void OnReset() override; + private: static constexpr int kScopeBufferSize = 128; - - IBufferSender<2, kScopeBufferSize, kScopeBufferSize*2> mScopeSender; + + IBufferSender<2, kScopeBufferSize, kScopeBufferSize * 2> mScopeSender; IBufferSender<1> mDisplaySender; IPeakSender<2> mMeterSender; ISender<1> mRTTextSender; - ISenderData<1> mLastOutputData = { kCtrlTagRTText, 1, 0 }; - IPeakAvgSender<2> mPeakAvgMeterSender { -90.0, true, 10.0f, 5.0f, 100.0f, 1000.0f }; + ISenderData<1> mLastOutputData = {kCtrlTagRTText, 1, 0}; + IPeakAvgSender<2> mPeakAvgMeterSender{-90.0, true, 10.0f, 5.0f, 100.0f, 1000.0f}; #endif }; diff --git a/Examples/IPlugControls/config.h b/Examples/IPlugControls/config.h index b6042d143e..e52af5fd47 100644 --- a/Examples/IPlugControls/config.h +++ b/Examples/IPlugControls/config.h @@ -36,7 +36,7 @@ #define AUV2_VIEW_CLASS_STR "IPlugControls_View" #define AAX_TYPE_IDS 'IPCT' -//#define AAX_TYPE_IDS_AUDIOSUITE 'EFA1', 'EFA2' +// #define AAX_TYPE_IDS_AUDIOSUITE 'EFA1', 'EFA2' #define AAX_PLUG_MFR_STR "Acme" #define AAX_PLUG_NAME_STR "IPlugControls\nIPCT" #define AAX_PLUG_CATEGORY_STR "Synth" @@ -70,4 +70,3 @@ #define SVGKNOBROTATE_FN "vector-knob.svg" #define SVGHSLIDERHANDLE_FN "hslider-handle.svg" #define SVGHSLIDERTRACK_FN "hslider-track.svg" - diff --git a/Examples/IPlugControls/resources/AUv3Framework.h b/Examples/IPlugControls/resources/AUv3Framework.h index 4bd66f7667..6b35df4b15 100644 --- a/Examples/IPlugControls/resources/AUv3Framework.h +++ b/Examples/IPlugControls/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugConvoEngine/IPlugConvoEngine.cpp b/Examples/IPlugConvoEngine/IPlugConvoEngine.cpp index a45677bb69..bf1616223c 100644 --- a/Examples/IPlugConvoEngine/IPlugConvoEngine.cpp +++ b/Examples/IPlugConvoEngine/IPlugConvoEngine.cpp @@ -13,7 +13,7 @@ void IPlugConvoEngine::ProcessBlock(sample** inputs, sample** outputs, int nFram { sample* inputL = inputs[0]; sample* outputL = outputs[0]; - + mEngine.Add(inputs, nFrames, 1); int nAvailableSamples = std::min(mEngine.Avail(nFrames), nFrames); @@ -52,12 +52,12 @@ void IPlugConvoEngine::OnReset() static constexpr double irSampleRate = 44100.; mImpulse.SetNumChannels(1); -#if defined USE_WDL_RESAMPLER + #if defined USE_WDL_RESAMPLER mResampler.SetMode(false, 0, true); // Sinc, default size mResampler.SetFeedMode(true); // Input driven -#elif defined USE_R8BRAIN + #elif defined USE_R8BRAIN mResampler = std::make_unique(irSampleRate, mSampleRate, mBlockLength); -#endif + #endif // Resample the impulse response. auto len = mImpulse.SetLength(ResampleLength(irLength, irSampleRate, mSampleRate)); @@ -65,10 +65,10 @@ void IPlugConvoEngine::OnReset() { Resample(mIR, irLength, irSampleRate, mImpulse.impulses[0].Get(), len, mSampleRate); } - + // Tie the impulse response to the convolution engine. mEngine.SetImpulse(&mImpulse); - + SetLatency(mEngine.GetLatency()); } } @@ -79,7 +79,8 @@ void IPlugConvoEngine::Resample(const I* pSrc, int srcLength, double srcRate, O* if (dstLength == srcLength) { // Copy - for (int i = 0; i < dstLength; ++i) *pDest++ = (O)*pSrc++; + for (int i = 0; i < dstLength; ++i) + *pDest++ = (O)*pSrc++; return; } @@ -91,16 +92,21 @@ void IPlugConvoEngine::Resample(const I* pSrc, int srcLength, double srcRate, O* { WDL_ResampleSample* p; int n = mResampler.ResamplePrepare(mBlockLength, 1, &p), m = n; - if (n > srcLength) n = srcLength; - for (int i = 0; i < n; ++i) *p++ = (WDL_ResampleSample)*pSrc++; - if (n < m) memset(p, 0, (m - n) * sizeof(WDL_ResampleSample)); + if (n > srcLength) + n = srcLength; + for (int i = 0; i < n; ++i) + *p++ = (WDL_ResampleSample)*pSrc++; + if (n < m) + memset(p, 0, (m - n) * sizeof(WDL_ResampleSample)); srcLength -= n; WDL_ResampleSample buf[mBlockLength]; n = mResampler.ResampleOut(buf, m, m, 1); - if (n > dstLength) n = dstLength; + if (n > dstLength) + n = dstLength; p = buf; - for (int i = 0; i < n; ++i) *pDest++ = (O)(scale * *p++); + for (int i = 0; i < n; ++i) + *pDest++ = (O)(scale * *p++); dstLength -= n; } mResampler.Reset(); @@ -112,14 +118,19 @@ void IPlugConvoEngine::Resample(const I* pSrc, int srcLength, double srcRate, O* { double buf[mBlockLength], *p = buf; int n = mBlockLength; - if (n > srcLength) n = srcLength; - for (int i = 0; i < n; ++i) *p++ = (double)*pSrc++; - if (n < mBlockLength) memset(p, 0, (mBlockLength - n) * sizeof(double)); + if (n > srcLength) + n = srcLength; + for (int i = 0; i < n; ++i) + *p++ = (double)*pSrc++; + if (n < mBlockLength) + memset(p, 0, (mBlockLength - n) * sizeof(double)); srcLength -= n; n = mResampler->process(buf, mBlockLength, p); - if (n > dstLength) n = dstLength; - for (int i = 0; i < n; ++i) *pDest++ = (O)(scale * *p++); + if (n > dstLength) + n = dstLength; + for (int i = 0; i < n; ++i) + *pDest++ = (O)(scale * *p++); dstLength -= n; } mResampler->clear(); @@ -135,7 +146,8 @@ void IPlugConvoEngine::Resample(const I* pSrc, int srcLength, double srcRate, O* { double frac = pos - floor(pos); double interp = (1. - frac) * pSrc[idx]; - if (++idx < srcLength) interp += frac * pSrc[idx]; + if (++idx < srcLength) + interp += frac * pSrc[idx]; pos += delta; *pDest++ = (O)(delta * interp); } @@ -147,9 +159,7 @@ void IPlugConvoEngine::Resample(const I* pSrc, int srcLength, double srcRate, O* #endif } -const float IPlugConvoEngine::mIR[] = -{ +const float IPlugConvoEngine::mIR[] = { #include "ir.h" }; #endif - diff --git a/Examples/IPlugConvoEngine/IPlugConvoEngine.h b/Examples/IPlugConvoEngine/IPlugConvoEngine.h index 45bbc9f217..b2020e5a0e 100644 --- a/Examples/IPlugConvoEngine/IPlugConvoEngine.h +++ b/Examples/IPlugConvoEngine/IPlugConvoEngine.h @@ -15,7 +15,7 @@ #include "resample.h" #elif defined USE_R8BRAIN #include "CDSPResampler.h" - using namespace r8b; +using namespace r8b; #endif const int kNumPresets = 1; @@ -37,21 +37,20 @@ class IPlugConvoEngine final : public Plugin #if IPLUG_DSP // http://bit.ly/2S64BDd void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; void OnReset() override; + private: // Returns destination length - inline int ResampleLength(int srcLength, double srcRate, double destRate) const - { - return int(destRate / srcRate * (double)srcLength + 0.5); - } + inline int ResampleLength(int srcLength, double srcRate, double destRate) const { return int(destRate / srcRate * (double)srcLength + 0.5); } + + template + void Resample(const I* pSrc, int srcLength, double srcRate, O* pDst, int dstLength, double dstRate); - template void Resample(const I* pSrc, int srcLength, double srcRate, O* pDst, int dstLength, double dstRate); - static const float mIR[512]; WDL_ImpulseBuffer mImpulse; -// WDL_ConvolutionEngine_Div mEngine; // < low latency version + // WDL_ConvolutionEngine_Div mEngine; // < low latency version WDL_ConvolutionEngine mEngine; - + static constexpr int mBlockLength = 64; #if defined USE_WDL_RESAMPLER diff --git a/Examples/IPlugConvoEngine/ir.h b/Examples/IPlugConvoEngine/ir.h index 3aba6e58bb..2b901db9e5 100644 --- a/Examples/IPlugConvoEngine/ir.h +++ b/Examples/IPlugConvoEngine/ir.h @@ -1,512 +1,50 @@ -4.24553603e-002f, -1.57741010e-001f, -2.75210112e-001f, -3.31389189e-001f, -3.22611272e-001f, -2.56686091e-001f, -1.50433525e-001f, -2.59184130e-002f, --9.38406885e-002f, --1.88903138e-001f, --2.45514110e-001f, --2.57848084e-001f, --2.28224143e-001f, --1.65906787e-001f, --8.48367736e-002f, --7.85613025e-004f, -7.15227947e-002f, -1.20827675e-001f, -1.40916467e-001f, -1.31190225e-001f, -9.62128937e-002f, -4.44219559e-002f, --1.36966864e-002f, --6.76043034e-002f, --1.08517379e-001f, --1.30737290e-001f, --1.32321209e-001f, --1.15044467e-001f, --8.37305114e-002f, --4.51255366e-002f, --6.55501662e-003f, -2.53864527e-002f, -4.58912142e-002f, -5.25848605e-002f, -4.56926264e-002f, -2.77446639e-002f, -2.91607482e-003f, --2.38494333e-002f, --4.77610342e-002f, --6.49853200e-002f, --7.32078031e-002f, --7.18792304e-002f, --6.21357113e-002f, --4.64383438e-002f, --2.80217435e-002f, --1.02645550e-002f, -3.90263856e-003f, -1.24544278e-002f, -1.45278005e-002f, -1.04551753e-002f, -1.58968475e-003f, --1.00269374e-002f, --2.20815465e-002f, --3.24120969e-002f, --3.93626876e-002f, --4.20170203e-002f, --4.02823575e-002f, --3.48243192e-002f, --2.68783644e-002f, --1.79823823e-002f, --9.68388468e-003f, --3.27440957e-003f, -4.06127423e-004f, -1.06853864e-003f, --1.03049958e-003f, --5.18621225e-003f, --1.04105128e-002f, --1.56290159e-002f, --1.98734049e-002f, --2.24367008e-002f, --2.29685213e-002f, --2.14999635e-002f, --1.84007604e-002f, --1.42827407e-002f, --9.87138506e-003f, --5.87059138e-003f, --2.84445286e-003f, --1.13460829e-003f, --8.23779963e-004f, --1.74720073e-003f, --3.54524865e-003f, --5.74422861e-003f, --7.84870796e-003f, --9.42846946e-003f, --1.01857455e-002f, --9.99316294e-003f, --8.89880303e-003f, --7.10074743e-003f, --4.89846850e-003f, --2.63166684e-003f, --6.18249178e-004f, -8.97854741e-004f, -1.78108003e-003f, -2.01669056e-003f, -1.70134660e-003f, -1.01554662e-003f, -1.84444172e-004f, --5.65112161e-004f, --1.04359468e-003f, --1.12758286e-003f, --7.74402695e-004f, --2.15096497e-005f, -1.02777628e-003f, -2.22839927e-003f, -3.42245935e-003f, -4.46745707e-003f, -5.25912084e-003f, -5.74544957e-003f, -5.93042793e-003f, -5.86780393e-003f, -5.64696500e-003f, -5.37411263e-003f, -5.15241455e-003f, -5.06463693e-003f, -5.16097480e-003f, -5.45365736e-003f, -5.91858150e-003f, -6.50299806e-003f, -7.13734608e-003f, -7.74879754e-003f, -8.27402435e-003f, -8.66909046e-003f, -8.91504623e-003f, -9.01870336e-003f, -9.00892820e-003f, -8.92952457e-003f, -8.83026980e-003f, -8.75780731e-003f, -8.74797720e-003f, -8.82075541e-003f, -8.97839759e-003f, -9.20680631e-003f, -9.47956089e-003f, -9.76365432e-003f, -1.00258011e-002f, -1.02381650e-002f, -1.03825936e-002f, -1.04527855e-002f, -1.04542077e-002f, -1.04020201e-002f, -1.03175361e-002f, -1.02239912e-002f, -1.01423934e-002f, -1.00881653e-002f, -1.00690769e-002f, -1.00846905e-002f, -1.01272622e-002f, -1.01838093e-002f, -1.02388700e-002f, -1.02774138e-002f, -1.02873957e-002f, -1.02615468e-002f, -1.01981694e-002f, -1.01009086e-002f, -9.97762661e-003f, -9.83866863e-003f, -9.69487615e-003f, -9.55571420e-003f, -9.42781288e-003f, -9.31414496e-003f, -9.21390485e-003f, -9.12304781e-003f, -9.03533772e-003f, -8.94365087e-003f, -8.84132273e-003f, -8.72326735e-003f, -8.58672708e-003f, -8.43154639e-003f, -8.25997163e-003f, -8.07606801e-003f, -7.88487121e-003f, -7.69146904e-003f, -7.50015210e-003f, -7.31379818e-003f, -7.13354675e-003f, -6.95881061e-003f, -6.78757951e-003f, -6.61693607e-003f, -6.44367747e-003f, -6.26492500e-003f, -6.07861578e-003f, -5.88380918e-003f, -5.68076875e-003f, -5.47083002e-003f, -5.25610009e-003f, -5.03905164e-003f, -4.82209539e-003f, -4.60720574e-003f, -4.39565629e-003f, -4.18790150e-003f, -3.98361124e-003f, -3.78183229e-003f, -3.58124427e-003f, -3.38045019e-003f, -3.17825121e-003f, -2.97386106e-003f, -2.76702782e-003f, -2.55805138e-003f, -2.34770519e-003f, -2.13708286e-003f, -1.92740688e-003f, -1.71983056e-003f, -1.51527382e-003f, -1.31431257e-003f, -1.11713749e-003f, -9.23583575e-004f, -7.33215071e-004f, -5.45449206e-004f, -3.59691825e-004f, -1.75460897e-004f, --7.52183087e-006f, --1.89283703e-004f, --3.69602203e-004f, --5.48049342e-004f, --7.24067329e-004f, --8.97059857e-004f, --1.06648135e-003f, --1.23190973e-003f, --1.39309128e-003f, --1.54995278e-003f, --1.70258316e-003f, --1.85118837e-003f, --1.99603289e-003f, --2.13737669e-003f, --2.27541965e-003f, --2.41026422e-003f, --2.54189596e-003f, --2.67018983e-003f, --2.79493327e-003f, --2.91586365e-003f, --3.03271133e-003f, --3.14523955e-003f, --3.25327599e-003f, --3.35673080e-003f, --3.45559930e-003f, --3.54995066e-003f, --3.63990525e-003f, --3.72560672e-003f, --3.80719220e-003f, --3.88476974e-003f, --3.95839987e-003f, --4.02809121e-003f, --4.09380440e-003f, --4.15546307e-003f, --4.21297364e-003f, --4.26624482e-003f, --4.31520445e-003f, --4.35981434e-003f, --4.40007728e-003f, --4.43603517e-003f, --4.46776487e-003f, --4.49536415e-003f, --4.51894198e-003f, --4.53860126e-003f, --4.55443189e-003f, --4.56650043e-003f, --4.57485160e-003f, --4.57950868e-003f, --4.58048098e-003f, --4.57777129e-003f, --4.57138661e-003f, --4.56134509e-003f, --4.54768259e-003f, --4.53045312e-003f, --4.50973073e-003f, --4.48560482e-003f, --4.45817364e-003f, --4.42753918e-003f, --4.39380109e-003f, --4.35705157e-003f, --4.31737211e-003f, --4.27483488e-003f, --4.22950182e-003f, --4.18143021e-003f, --4.13067406e-003f, --4.07729158e-003f, --4.02134517e-003f, --3.96290747e-003f, --3.90205812e-003f, --3.83888627e-003f, --3.77348741e-003f, --3.70596047e-003f, --3.63640557e-003f, --3.56492004e-003f, --3.49159772e-003f, --3.41652730e-003f, --3.33979214e-003f, --3.26147093e-003f, --3.18164006e-003f, --3.10037448e-003f, --3.01775034e-003f, --2.93384655e-003f, --2.84874439e-003f, --2.76253000e-003f, --2.67529138e-003f, --2.58711912e-003f, --2.49810494e-003f, --2.40833918e-003f, --2.31791055e-003f, --2.22690497e-003f, --2.13540508e-003f, --2.04349053e-003f, --1.95123744e-003f, --1.85872091e-003f, --1.76601403e-003f, --1.67319004e-003f, --1.58032239e-003f, --1.48748502e-003f, --1.39475265e-003f, --1.30220037e-003f, --1.20990304e-003f, --1.11793494e-003f, --1.02636847e-003f, --9.35274351e-004f, --8.44720867e-004f, --7.54773559e-004f, --6.65495580e-004f, --5.76947758e-004f, --4.89188882e-004f, --4.02276404e-004f, --3.16266436e-004f, --2.31214275e-004f, --1.47174447e-004f, --6.42006416e-005f, -1.76543708e-005f, -9.83390419e-005f, -1.77803347e-004f, -2.55999039e-004f, -3.32879979e-004f, -4.08402208e-004f, -4.82524018e-004f, -5.55205974e-004f, -6.26410707e-004f, -6.96102681e-004f, -7.64248136e-004f, -8.30814941e-004f, -8.95772188e-004f, -9.59090481e-004f, -1.02074177e-003f, -1.08069950e-003f, -1.13893847e-003f, -1.19543541e-003f, -1.25016889e-003f, -1.30311900e-003f, -1.35426840e-003f, -1.40360114e-003f, -1.45110337e-003f, -1.49676332e-003f, -1.54057052e-003f, -1.58251647e-003f, -1.62259396e-003f, -1.66079728e-003f, -1.69712235e-003f, -1.73156615e-003f, -1.76412740e-003f, -1.79480610e-003f, -1.82360387e-003f, -1.85052375e-003f, -1.87557051e-003f, -1.89875020e-003f, -1.92007073e-003f, -1.93954131e-003f, -1.95717253e-003f, -1.97297661e-003f, -1.98696670e-003f, -1.99915748e-003f, -2.00956455e-003f, -2.01820466e-003f, -2.02509598e-003f, -2.03025737e-003f, -2.03370932e-003f, -2.03547254e-003f, -2.03556987e-003f, -2.03402434e-003f, -2.03086087e-003f, -2.02610437e-003f, -2.01978162e-003f, -2.01192009e-003f, -2.00254773e-003f, -1.99169340e-003f, -1.97938737e-003f, -1.96565990e-003f, -1.95054186e-003f, -1.93406548e-003f, -1.91626314e-003f, -1.89716765e-003f, -1.87681289e-003f, -1.85523275e-003f, -1.83246215e-003f, -1.80853624e-003f, -1.78349065e-003f, -1.75736146e-003f, -1.73018500e-003f, -1.70199818e-003f, -1.67283800e-003f, -1.64274173e-003f, -1.61174696e-003f, -1.57989131e-003f, -1.54721260e-003f, -1.51374890e-003f, -1.47953816e-003f, -1.44461857e-003f, -1.40902831e-003f, -1.37280533e-003f, -1.33598805e-003f, -1.29861443e-003f, -1.26072252e-003f, -1.22235017e-003f, -1.18353509e-003f, -1.14431512e-003f, -1.10472727e-003f, -1.06480892e-003f, -1.02459674e-003f, -9.84127517e-004f, -9.43437277e-004f, -9.02561995e-004f, -8.61537294e-004f, -8.20398272e-004f, -7.79179740e-004f, -7.37916096e-004f, -6.96641160e-004f, -6.55388460e-004f, -6.14190882e-004f, -5.73080964e-004f, -5.32090489e-004f, -4.91250888e-004f, -4.50592954e-004f, -4.10146866e-004f, -3.69942252e-004f, -3.30008130e-004f, -2.90372787e-004f, -2.51063990e-004f, -2.12108804e-004f, -1.73533612e-004f, -1.35364156e-004f, -9.76254742e-005f, -5.95479178e-005f, -2.29176349e-005f, --1.22622696e-005f, --4.59905932e-005f, --7.82679781e-005f, --1.09096894e-004f, --1.38481570e-004f, --1.66427970e-004f, --1.92943728e-004f, --2.18038127e-004f, --2.41722009e-004f, --2.64007802e-004f, --2.84909329e-004f, --3.04441957e-004f, --3.22622363e-004f, --3.39468650e-004f, --3.55000055e-004f, --3.69237212e-004f, --3.82201863e-004f, --3.93916911e-004f, --4.04406252e-004f, --4.13694885e-004f, --4.21808858e-004f, --4.28774947e-004f, --4.34620975e-004f, --4.39375435e-004f, --4.43067664e-004f, --4.45727695e-004f, --4.47386235e-004f, --4.48074512e-004f, --4.47824365e-004f, --4.46668157e-004f, --4.44638688e-004f, --4.41769138e-004f, --4.38092946e-004f, --4.33644047e-004f, --4.28456435e-004f, --4.22564452e-004f, --4.16002498e-004f, --4.08805121e-004f, --4.01006895e-004f, --3.92642512e-004f, --3.83746432e-004f, --3.74353258e-004f, --3.64497391e-004f, --3.54213029e-004f, --3.43534251e-004f, --3.32494819e-004f, --3.21128318e-004f, --3.09467956e-004f, --2.97546561e-004f, --2.85396643e-004f, --2.73050275e-004f, --2.60539062e-004f, --2.47894117e-004f, --2.35146057e-004f, --2.22324932e-004f, --2.09460253e-004f, --1.96580891e-004f, --1.83715136e-004f, --1.70890547e-004f, --1.58134077e-004f, --1.45471975e-004f, --1.32929752e-004f, --1.20532168e-004f, --1.08303233e-004f, --9.62662016e-005f, --8.44435126e-005f, --7.28568120e-005f, --6.15269164e-005f, --5.04738091e-005f, --3.97166368e-005f, --2.92736822e-005f, --1.91623694e-005f, --9.39925121e-006f, -0.00000000e+000f, +4.24553603e-002f, 1.57741010e-001f, 2.75210112e-001f, 3.31389189e-001f, 3.22611272e-001f, 2.56686091e-001f, 1.50433525e-001f, 2.59184130e-002f, -9.38406885e-002f, -1.88903138e-001f, -2.45514110e-001f, + -2.57848084e-001f, -2.28224143e-001f, -1.65906787e-001f, -8.48367736e-002f, -7.85613025e-004f, 7.15227947e-002f, 1.20827675e-001f, 1.40916467e-001f, 1.31190225e-001f, 9.62128937e-002f, + 4.44219559e-002f, -1.36966864e-002f, -6.76043034e-002f, -1.08517379e-001f, -1.30737290e-001f, -1.32321209e-001f, -1.15044467e-001f, -8.37305114e-002f, -4.51255366e-002f, -6.55501662e-003f, + 2.53864527e-002f, 4.58912142e-002f, 5.25848605e-002f, 4.56926264e-002f, 2.77446639e-002f, 2.91607482e-003f, -2.38494333e-002f, -4.77610342e-002f, -6.49853200e-002f, -7.32078031e-002f, + -7.18792304e-002f, -6.21357113e-002f, -4.64383438e-002f, -2.80217435e-002f, -1.02645550e-002f, 3.90263856e-003f, 1.24544278e-002f, 1.45278005e-002f, 1.04551753e-002f, 1.58968475e-003f, + -1.00269374e-002f, -2.20815465e-002f, -3.24120969e-002f, -3.93626876e-002f, -4.20170203e-002f, -4.02823575e-002f, -3.48243192e-002f, -2.68783644e-002f, -1.79823823e-002f, -9.68388468e-003f, + -3.27440957e-003f, 4.06127423e-004f, 1.06853864e-003f, -1.03049958e-003f, -5.18621225e-003f, -1.04105128e-002f, -1.56290159e-002f, -1.98734049e-002f, -2.24367008e-002f, -2.29685213e-002f, + -2.14999635e-002f, -1.84007604e-002f, -1.42827407e-002f, -9.87138506e-003f, -5.87059138e-003f, -2.84445286e-003f, -1.13460829e-003f, -8.23779963e-004f, -1.74720073e-003f, -3.54524865e-003f, + -5.74422861e-003f, -7.84870796e-003f, -9.42846946e-003f, -1.01857455e-002f, -9.99316294e-003f, -8.89880303e-003f, -7.10074743e-003f, -4.89846850e-003f, -2.63166684e-003f, -6.18249178e-004f, + 8.97854741e-004f, 1.78108003e-003f, 2.01669056e-003f, 1.70134660e-003f, 1.01554662e-003f, 1.84444172e-004f, -5.65112161e-004f, -1.04359468e-003f, -1.12758286e-003f, -7.74402695e-004f, + -2.15096497e-005f, 1.02777628e-003f, 2.22839927e-003f, 3.42245935e-003f, 4.46745707e-003f, 5.25912084e-003f, 5.74544957e-003f, 5.93042793e-003f, 5.86780393e-003f, 5.64696500e-003f, 5.37411263e-003f, + 5.15241455e-003f, 5.06463693e-003f, 5.16097480e-003f, 5.45365736e-003f, 5.91858150e-003f, 6.50299806e-003f, 7.13734608e-003f, 7.74879754e-003f, 8.27402435e-003f, 8.66909046e-003f, 8.91504623e-003f, + 9.01870336e-003f, 9.00892820e-003f, 8.92952457e-003f, 8.83026980e-003f, 8.75780731e-003f, 8.74797720e-003f, 8.82075541e-003f, 8.97839759e-003f, 9.20680631e-003f, 9.47956089e-003f, 9.76365432e-003f, + 1.00258011e-002f, 1.02381650e-002f, 1.03825936e-002f, 1.04527855e-002f, 1.04542077e-002f, 1.04020201e-002f, 1.03175361e-002f, 1.02239912e-002f, 1.01423934e-002f, 1.00881653e-002f, 1.00690769e-002f, + 1.00846905e-002f, 1.01272622e-002f, 1.01838093e-002f, 1.02388700e-002f, 1.02774138e-002f, 1.02873957e-002f, 1.02615468e-002f, 1.01981694e-002f, 1.01009086e-002f, 9.97762661e-003f, 9.83866863e-003f, + 9.69487615e-003f, 9.55571420e-003f, 9.42781288e-003f, 9.31414496e-003f, 9.21390485e-003f, 9.12304781e-003f, 9.03533772e-003f, 8.94365087e-003f, 8.84132273e-003f, 8.72326735e-003f, 8.58672708e-003f, + 8.43154639e-003f, 8.25997163e-003f, 8.07606801e-003f, 7.88487121e-003f, 7.69146904e-003f, 7.50015210e-003f, 7.31379818e-003f, 7.13354675e-003f, 6.95881061e-003f, 6.78757951e-003f, 6.61693607e-003f, + 6.44367747e-003f, 6.26492500e-003f, 6.07861578e-003f, 5.88380918e-003f, 5.68076875e-003f, 5.47083002e-003f, 5.25610009e-003f, 5.03905164e-003f, 4.82209539e-003f, 4.60720574e-003f, 4.39565629e-003f, + 4.18790150e-003f, 3.98361124e-003f, 3.78183229e-003f, 3.58124427e-003f, 3.38045019e-003f, 3.17825121e-003f, 2.97386106e-003f, 2.76702782e-003f, 2.55805138e-003f, 2.34770519e-003f, 2.13708286e-003f, + 1.92740688e-003f, 1.71983056e-003f, 1.51527382e-003f, 1.31431257e-003f, 1.11713749e-003f, 9.23583575e-004f, 7.33215071e-004f, 5.45449206e-004f, 3.59691825e-004f, 1.75460897e-004f, -7.52183087e-006f, + -1.89283703e-004f, -3.69602203e-004f, -5.48049342e-004f, -7.24067329e-004f, -8.97059857e-004f, -1.06648135e-003f, -1.23190973e-003f, -1.39309128e-003f, -1.54995278e-003f, -1.70258316e-003f, + -1.85118837e-003f, -1.99603289e-003f, -2.13737669e-003f, -2.27541965e-003f, -2.41026422e-003f, -2.54189596e-003f, -2.67018983e-003f, -2.79493327e-003f, -2.91586365e-003f, -3.03271133e-003f, + -3.14523955e-003f, -3.25327599e-003f, -3.35673080e-003f, -3.45559930e-003f, -3.54995066e-003f, -3.63990525e-003f, -3.72560672e-003f, -3.80719220e-003f, -3.88476974e-003f, -3.95839987e-003f, + -4.02809121e-003f, -4.09380440e-003f, -4.15546307e-003f, -4.21297364e-003f, -4.26624482e-003f, -4.31520445e-003f, -4.35981434e-003f, -4.40007728e-003f, -4.43603517e-003f, -4.46776487e-003f, + -4.49536415e-003f, -4.51894198e-003f, -4.53860126e-003f, -4.55443189e-003f, -4.56650043e-003f, -4.57485160e-003f, -4.57950868e-003f, -4.58048098e-003f, -4.57777129e-003f, -4.57138661e-003f, + -4.56134509e-003f, -4.54768259e-003f, -4.53045312e-003f, -4.50973073e-003f, -4.48560482e-003f, -4.45817364e-003f, -4.42753918e-003f, -4.39380109e-003f, -4.35705157e-003f, -4.31737211e-003f, + -4.27483488e-003f, -4.22950182e-003f, -4.18143021e-003f, -4.13067406e-003f, -4.07729158e-003f, -4.02134517e-003f, -3.96290747e-003f, -3.90205812e-003f, -3.83888627e-003f, -3.77348741e-003f, + -3.70596047e-003f, -3.63640557e-003f, -3.56492004e-003f, -3.49159772e-003f, -3.41652730e-003f, -3.33979214e-003f, -3.26147093e-003f, -3.18164006e-003f, -3.10037448e-003f, -3.01775034e-003f, + -2.93384655e-003f, -2.84874439e-003f, -2.76253000e-003f, -2.67529138e-003f, -2.58711912e-003f, -2.49810494e-003f, -2.40833918e-003f, -2.31791055e-003f, -2.22690497e-003f, -2.13540508e-003f, + -2.04349053e-003f, -1.95123744e-003f, -1.85872091e-003f, -1.76601403e-003f, -1.67319004e-003f, -1.58032239e-003f, -1.48748502e-003f, -1.39475265e-003f, -1.30220037e-003f, -1.20990304e-003f, + -1.11793494e-003f, -1.02636847e-003f, -9.35274351e-004f, -8.44720867e-004f, -7.54773559e-004f, -6.65495580e-004f, -5.76947758e-004f, -4.89188882e-004f, -4.02276404e-004f, -3.16266436e-004f, + -2.31214275e-004f, -1.47174447e-004f, -6.42006416e-005f, 1.76543708e-005f, 9.83390419e-005f, 1.77803347e-004f, 2.55999039e-004f, 3.32879979e-004f, 4.08402208e-004f, 4.82524018e-004f, + 5.55205974e-004f, 6.26410707e-004f, 6.96102681e-004f, 7.64248136e-004f, 8.30814941e-004f, 8.95772188e-004f, 9.59090481e-004f, 1.02074177e-003f, 1.08069950e-003f, 1.13893847e-003f, 1.19543541e-003f, + 1.25016889e-003f, 1.30311900e-003f, 1.35426840e-003f, 1.40360114e-003f, 1.45110337e-003f, 1.49676332e-003f, 1.54057052e-003f, 1.58251647e-003f, 1.62259396e-003f, 1.66079728e-003f, 1.69712235e-003f, + 1.73156615e-003f, 1.76412740e-003f, 1.79480610e-003f, 1.82360387e-003f, 1.85052375e-003f, 1.87557051e-003f, 1.89875020e-003f, 1.92007073e-003f, 1.93954131e-003f, 1.95717253e-003f, 1.97297661e-003f, + 1.98696670e-003f, 1.99915748e-003f, 2.00956455e-003f, 2.01820466e-003f, 2.02509598e-003f, 2.03025737e-003f, 2.03370932e-003f, 2.03547254e-003f, 2.03556987e-003f, 2.03402434e-003f, 2.03086087e-003f, + 2.02610437e-003f, 2.01978162e-003f, 2.01192009e-003f, 2.00254773e-003f, 1.99169340e-003f, 1.97938737e-003f, 1.96565990e-003f, 1.95054186e-003f, 1.93406548e-003f, 1.91626314e-003f, 1.89716765e-003f, + 1.87681289e-003f, 1.85523275e-003f, 1.83246215e-003f, 1.80853624e-003f, 1.78349065e-003f, 1.75736146e-003f, 1.73018500e-003f, 1.70199818e-003f, 1.67283800e-003f, 1.64274173e-003f, 1.61174696e-003f, + 1.57989131e-003f, 1.54721260e-003f, 1.51374890e-003f, 1.47953816e-003f, 1.44461857e-003f, 1.40902831e-003f, 1.37280533e-003f, 1.33598805e-003f, 1.29861443e-003f, 1.26072252e-003f, 1.22235017e-003f, + 1.18353509e-003f, 1.14431512e-003f, 1.10472727e-003f, 1.06480892e-003f, 1.02459674e-003f, 9.84127517e-004f, 9.43437277e-004f, 9.02561995e-004f, 8.61537294e-004f, 8.20398272e-004f, 7.79179740e-004f, + 7.37916096e-004f, 6.96641160e-004f, 6.55388460e-004f, 6.14190882e-004f, 5.73080964e-004f, 5.32090489e-004f, 4.91250888e-004f, 4.50592954e-004f, 4.10146866e-004f, 3.69942252e-004f, 3.30008130e-004f, + 2.90372787e-004f, 2.51063990e-004f, 2.12108804e-004f, 1.73533612e-004f, 1.35364156e-004f, 9.76254742e-005f, 5.95479178e-005f, 2.29176349e-005f, -1.22622696e-005f, -4.59905932e-005f, + -7.82679781e-005f, -1.09096894e-004f, -1.38481570e-004f, -1.66427970e-004f, -1.92943728e-004f, -2.18038127e-004f, -2.41722009e-004f, -2.64007802e-004f, -2.84909329e-004f, -3.04441957e-004f, + -3.22622363e-004f, -3.39468650e-004f, -3.55000055e-004f, -3.69237212e-004f, -3.82201863e-004f, -3.93916911e-004f, -4.04406252e-004f, -4.13694885e-004f, -4.21808858e-004f, -4.28774947e-004f, + -4.34620975e-004f, -4.39375435e-004f, -4.43067664e-004f, -4.45727695e-004f, -4.47386235e-004f, -4.48074512e-004f, -4.47824365e-004f, -4.46668157e-004f, -4.44638688e-004f, -4.41769138e-004f, + -4.38092946e-004f, -4.33644047e-004f, -4.28456435e-004f, -4.22564452e-004f, -4.16002498e-004f, -4.08805121e-004f, -4.01006895e-004f, -3.92642512e-004f, -3.83746432e-004f, -3.74353258e-004f, + -3.64497391e-004f, -3.54213029e-004f, -3.43534251e-004f, -3.32494819e-004f, -3.21128318e-004f, -3.09467956e-004f, -2.97546561e-004f, -2.85396643e-004f, -2.73050275e-004f, -2.60539062e-004f, + -2.47894117e-004f, -2.35146057e-004f, -2.22324932e-004f, -2.09460253e-004f, -1.96580891e-004f, -1.83715136e-004f, -1.70890547e-004f, -1.58134077e-004f, -1.45471975e-004f, -1.32929752e-004f, + -1.20532168e-004f, -1.08303233e-004f, -9.62662016e-005f, -8.44435126e-005f, -7.28568120e-005f, -6.15269164e-005f, -5.04738091e-005f, -3.97166368e-005f, -2.92736822e-005f, -1.91623694e-005f, + -9.39925121e-006f, 0.00000000e+000f, diff --git a/Examples/IPlugConvoEngine/resources/AUv3Framework.h b/Examples/IPlugConvoEngine/resources/AUv3Framework.h index 4bd66f7667..6b35df4b15 100644 --- a/Examples/IPlugConvoEngine/resources/AUv3Framework.h +++ b/Examples/IPlugConvoEngine/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugDrumSynth/IPlugDrumSynth.cpp b/Examples/IPlugDrumSynth/IPlugDrumSynth.cpp index 09370ba79d..653022f457 100644 --- a/Examples/IPlugDrumSynth/IPlugDrumSynth.cpp +++ b/Examples/IPlugDrumSynth/IPlugDrumSynth.cpp @@ -2,10 +2,9 @@ #include "IPlug_include_in_plug_src.h" #if IPLUG_EDITOR -#include "IControls.h" + #include "IControls.h" -class DrumPadControl : public IControl, - public IVectorBase +class DrumPadControl : public IControl, public IVectorBase { public: DrumPadControl(const IRECT& bounds, const IVStyle& style, int midiNoteNumber) @@ -16,14 +15,14 @@ class DrumPadControl : public IControl, mDblAsSingleClick = true; AttachIControl(this, ""); } - + void Draw(IGraphics& g) override { -// g.FillRect(mFlash ? COLOR_WHITE : COLOR_BLACK, mRECT); + // g.FillRect(mFlash ? COLOR_WHITE : COLOR_BLACK, mRECT); DrawPressableShape(g, EVShape::AllRounded, mRECT, mFlash, mMouseIsOver, false); mFlash = false; } - + void OnMouseDown(float x, float y, const IMouseMod& mod) override { TriggerAnimation(); @@ -31,14 +30,14 @@ class DrumPadControl : public IControl, msg.MakeNoteOnMsg(mMidiNoteNumber, 127, 0); GetDelegate()->SendMidiMsgFromUI(msg); } - + void OnMouseUp(float x, float y, const IMouseMod& mod) override { IMidiMsg msg; msg.MakeNoteOffMsg(mMidiNoteNumber, 0); GetDelegate()->SendMidiMsgFromUI(msg); } - + void TriggerAnimation() { mFlash = true; @@ -57,26 +56,25 @@ IPlugDrumSynth::IPlugDrumSynth(const InstanceInfo& info) GetParam(kParamGain)->InitDouble("Gain", 100., 0., 100.0, 0.01, "%"); GetParam(kParamMultiOuts)->InitBool("Multi-outs", false); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, 1.); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, 1.); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_WHITE); pGraphics->EnableMouseOver(true); -// pGraphics->EnableMultiTouch(true); -// pGraphics->ShowFPSDisplay(true); -// pGraphics->EnableLiveEdit(true); + // pGraphics->EnableMultiTouch(true); + // pGraphics->ShowFPSDisplay(true); + // pGraphics->EnableLiveEdit(true); pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); IRECT b = pGraphics->GetBounds().GetPadded(-5); const IRECT buttons = b.ReduceFromTop(50.f); const IRECT pads = b.GetPadded(-5.f); - + pGraphics->AttachControl(new IVToggleControl(buttons.GetGridCell(0, 1, 4), kParamMultiOuts)); pGraphics->AttachControl(new IVMeterControl<8>(buttons.GetGridCell(1, 1, 4, EDirection::Horizontal, 3), ""), kCtrlTagMeter); IVStyle style = DEFAULT_STYLE.WithRoundness(0.1f).WithFrameThickness(3.f); - for (int i=0; iAttachControl(new DrumPadControl(cell, style, 60 + i), i /* controlTag */); } @@ -87,11 +85,11 @@ IPlugDrumSynth::IPlugDrumSynth(const InstanceInfo& info) #if IPLUG_EDITOR void IPlugDrumSynth::OnMidiMsgUI(const IMidiMsg& msg) { - if(GetUI() && msg.StatusMsg() == IMidiMsg::kNoteOn) + if (GetUI() && msg.StatusMsg() == IMidiMsg::kNoteOn) { int pitchClass = msg.NoteNumber() % 12; - if(pitchClass < kNumDrums) + if (pitchClass < kNumDrums) { DrumPadControl* pPad = GetUI()->GetControlWithTag(pitchClass)->As(); pPad->SetSplashPoint(pPad->GetRECT().MW(), pPad->GetRECT().MH()); @@ -106,18 +104,18 @@ void IPlugDrumSynth::GetBusName(ERoute direction, int busIdx, int nBuses, WDL_St { if (direction == ERoute::kOutput) { - if(busIdx == 0) + if (busIdx == 0) str.Set("Drum1"); - else if(busIdx == 1) + else if (busIdx == 1) str.Set("Drum2"); - else if(busIdx == 2) + else if (busIdx == 2) str.Set("Drum3"); - else if(busIdx == 3) + else if (busIdx == 3) str.Set("Drum4"); - + return; } - + str.Set(""); } @@ -127,32 +125,28 @@ void IPlugDrumSynth::ProcessBlock(sample** inputs, sample** outputs, int nFrames const int nChans = NOutChansConnected(); mDSP.ProcessBlock(outputs, nFrames); - - for (auto s = 0; s < nFrames; s++) { - for (auto c = 0; c < nChans; c++) { + + for (auto s = 0; s < nFrames; s++) + { + for (auto c = 0; c < nChans; c++) + { outputs[c][s] = outputs[c][s] * gain; } } - + mSender.ProcessBlock(outputs, nFrames, kCtrlTagMeter); } -void IPlugDrumSynth::OnIdle() -{ - mSender.TransmitData(*this); -} +void IPlugDrumSynth::OnIdle() { mSender.TransmitData(*this); } -void IPlugDrumSynth::OnReset() -{ - mDSP.Reset(GetSampleRate(), GetBlockSize()); -} +void IPlugDrumSynth::OnReset() { mDSP.Reset(GetSampleRate(), GetBlockSize()); } void IPlugDrumSynth::ProcessMidiMsg(const IMidiMsg& msg) { TRACE; - + int status = msg.StatusMsg(); - + switch (status) { case IMidiMsg::kNoteOn: @@ -160,10 +154,9 @@ void IPlugDrumSynth::ProcessMidiMsg(const IMidiMsg& msg) { goto handle; } - default: - return; + default: return; } - + handle: mDSP.ProcessMidiMsg(msg); SendMidiMsg(msg); @@ -173,33 +166,30 @@ void IPlugDrumSynth::OnParamChange(int paramIdx) { switch (paramIdx) { - case kParamMultiOuts: - mDSP.SetMultiOut(GetParam(paramIdx)->Bool()); - break; - default: - break; + case kParamMultiOuts: mDSP.SetMultiOut(GetParam(paramIdx)->Bool()); break; + default: break; } } bool IPlugDrumSynth::GetMidiNoteText(int noteNumber, char* name) const { int pitch = noteNumber % 12; - + WDL_String str; str.SetFormatted(32, "Drum %i", pitch); - + strcpy(name, str.Get()); - -// switch (pitch) -// { -// case 0: -// strcpy(name, "drum 1"); -// return true; -// default: -// *name = '\0'; -// return false; -// } - + + // switch (pitch) + // { + // case 0: + // strcpy(name, "drum 1"); + // return true; + // default: + // *name = '\0'; + // return false; + // } + return true; } #endif diff --git a/Examples/IPlugDrumSynth/IPlugDrumSynth.h b/Examples/IPlugDrumSynth/IPlugDrumSynth.h index c7e1627a2c..c1b90b508d 100644 --- a/Examples/IPlugDrumSynth/IPlugDrumSynth.h +++ b/Examples/IPlugDrumSynth/IPlugDrumSynth.h @@ -34,7 +34,7 @@ class IPlugDrumSynth : public Plugin #if IPLUG_EDITOR // // http://bit.ly/2S64BDd void OnMidiMsgUI(const IMidiMsg& msg) override; #endif - + #if IPLUG_DSP // http://bit.ly/2S64BDd public: void GetBusName(ERoute direction, int busIdx, int nBuses, WDL_String& str) const override; @@ -45,6 +45,7 @@ class IPlugDrumSynth : public Plugin void OnParamChange(int paramIdx) override; bool GetMidiNoteText(int noteNumber, char* text) const override; void OnIdle() override; + private: DrumSynthDSP mDSP; IPeakSender<8> mSender; diff --git a/Examples/IPlugDrumSynth/IPlugDrumSynth_DSP.h b/Examples/IPlugDrumSynth/IPlugDrumSynth_DSP.h index 58b140c8a5..1d8df2c365 100644 --- a/Examples/IPlugDrumSynth/IPlugDrumSynth_DSP.h +++ b/Examples/IPlugDrumSynth/IPlugDrumSynth_DSP.h @@ -5,11 +5,11 @@ #include static constexpr int kNumDrums = 4; -static constexpr double kStartFreq = 300.; //Hz -static constexpr double kFreqDiff = 100.; //Hz -static constexpr double kPitchEnvRange = 100.; //Hz -static constexpr double kAmpDecayTime = 300; //Ms -static constexpr double kPitchDecayTime = 50.; //Ms +static constexpr double kStartFreq = 300.; // Hz +static constexpr double kFreqDiff = 100.; // Hz +static constexpr double kPitchEnvRange = 100.; // Hz +static constexpr double kAmpDecayTime = 300; // Ms +static constexpr double kPitchDecayTime = 50.; // Ms using namespace iplug; @@ -18,84 +18,79 @@ class DrumSynthDSP public: struct DrumVoice { - ADSREnvelope mPitchEnv {"pitch", nullptr, false}; - ADSREnvelope mAmpEnv {"amp", nullptr, false}; + ADSREnvelope mPitchEnv{"pitch", nullptr, false}; + ADSREnvelope mAmpEnv{"amp", nullptr, false}; FastSinOscillator mOsc; double mBaseFreq; - + DrumVoice(double baseFreq) : mBaseFreq(baseFreq) { mAmpEnv.SetStageTime(ADSREnvelope::kAttack, 0.); mAmpEnv.SetStageTime(ADSREnvelope::kDecay, kAmpDecayTime); - + mPitchEnv.SetStageTime(ADSREnvelope::kAttack, 0.); mPitchEnv.SetStageTime(ADSREnvelope::kDecay, kPitchDecayTime); } - - inline sample Process() - { - return mOsc.Process(mBaseFreq + mPitchEnv.Process()) * mAmpEnv.Process(); - } - + + inline sample Process() { return mOsc.Process(mBaseFreq + mPitchEnv.Process()) * mAmpEnv.Process(); } + void Trigger(double amp) { mOsc.Reset(); mPitchEnv.Start(amp * kPitchEnvRange); mAmpEnv.Start(amp); } - - inline bool IsActive() const - { - return mAmpEnv.GetBusy(); - } + + inline bool IsActive() const { return mAmpEnv.GetBusy(); } }; - + DrumSynthDSP() -// : mMidiQueue(IMidiMsg::QueueSize(DEFAULT_BLOCK_SIZE, DEFAULT_SAMPLE_RATE)) + // : mMidiQueue(IMidiMsg::QueueSize(DEFAULT_BLOCK_SIZE, DEFAULT_SAMPLE_RATE)) { - for(int d=0;d s) break; - - if(msg.StatusMsg() == IMidiMsg::kNoteOn && msg.Velocity()) + if (msg.mOffset > s) + break; + + if (msg.StatusMsg() == IMidiMsg::kNoteOn && msg.Velocity()) { int pitchClass = msg.NoteNumber() % 12; - - if(pitchClass < kNumDrums) - mDrums[pitchClass].Trigger(msg.Velocity() / 127.f); + + if (pitchClass < kNumDrums) + mDrums[pitchClass].Trigger(msg.Velocity() / 127.f); } - + mMidiQueue.Remove(); } - if(mMultiOut) + if (mMultiOut) { - int channel=0; - for(int d=0;d mDrums; IMidiQueue mMidiQueue; }; - diff --git a/Examples/IPlugDrumSynth/config.h b/Examples/IPlugDrumSynth/config.h index 251984fd1b..92d17b01ca 100644 --- a/Examples/IPlugDrumSynth/config.h +++ b/Examples/IPlugDrumSynth/config.h @@ -13,7 +13,8 @@ #define BUNDLE_MFR "AcmeInc" #define BUNDLE_DOMAIN "com" -#define PLUG_CHANNEL_IO " \ +#define PLUG_CHANNEL_IO \ + " \ 0-2 \ 0-2.2 \ 0-2.2.2 \ diff --git a/Examples/IPlugDrumSynth/resources/AUv3Framework.h b/Examples/IPlugDrumSynth/resources/AUv3Framework.h index 3187effc7b..cc74701b8e 100644 --- a/Examples/IPlugDrumSynth/resources/AUv3Framework.h +++ b/Examples/IPlugDrumSynth/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugEffect/IPlugEffect.cpp b/Examples/IPlugEffect/IPlugEffect.cpp index 1576821237..7ceef9d3b8 100644 --- a/Examples/IPlugEffect/IPlugEffect.cpp +++ b/Examples/IPlugEffect/IPlugEffect.cpp @@ -8,10 +8,8 @@ IPlugEffect::IPlugEffect(const InstanceInfo& info) GetParam(kGain)->InitDouble("Gain", 0., 0., 100.0, 0.01, "%"); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); @@ -28,9 +26,11 @@ void IPlugEffect::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double gain = GetParam(kGain)->Value() / 100.; const int nChans = NOutChansConnected(); - - for (int s = 0; s < nFrames; s++) { - for (int c = 0; c < nChans; c++) { + + for (int s = 0; s < nFrames; s++) + { + for (int c = 0; c < nChans; c++) + { outputs[c][s] = inputs[c][s] * gain; } } diff --git a/Examples/IPlugEffect/resources/AUv3Framework.h b/Examples/IPlugEffect/resources/AUv3Framework.h index f6c22b16d6..f754849e42 100644 --- a/Examples/IPlugEffect/resources/AUv3Framework.h +++ b/Examples/IPlugEffect/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugFaustDSP/IPlugFaustDSP.cpp b/Examples/IPlugFaustDSP/IPlugFaustDSP.cpp index f767839284..a3c65a6308 100644 --- a/Examples/IPlugFaustDSP/IPlugFaustDSP.cpp +++ b/Examples/IPlugFaustDSP/IPlugFaustDSP.cpp @@ -4,26 +4,22 @@ IPlugFaustDSP::IPlugFaustDSP(const InstanceInfo& info) : Plugin(info, MakeConfig(kNumParams, 1)) { - InitParamRange(0, kNumParams-1, 1, "Param %i", 0., 0., 1., 0.01, "", IParam::kFlagsNone); // initialize kNumParams generic iplug params - + InitParamRange(0, kNumParams - 1, 1, "Param %i", 0., 0., 1., 0.01, "", IParam::kFlagsNone); // initialize kNumParams generic iplug params + #if IPLUG_DSP mFaustProcessor.SetMaxChannelCount(MaxNChannels(ERoute::kInput), MaxNChannels(ERoute::kOutput)); mFaustProcessor.Init(); mFaustProcessor.CompileCPP(); mFaustProcessor.SetAutoRecompile(true); - // mFaustProcessor.CreateIPlugParameters(this, 0, mFaustProcessor.NParams()); // in order to create iplug params, based on faust .dsp params, uncomment this -#ifndef FAUST_COMPILED - mFaustProcessor.SetCompileFunc([&](){ - OnParamReset(EParamSource::kRecompile); - }); -#endif + // mFaustProcessor.CreateIPlugParameters(this, 0, mFaustProcessor.NParams()); // in order to create iplug params, based on faust .dsp params, uncomment this + #ifndef FAUST_COMPILED + mFaustProcessor.SetCompileFunc([&]() { OnParamReset(EParamSource::kRecompile); }); + #endif #endif - + #if IPLUG_EDITOR - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { IRECT b = pGraphics->GetBounds().GetPadded(-20); @@ -34,10 +30,11 @@ IPlugFaustDSP::IPlugFaustDSP(const InstanceInfo& info) pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->AttachPanelBackground(COLOR_GRAY); - for (int i = 0; i < kNumParams; i++) { + for (int i = 0; i < kNumParams; i++) + { pGraphics->AttachControl(new IVKnobControl(knobs.GetGridCell(i, 1, kNumParams).GetPadded(-5.f), i)); } - + pGraphics->AttachControl(new IVScopeControl<2>(viz, "", DEFAULT_STYLE.WithColor(kBG, COLOR_BLACK).WithColor(kFG, COLOR_GREEN)), kCtrlTagScope); pGraphics->AttachControl(new IVKeyboardControl(keyb)); }; @@ -52,23 +49,11 @@ void IPlugFaustDSP::ProcessBlock(sample** inputs, sample** outputs, int nFrames) mScopeSender.ProcessBlock(outputs, nFrames, kCtrlTagScope); } -void IPlugFaustDSP::OnReset() -{ - mFaustProcessor.SetSampleRate(GetSampleRate()); -} +void IPlugFaustDSP::OnReset() { mFaustProcessor.SetSampleRate(GetSampleRate()); } -void IPlugFaustDSP::ProcessMidiMsg(const IMidiMsg& msg) -{ - mFaustProcessor.ProcessMidiMsg(msg); -} +void IPlugFaustDSP::ProcessMidiMsg(const IMidiMsg& msg) { mFaustProcessor.ProcessMidiMsg(msg); } -void IPlugFaustDSP::OnParamChange(int paramIdx) -{ - mFaustProcessor.SetParameterValueNormalised(paramIdx, GetParam(paramIdx)->GetNormalized()); -} +void IPlugFaustDSP::OnParamChange(int paramIdx) { mFaustProcessor.SetParameterValueNormalised(paramIdx, GetParam(paramIdx)->GetNormalized()); } -void IPlugFaustDSP::OnIdle() -{ - mScopeSender.TransmitData(*this); -} +void IPlugFaustDSP::OnIdle() { mScopeSender.TransmitData(*this); } #endif diff --git a/Examples/IPlugFaustDSP/IPlugFaustDSP.h b/Examples/IPlugFaustDSP/IPlugFaustDSP.h index 089f9f9a60..cec40d485f 100644 --- a/Examples/IPlugFaustDSP/IPlugFaustDSP.h +++ b/Examples/IPlugFaustDSP/IPlugFaustDSP.h @@ -3,13 +3,13 @@ #include "IPlug_include_in_plug_hdr.h" #if IPLUG_DSP -#include "IPlugFaustGen.h" + #include "IPlugFaustGen.h" #endif #include "IControls.h" #ifndef DSP_FILE -#define DSP_FILE "" + #define DSP_FILE "" #endif enum EControlTags @@ -34,6 +34,7 @@ class IPlugFaustDSP final : public Plugin void ProcessMidiMsg(const IMidiMsg& msg) override; void OnParamChange(int paramIdx) override; void OnIdle() override; + private: FAUST_BLOCK(Faust1, mFaustProcessor, DSP_FILE, 1, 1); IBufferSender<2> mScopeSender; diff --git a/Examples/IPlugFaustDSP/resources/AUv3Framework.h b/Examples/IPlugFaustDSP/resources/AUv3Framework.h index 5d455588f0..9940aff088 100644 --- a/Examples/IPlugFaustDSP/resources/AUv3Framework.h +++ b/Examples/IPlugFaustDSP/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugInstrument/IPlugInstrument.cpp b/Examples/IPlugInstrument/IPlugInstrument.cpp index c547bb35a9..5bdc7a5a51 100644 --- a/Examples/IPlugInstrument/IPlugInstrument.cpp +++ b/Examples/IPlugInstrument/IPlugInstrument.cpp @@ -16,23 +16,21 @@ IPlugInstrument::IPlugInstrument(const InstanceInfo& info) GetParam(kParamLFORateTempo)->InitEnum("LFO Rate", LFO<>::k1, {LFO_TEMPODIV_VALIST}); GetParam(kParamLFORateMode)->InitBool("LFO Sync", true); GetParam(kParamLFODepth)->InitPercentage("LFO Depth"); - + #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); pGraphics->EnableMouseOver(true); pGraphics->EnableMultiTouch(true); - -#ifdef OS_WEB + + #ifdef OS_WEB pGraphics->AttachPopupMenuControl(); -#endif + #endif -// pGraphics->EnableLiveEdit(true); + // pGraphics->EnableLiveEdit(true); pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); const IRECT b = pGraphics->GetBounds().GetPadded(-20.f); const IRECT lfoPanel = b.GetFromLeft(300.f).GetFromTop(200.f); @@ -41,7 +39,7 @@ IPlugInstrument::IPlugInstrument(const InstanceInfo& info) pGraphics->AttachControl(new IVKeyboardControl(keyboardBounds), kCtrlTagKeyboard); pGraphics->AttachControl(new IWheelControl(wheelsBounds.FracRectHorizontal(0.5)), kCtrlTagBender); pGraphics->AttachControl(new IWheelControl(wheelsBounds.FracRectHorizontal(0.5, true), IMidiMsg::EControlChangeMsg::kModWheel)); -// pGraphics->AttachControl(new IVMultiSliderControl<4>(b.GetGridCell(0, 2, 2).GetPadded(-30), "", DEFAULT_STYLE, kParamAttack, EDirection::Vertical, 0.f, 1.f)); + // pGraphics->AttachControl(new IVMultiSliderControl<4>(b.GetGridCell(0, 2, 2).GetPadded(-30), "", DEFAULT_STYLE, kParamAttack, EDirection::Vertical, 0.f, 1.f)); const IRECT controls = b.GetGridCell(1, 2, 2); pGraphics->AttachControl(new IVKnobControl(controls.GetGridCell(0, 2, 6).GetCentredInside(90), kParamGain, "Gain")); pGraphics->AttachControl(new IVKnobControl(controls.GetGridCell(1, 2, 6).GetCentredInside(90), kParamNoteGlideTime, "Glide")); @@ -51,40 +49,45 @@ IPlugInstrument::IPlugInstrument(const InstanceInfo& info) pGraphics->AttachControl(new IVSliderControl(sliders.GetGridCell(2, 1, 4).GetMidHPadded(30.), kParamSustain, "Sustain")); pGraphics->AttachControl(new IVSliderControl(sliders.GetGridCell(3, 1, 4).GetMidHPadded(30.), kParamRelease, "Release")); pGraphics->AttachControl(new IVLEDMeterControl<2>(controls.GetFromRight(100).GetPadded(-30)), kCtrlTagMeter); - + pGraphics->AttachControl(new IVKnobControl(lfoPanel.GetGridCell(0, 0, 2, 3).GetCentredInside(60), kParamLFORateHz, "Rate"), kNoTag, "LFO")->Hide(true); pGraphics->AttachControl(new IVKnobControl(lfoPanel.GetGridCell(0, 0, 2, 3).GetCentredInside(60), kParamLFORateTempo, "Rate"), kNoTag, "LFO")->DisablePrompt(false); pGraphics->AttachControl(new IVKnobControl(lfoPanel.GetGridCell(0, 1, 2, 3).GetCentredInside(60), kParamLFODepth, "Depth"), kNoTag, "LFO"); pGraphics->AttachControl(new IVKnobControl(lfoPanel.GetGridCell(0, 2, 2, 3).GetCentredInside(60), kParamLFOShape, "Shape"), kNoTag, "LFO")->DisablePrompt(false); - pGraphics->AttachControl(new IVSlideSwitchControl(lfoPanel.GetGridCell(1, 0, 2, 3).GetFromTop(30).GetMidHPadded(20), kParamLFORateMode, "Sync", DEFAULT_STYLE.WithShowValue(false).WithShowLabel(false).WithWidgetFrac(0.5f).WithDrawShadows(false), false), kNoTag, "LFO")->SetAnimationEndActionFunction([pGraphics](IControl* pControl) { - bool sync = pControl->GetValue() > 0.5; - pGraphics->HideControl(kParamLFORateHz, sync); - pGraphics->HideControl(kParamLFORateTempo, !sync); - }); - pGraphics->AttachControl(new IVDisplayControl(lfoPanel.GetGridCell(1, 1, 2, 3).Union(lfoPanel.GetGridCell(1, 2, 2, 3)), "", DEFAULT_STYLE, EDirection::Horizontal, 0.f, 1.f, 0.f, 1024), kCtrlTagLFOVis, "LFO"); - + pGraphics + ->AttachControl(new IVSlideSwitchControl(lfoPanel.GetGridCell(1, 0, 2, 3).GetFromTop(30).GetMidHPadded(20), kParamLFORateMode, "Sync", + DEFAULT_STYLE.WithShowValue(false).WithShowLabel(false).WithWidgetFrac(0.5f).WithDrawShadows(false), false), + kNoTag, "LFO") + ->SetAnimationEndActionFunction([pGraphics](IControl* pControl) { + bool sync = pControl->GetValue() > 0.5; + pGraphics->HideControl(kParamLFORateHz, sync); + pGraphics->HideControl(kParamLFORateTempo, !sync); + }); + pGraphics->AttachControl( + new IVDisplayControl(lfoPanel.GetGridCell(1, 1, 2, 3).Union(lfoPanel.GetGridCell(1, 2, 2, 3)), "", DEFAULT_STYLE, EDirection::Horizontal, 0.f, 1.f, 0.f, 1024), kCtrlTagLFOVis, "LFO"); + pGraphics->AttachControl(new IVGroupControl("LFO", "LFO", 10.f, 20.f, 10.f, 10.f)); - - pGraphics->AttachControl(new IVButtonControl(keyboardBounds.GetFromTRHC(200, 30).GetTranslated(0, -30), SplashClickActionFunc, - "Show/Hide Keyboard", DEFAULT_STYLE.WithColor(kFG, COLOR_WHITE).WithLabelText({15.f, EVAlign::Middle})))->SetAnimationEndActionFunction( - [pGraphics](IControl* pCaller) { + + pGraphics + ->AttachControl(new IVButtonControl( + keyboardBounds.GetFromTRHC(200, 30).GetTranslated(0, -30), SplashClickActionFunc, "Show/Hide Keyboard", DEFAULT_STYLE.WithColor(kFG, COLOR_WHITE).WithLabelText({15.f, EVAlign::Middle}))) + ->SetAnimationEndActionFunction([pGraphics](IControl* pCaller) { static bool hide = false; pGraphics->GetControlWithTag(kCtrlTagKeyboard)->Hide(hide = !hide); pGraphics->Resize(PLUG_WIDTH, hide ? PLUG_HEIGHT / 2 : PLUG_HEIGHT, pGraphics->GetDrawScale()); - }); -//#ifdef OS_IOS -// if(!IsOOPAuv3AppExtension()) -// { -// pGraphics->AttachControl(new IVButtonControl(b.GetFromTRHC(100, 100), [pGraphics](IControl* pCaller) { -// dynamic_cast(pGraphics)->LaunchBluetoothMidiDialog(pCaller->GetRECT().L, pCaller->GetRECT().MH()); -// SplashClickActionFunc(pCaller); -// }, "BTMIDI")); -// } -//#endif - - pGraphics->SetQwertyMidiKeyHandlerFunc([pGraphics](const IMidiMsg& msg) { - pGraphics->GetControlWithTag(kCtrlTagKeyboard)->As()->SetNoteFromMidi(msg.NoteNumber(), msg.StatusMsg() == IMidiMsg::kNoteOn); - }); + }); + // #ifdef OS_IOS + // if(!IsOOPAuv3AppExtension()) + // { + // pGraphics->AttachControl(new IVButtonControl(b.GetFromTRHC(100, 100), [pGraphics](IControl* pCaller) { + // dynamic_cast(pGraphics)->LaunchBluetoothMidiDialog(pCaller->GetRECT().L, pCaller->GetRECT().MH()); + // SplashClickActionFunc(pCaller); + // }, "BTMIDI")); + // } + // #endif + + pGraphics->SetQwertyMidiKeyHandlerFunc( + [pGraphics](const IMidiMsg& msg) { pGraphics->GetControlWithTag(kCtrlTagKeyboard)->As()->SetNoteFromMidi(msg.NoteNumber(), msg.StatusMsg() == IMidiMsg::kNoteOn); }); }; #endif } @@ -112,9 +115,9 @@ void IPlugInstrument::OnReset() void IPlugInstrument::ProcessMidiMsg(const IMidiMsg& msg) { TRACE; - + int status = msg.StatusMsg(); - + switch (status) { case IMidiMsg::kNoteOn: @@ -127,28 +130,24 @@ void IPlugInstrument::ProcessMidiMsg(const IMidiMsg& msg) { goto handle; } - default: - return; + default: return; } - + handle: mDSP.ProcessMidiMsg(msg); SendMidiMsg(msg); } -void IPlugInstrument::OnParamChange(int paramIdx) -{ - mDSP.SetParam(paramIdx, GetParam(paramIdx)->Value()); -} +void IPlugInstrument::OnParamChange(int paramIdx) { mDSP.SetParam(paramIdx, GetParam(paramIdx)->Value()); } bool IPlugInstrument::OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pData) { - if(ctrlTag == kCtrlTagBender && msgTag == IWheelControl::kMessageTagSetPitchBendRange) + if (ctrlTag == kCtrlTagBender && msgTag == IWheelControl::kMessageTagSetPitchBendRange) { const int bendRange = *static_cast(pData); mDSP.mSynth.SetPitchBendRange(bendRange); } - + return false; } #endif diff --git a/Examples/IPlugInstrument/IPlugInstrument.h b/Examples/IPlugInstrument/IPlugInstrument.h index dab3c8f96c..155ab82710 100644 --- a/Examples/IPlugInstrument/IPlugInstrument.h +++ b/Examples/IPlugInstrument/IPlugInstrument.h @@ -22,8 +22,8 @@ enum EParams }; #if IPLUG_DSP -// will use EParams in IPlugInstrument_DSP.h -#include "IPlugInstrument_DSP.h" + // will use EParams in IPlugInstrument_DSP.h + #include "IPlugInstrument_DSP.h" #endif enum EControlTags @@ -55,7 +55,7 @@ class IPlugInstrument final : public Plugin bool OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pData) override; private: - IPlugInstrumentDSP mDSP {16}; + IPlugInstrumentDSP mDSP{16}; IPeakAvgSender<2> mMeterSender; ISender<1> mLFOVisSender; #endif diff --git a/Examples/IPlugInstrument/IPlugInstrument_DSP.h b/Examples/IPlugInstrument/IPlugInstrument_DSP.h index 9016d19c85..dff41f62fc 100644 --- a/Examples/IPlugInstrument/IPlugInstrument_DSP.h +++ b/Examples/IPlugInstrument/IPlugInstrument_DSP.h @@ -16,7 +16,7 @@ enum EModulations kNumModulations, }; -template +template class IPlugInstrumentDSP { public: @@ -25,46 +25,40 @@ class IPlugInstrumentDSP { public: Voice() - : mAMPEnv("gain", [&](){ mOSC.Reset(); }) // capture ok on RT thread? + : mAMPEnv("gain", [&]() { mOSC.Reset(); }) // capture ok on RT thread? { -// DBGMSG("new Voice: %i control inputs.\n", static_cast(mInputs.size())); + // DBGMSG("new Voice: %i control inputs.\n", static_cast(mInputs.size())); } - bool GetBusy() const override - { - return mAMPEnv.GetBusy(); - } + bool GetBusy() const override { return mAMPEnv.GetBusy(); } void Trigger(double level, bool isRetrigger) override { mOSC.Reset(); - - if(isRetrigger) + + if (isRetrigger) mAMPEnv.Retrigger(level); else mAMPEnv.Start(level); } - - void Release() override - { - mAMPEnv.Release(); - } + + void Release() override { mAMPEnv.Release(); } void ProcessSamplesAccumulating(T** inputs, T** outputs, int nInputs, int nOutputs, int startIdx, int nFrames) override { // inputs to the synthesizer can just fetch a value every block, like this: -// double gate = mInputs[kVoiceControlGate].endValue; + // double gate = mInputs[kVoiceControlGate].endValue; double pitch = mInputs[kVoiceControlPitch].endValue; double pitchBend = mInputs[kVoiceControlPitchBend].endValue; // or write the entire control ramp to a buffer, like this, to get sample-accurate ramps: mInputs[kVoiceControlTimbre].Write(mTimbreBuffer.Get(), startIdx, nFrames); - + // convert from "1v/oct" pitch space to frequency in Hertz double osc1Freq = 440. * pow(2., pitch + pitchBend + inputs[kModLFO][0]); - + // make sound output for each output channel - for(auto i = startIdx; i < startIdx + nFrames; i++) + for (auto i = startIdx; i < startIdx + nFrames; i++) { float noise = mTimbreBuffer.Get()[i] * Rand(); // an MPE synth can use pressure here in addition to gain @@ -77,19 +71,19 @@ class IPlugInstrumentDSP { mOSC.SetSampleRate(sampleRate); mAMPEnv.SetSampleRate(sampleRate); - + mTimbreBuffer.Resize(blockSize); } void SetProgramNumber(int pgm) override { - //TODO: + // TODO: } // this is called by the VoiceAllocator to set generic control values. void SetControl(int controlNumber, float value) override { - //TODO: + // TODO: } public: @@ -101,15 +95,14 @@ class IPlugInstrumentDSP // noise generator for test uint32_t mRandSeed = 0; - + // return single-precision floating point number on [-1, 1] float Rand() { mRandSeed = mRandSeed * 0x0019660D + 0x3C6EF35F; uint32_t temp = ((mRandSeed >> 9) & 0x007FFFFF) | 0x3F800000; - return (*reinterpret_cast(&temp))*2.f - 3.f; + return (*reinterpret_cast(&temp)) * 2.f - 3.f; } - }; public: @@ -130,16 +123,16 @@ class IPlugInstrumentDSP void ProcessBlock(T** inputs, T** outputs, int nOutputs, int nFrames, double qnPos = 0., bool transportIsRunning = false, double tempo = 120.) { // clear outputs - for(auto i = 0; i < nOutputs; i++) + for (auto i = 0; i < nOutputs; i++) { memset(outputs[i], 0, nFrames * sizeof(T)); } - + mParamSmoother.ProcessBlock(mParamsToSmooth, mModulations.GetList(), nFrames); mLFO.ProcessBlock(mModulations.GetList()[kModLFO], nFrames, qnPos, transportIsRunning, tempo); mSynth.ProcessBlock(mModulations.GetList(), outputs, 0, nOutputs, nFrames); - - for(int s=0; s < nFrames;s++) + + for (int s = 0; s < nFrames; s++) { T smoothedGain = mModulations.GetList()[kModGainSmoother][s]; outputs[0][s] *= smoothedGain; @@ -154,64 +147,43 @@ class IPlugInstrumentDSP mLFO.SetSampleRate(sampleRate); mModulationsData.Resize(blockSize * kNumModulations); mModulations.Empty(); - - for(int i = 0; i < kNumModulations; i++) + + for (int i = 0; i < kNumModulations; i++) { mModulations.Add(mModulationsData.Get() + (blockSize * i)); } } - void ProcessMidiMsg(const IMidiMsg& msg) - { - mSynth.AddMidiMsgToQueue(msg); - } + void ProcessMidiMsg(const IMidiMsg& msg) { mSynth.AddMidiMsgToQueue(msg); } void SetParam(int paramIdx, double value) { using EEnvStage = ADSREnvelope::EStage; - - switch (paramIdx) { - case kParamNoteGlideTime: - mSynth.SetNoteGlideTime(value / 1000.); - break; - case kParamGain: - mParamsToSmooth[kModGainSmoother] = (T) value / 100.; - break; - case kParamSustain: - mParamsToSmooth[kModSustainSmoother] = (T) value / 100.; - break; + + switch (paramIdx) + { + case kParamNoteGlideTime: mSynth.SetNoteGlideTime(value / 1000.); break; + case kParamGain: mParamsToSmooth[kModGainSmoother] = (T)value / 100.; break; + case kParamSustain: mParamsToSmooth[kModSustainSmoother] = (T)value / 100.; break; case kParamAttack: case kParamDecay: case kParamRelease: { EEnvStage stage = static_cast(EEnvStage::kAttack + (paramIdx - kParamAttack)); - mSynth.ForEachVoice([stage, value](SynthVoice& voice) { - dynamic_cast(voice).mAMPEnv.SetStageTime(stage, value); - }); + mSynth.ForEachVoice([stage, value](SynthVoice& voice) { dynamic_cast(voice).mAMPEnv.SetStageTime(stage, value); }); break; } - case kParamLFODepth: - mLFO.SetScalar(value / 100.); - break; - case kParamLFORateTempo: - mLFO.SetQNScalarFromDivision(static_cast(value)); - break; - case kParamLFORateHz: - mLFO.SetFreqCPS(value); - break; - case kParamLFORateMode: - mLFO.SetRateMode(value > 0.5); - break; - case kParamLFOShape: - mLFO.SetShape(static_cast(value)); - break; - default: - break; + case kParamLFODepth: mLFO.SetScalar(value / 100.); break; + case kParamLFORateTempo: mLFO.SetQNScalarFromDivision(static_cast(value)); break; + case kParamLFORateHz: mLFO.SetFreqCPS(value); break; + case kParamLFORateMode: mLFO.SetRateMode(value > 0.5); break; + case kParamLFOShape: mLFO.SetShape(static_cast(value)); break; + default: break; } } - + public: - MidiSynth mSynth { VoiceAllocator::kPolyModePoly, MidiSynth::kDefaultBlockSize }; + MidiSynth mSynth{VoiceAllocator::kPolyModePoly, MidiSynth::kDefaultBlockSize}; WDL_TypedBuf mModulationsData; // Sample data for global modulations (e.g. smoothed sustain) WDL_PtrList mModulations; // Ptrlist for global modulations LogParamSmooth mParamSmoother; diff --git a/Examples/IPlugInstrument/resources/AUv3Framework.h b/Examples/IPlugInstrument/resources/AUv3Framework.h index 0ec53d3075..60c1694980 100644 --- a/Examples/IPlugInstrument/resources/AUv3Framework.h +++ b/Examples/IPlugInstrument/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugMidiEffect/IPlugMidiEffect.cpp b/Examples/IPlugMidiEffect/IPlugMidiEffect.cpp index 2305ff0199..fef2e05f76 100644 --- a/Examples/IPlugMidiEffect/IPlugMidiEffect.cpp +++ b/Examples/IPlugMidiEffect/IPlugMidiEffect.cpp @@ -6,37 +6,34 @@ IPlugMidiEffect::IPlugMidiEffect(const InstanceInfo& info) : Plugin(info, MakeConfig(kNumParams, kNumPresets)) { GetParam(kParamGain)->InitDouble("Gain", 100., 0., 100.0, 0.01, "%"); - + #if IPLUG_DSP SetTailSize(4410000); #endif - + #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { - auto actionFunc = [&](IControl* pCaller) { static bool onoff = false; onoff = !onoff; IMidiMsg msg; constexpr int pitches[3] = {60, 65, 67}; - - for (int i = 0; i<3; i++) + + for (int i = 0; i < 3; i++) { - if(onoff) + if (onoff) msg.MakeNoteOnMsg(pitches[i], 60, 0); else msg.MakeNoteOffMsg(pitches[i], 0); - + SendMidiMsgFromUI(msg); } - + SplashClickActionFunc(pCaller); }; - + pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->AttachPanelBackground(COLOR_GRAY); pGraphics->AttachControl(new IVButtonControl(pGraphics->GetBounds().GetPadded(-10), actionFunc, "Trigger Chord")); @@ -50,8 +47,10 @@ void IPlugMidiEffect::ProcessBlock(sample** inputs, sample** outputs, int nFrame const double gain = GetParam(kParamGain)->Value() / 100.; const int nChans = NOutChansConnected(); - for (auto s = 0; s < nFrames; s++) { - for (auto c = 0; c < nChans; c++) { + for (auto s = 0; s < nFrames; s++) + { + for (auto c = 0; c < nChans; c++) + { outputs[c][s] = outputs[c][s] * gain; } } @@ -60,9 +59,9 @@ void IPlugMidiEffect::ProcessBlock(sample** inputs, sample** outputs, int nFrame void IPlugMidiEffect::ProcessMidiMsg(const IMidiMsg& msg) { TRACE; - + int status = msg.StatusMsg(); - + switch (status) { case IMidiMsg::kNoteOn: @@ -75,10 +74,9 @@ void IPlugMidiEffect::ProcessMidiMsg(const IMidiMsg& msg) { goto handle; } - default: - return; + default: return; } - + handle: SendMidiMsg(msg); } diff --git a/Examples/IPlugMidiEffect/resources/AUv3Framework.h b/Examples/IPlugMidiEffect/resources/AUv3Framework.h index 86ad87cbf4..04273f5e49 100644 --- a/Examples/IPlugMidiEffect/resources/AUv3Framework.h +++ b/Examples/IPlugMidiEffect/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugOSCEditor/IPlugOSCEditor.cpp b/Examples/IPlugOSCEditor/IPlugOSCEditor.cpp index 5524fb94ce..fde32a28df 100644 --- a/Examples/IPlugOSCEditor/IPlugOSCEditor.cpp +++ b/Examples/IPlugOSCEditor/IPlugOSCEditor.cpp @@ -12,56 +12,61 @@ IPlugOSCEditor::IPlugOSCEditor(const InstanceInfo& info) auto logFunc = [&](WDL_String& log) { IGraphics* pGraphics = GetUI(); - - if(pGraphics) + + if (pGraphics) pGraphics->GetControlWithTag(kCtrlTagWebView)->As()->LoadHTML(log.Get()); - + DBGMSG("%s\n", log.Get()); }; - + OSCReceiver::SetLogFunc(logFunc); OSCSender::SetLogFunc(logFunc); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); const IRECT b = pGraphics->GetBounds().GetPadded(-10.f); - + auto setSendIPAndPort = [&, pGraphics](IControl* pCaller) { WDL_String log; const char* ip = pGraphics->GetControlWithTag(kCtrlTagSendIP)->As()->GetStr(); int port = static_cast(pGraphics->GetControlWithTag(kCtrlTagSendPort)->As()->GetRealValue()); SetDestination(ip, port); }; - + IRECT topRow = b.SubRectVertical(3, 0).GetMidVPadded(40.f); IRECT bottomRow = b.SubRectVertical(3, 2); pGraphics->AttachControl(new IVLabelControl(topRow.SubRectHorizontal(3, 0).GetPadded(-10.f), "Send IP", DEFAULT_STYLE.WithValueText(DEFAULT_LABEL_TEXT).WithDrawShadows(false))); - pGraphics->AttachControl(new IEditableTextControl(topRow.SubRectHorizontal(3, 0).GetPadded(-10.f).GetFromBottom(44.f), "127.0.0.1"), kCtrlTagSendIP)->SetActionFunction(setSendIPAndPort)->SetTextEntryLength(32); - + pGraphics->AttachControl(new IEditableTextControl(topRow.SubRectHorizontal(3, 0).GetPadded(-10.f).GetFromBottom(44.f), "127.0.0.1"), kCtrlTagSendIP) + ->SetActionFunction(setSendIPAndPort) + ->SetTextEntryLength(32); + pGraphics->AttachControl(new IVNumberBoxControl(topRow.SubRectHorizontal(3, 1).GetPadded(-10.f), kNoParameter, setSendIPAndPort, "Send Port", DEFAULT_STYLE, 8001, 4000, 10000), kCtrlTagSendPort); - - pGraphics->AttachControl(new IVNumberBoxControl(topRow.SubRectHorizontal(3, 2).GetPadded(-10.f), kNoParameter, [&](IControl* pCaller){ - SetReceivePort(static_cast(pCaller->As()->GetRealValue())); - }, "Receive Port", DEFAULT_STYLE, 8000, 4000, 10000)); - - pGraphics->AttachControl(new IVKnobControl(b.GetCentredInside(100), [&](IControl* pCaller) { - OscMessageWrite msg; - msg.PushWord("gain"); - msg.PushFloatArg((float) pCaller->GetValue()); - SendOSCMessage(msg);} - , "Gain"), kCtrlTagGain); - - pGraphics->AttachControl(new IWebViewControl(bottomRow, true, [](IWebViewControl* pWebView){ - pWebView->LoadHTML("OSC Console"); - }, nullptr, R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugOSCEditor\packages\Microsoft.Web.WebView2.1.0.1462.37\build\native\x64\WebView2Loader.dll)", R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugOSCEditor\)"), kCtrlTagWebView); - + + pGraphics->AttachControl(new IVNumberBoxControl( + topRow.SubRectHorizontal(3, 2).GetPadded(-10.f), kNoParameter, [&](IControl* pCaller) { SetReceivePort(static_cast(pCaller->As()->GetRealValue())); }, "Receive Port", + DEFAULT_STYLE, 8000, 4000, 10000)); + + pGraphics->AttachControl(new IVKnobControl( + b.GetCentredInside(100), + [&](IControl* pCaller) { + OscMessageWrite msg; + msg.PushWord("gain"); + msg.PushFloatArg((float)pCaller->GetValue()); + SendOSCMessage(msg); + }, + "Gain"), + kCtrlTagGain); + + pGraphics->AttachControl( + new IWebViewControl( + bottomRow, true, [](IWebViewControl* pWebView) { pWebView->LoadHTML("OSC Console"); }, nullptr, + R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugOSCEditor\packages\Microsoft.Web.WebView2.1.0.1462.37\build\native\x64\WebView2Loader.dll)", R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugOSCEditor\)"), + kCtrlTagWebView); }; #endif } @@ -71,9 +76,11 @@ void IPlugOSCEditor::ProcessBlock(sample** inputs, sample** outputs, int nFrames { const double gain = GetParam(kGain)->Value() / 100.; const int nChans = NOutChansConnected(); - - for (int s = 0; s < nFrames; s++) { - for (int c = 0; c < nChans; c++) { + + for (int s = 0; s < nFrames; s++) + { + for (int c = 0; c < nChans; c++) + { outputs[c][s] = inputs[c][s] * gain; } } @@ -88,11 +95,12 @@ void IPlugOSCEditor::OnOSCMessage(OscMessageRead& msg) IGraphics* pGraphics = GetUI(); - if(strcmp(msg.GetMessage(), "/gain") == 0) + if (strcmp(msg.GetMessage(), "/gain") == 0) { auto* pValue = msg.PopFloatArg(true); - if (pValue) { - if(pGraphics) + if (pValue) + { + if (pGraphics) pGraphics->GetControlWithTag(kCtrlTagGain)->SetValueFromDelegate(*pValue); } } @@ -101,10 +109,12 @@ void IPlugOSCEditor::OnOSCMessage(OscMessageRead& msg) oscStr.Append(msg.GetMessage()); - while (nArgs) { + while (nArgs) + { msg.GetIndexedArg(index, &type); - switch (type) { + switch (type) + { case 'i': { auto* pValue = msg.PopIntArg(false); @@ -126,19 +136,20 @@ void IPlugOSCEditor::OnOSCMessage(OscMessageRead& msg) oscStr.AppendFormatted(256, " %s", pValue); break; } - default : - break; + default: break; } nArgs--; } - if(oscStr.GetLength()) { + if (oscStr.GetLength()) + { WDL_String str; str.Set("Received message: "); str.Append(&oscStr); DBGMSG("%s\n", str.Get()); - - if(pGraphics) { + + if (pGraphics) + { pGraphics->GetControlWithTag(kCtrlTagWebView)->As()->LoadHTML(str.Get()); } } diff --git a/Examples/IPlugOSCEditor/IPlugOSCEditor.h b/Examples/IPlugOSCEditor/IPlugOSCEditor.h index d46b711528..1dd3b116c8 100644 --- a/Examples/IPlugOSCEditor/IPlugOSCEditor.h +++ b/Examples/IPlugOSCEditor/IPlugOSCEditor.h @@ -27,8 +27,8 @@ class IPlugOSCEditor final : public Plugin, public OSCReceiver, public OSCSender { public: IPlugOSCEditor(const InstanceInfo& info); - + void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; - + void OnOSCMessage(OscMessageRead& msg) override; }; diff --git a/Examples/IPlugOSCEditor/resources/AUv3Framework.h b/Examples/IPlugOSCEditor/resources/AUv3Framework.h index 4b26b50eb9..5890b7c6e2 100644 --- a/Examples/IPlugOSCEditor/resources/AUv3Framework.h +++ b/Examples/IPlugOSCEditor/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugReaperExtension/IPlugReaperExtension.cpp b/Examples/IPlugReaperExtension/IPlugReaperExtension.cpp index ce2c215364..3474c155ad 100644 --- a/Examples/IPlugReaperExtension/IPlugReaperExtension.cpp +++ b/Examples/IPlugReaperExtension/IPlugReaperExtension.cpp @@ -6,75 +6,84 @@ IPlugReaperExtension::IPlugReaperExtension(reaper_plugin_info_t* pRec) : ReaperExtBase(pRec) { - //Use IMPAPI to register any Reaper APIs that you need to use + // Use IMPAPI to register any Reaper APIs that you need to use IMPAPI(GetNumTracks); IMPAPI(CountTracks); IMPAPI(InsertTrackAtIndex); - - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS); - }; - - //Define some lambdas that can be called from either GUI widgets or in response to commands - auto action1 = [](){ - MessageBox(gParent, "Action 1!", "Reaper extension test", MB_OK); //gParent - }; - - auto action2 = [](){ - InsertTrackAtIndex(GetNumTracks(), false); + + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS); }; + + // Define some lambdas that can be called from either GUI widgets or in response to commands + auto action1 = []() { + MessageBox(gParent, "Action 1!", "Reaper extension test", MB_OK); // gParent }; - - //Register an action. args: name: lambda, add menu item, + + auto action2 = []() { InsertTrackAtIndex(GetNumTracks(), false); }; + + // Register an action. args: name: lambda, add menu item, RegisterAction("IPlugReaperExtension: Action 1 - MsgBox", action1, true); RegisterAction("IPlugReaperExtension: Action 2 - AddTrack", action2); - RegisterAction("IPlugReaperExtension: Action 3 - Show/Hide UI", [&]() { ShowHideMainWindow(); mGUIToggle = !mGUIToggle; }, true, &mGUIToggle); - + RegisterAction( + "IPlugReaperExtension: Action 3 - Show/Hide UI", + [&]() { + ShowHideMainWindow(); + mGUIToggle = !mGUIToggle; + }, + true, &mGUIToggle); + mLayoutFunc = [&](IGraphics* pGraphics) { const IRECT bounds = pGraphics->GetBounds(); - - if(pGraphics->NControls()) { + + if (pGraphics->NControls()) + { pGraphics->GetBackgroundControl()->SetTargetAndDrawRECTs(bounds); return; } - + pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->AttachPanelBackground(COLOR_GRAY); -// pGraphics->AttachCornerResizer(kUIResizerSize, true); - pGraphics->AttachControl(new IVButtonControl(bounds.GetGridCell(0, 3, 1).GetPadded(-20.).SubRectVertical(2, 0).GetMidVPadded(20), - [&](IControl* pCaller) { - SplashClickActionFunc(pCaller); - action2(); - }, "Action 2 - Add Track")); - -// pGraphics->AttachControl(new IVButtonControl(bounds.GetGridCell(0, 2, 2).GetPadded(-20.).SubRectVertical(2, 1).GetMidVPadded(20), -// [&](IControl* pCaller) { -// SplashClickActionFunc(pCaller); -// ToggleDocking(); -// }, "Dock")); - + // pGraphics->AttachCornerResizer(kUIResizerSize, true); + pGraphics->AttachControl(new IVButtonControl( + bounds.GetGridCell(0, 3, 1).GetPadded(-20.).SubRectVertical(2, 0).GetMidVPadded(20), + [&](IControl* pCaller) { + SplashClickActionFunc(pCaller); + action2(); + }, + "Action 2 - Add Track")); + + // pGraphics->AttachControl(new IVButtonControl(bounds.GetGridCell(0, 2, 2).GetPadded(-20.).SubRectVertical(2, 1).GetMidVPadded(20), + // [&](IControl* pCaller) { + // SplashClickActionFunc(pCaller); + // ToggleDocking(); + // }, "Dock")); + WDL_String str; mPrevTrackCount = CountTracks(0); str.SetFormatted(64, "NumTracks: %i", mPrevTrackCount); - + pGraphics->AttachControl(new ITextControl(bounds.GetGridCell(1, 3, 1), str.Get(), IText(24, EAlign::Center)), kCtrlTagText); - - pGraphics->AttachControl(new IVSliderControl(bounds.GetGridCell(2, 3, 1).GetPadded(-20), [](IControl* pCaller) { - WDL_String valStr; - valStr.SetFormatted(32, "slider %f\n", pCaller->GetValue()); - ShowConsoleMsg(valStr.Get()); - }, "Value:", DEFAULT_STYLE, true, EDirection::Horizontal)); - + + pGraphics->AttachControl(new IVSliderControl( + bounds.GetGridCell(2, 3, 1).GetPadded(-20), + [](IControl* pCaller) { + WDL_String valStr; + valStr.SetFormatted(32, "slider %f\n", pCaller->GetValue()); + ShowConsoleMsg(valStr.Get()); + }, + "Value:", DEFAULT_STYLE, true, EDirection::Horizontal)); }; } void IPlugReaperExtension::OnIdle() { int tracks = CountTracks(0); - - if(tracks != mPrevTrackCount) { + + if (tracks != mPrevTrackCount) + { mPrevTrackCount = tracks; - - if(GetUI()) { + + if (GetUI()) + { GetUI()->GetControlWithTag(kCtrlTagText)->As()->SetStrFmt(64, "NumTracks: %i", tracks); } } diff --git a/Examples/IPlugReaperExtension/IPlugReaperExtension.h b/Examples/IPlugReaperExtension/IPlugReaperExtension.h index 9477b366d7..21dff81270 100644 --- a/Examples/IPlugReaperExtension/IPlugReaperExtension.h +++ b/Examples/IPlugReaperExtension/IPlugReaperExtension.h @@ -17,9 +17,8 @@ class IPlugReaperExtension : public ReaperExtBase IPlugReaperExtension(reaper_plugin_info_t* pRec); void OnIdle() override; void OnUIClose() override { mGUIToggle = 0; } - + private: int mPrevTrackCount = 0; int mGUIToggle = 0; }; - diff --git a/Examples/IPlugResponsiveUI/IPlugResponsiveUI.cpp b/Examples/IPlugResponsiveUI/IPlugResponsiveUI.cpp index d15af70942..ee6cbd89f7 100644 --- a/Examples/IPlugResponsiveUI/IPlugResponsiveUI.cpp +++ b/Examples/IPlugResponsiveUI/IPlugResponsiveUI.cpp @@ -10,13 +10,13 @@ IPlugResponsiveUI::IPlugResponsiveUI(const InstanceInfo& info) #if IPLUG_EDITOR // http://bit.ly/2S64BDd mMakeGraphicsFunc = [&]() { -#ifdef OS_WEB + #ifdef OS_WEB int w, h; GetScreenDimensions(w, h); return MakeGraphics(*this, w, h, 1.f); -#else + #else return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS); -#endif + #endif }; mLayoutFunc = [&](IGraphics* pGraphics) { @@ -27,7 +27,8 @@ IPlugResponsiveUI::IPlugResponsiveUI(const InstanceInfo& info) IRECT keys = main.FracRectVertical(0.25, false); IRECT scope = main.FracRectVertical(0.75, true).GetPadded(-10.f); IRECT gain = scope.ReduceFromRight(100.f); - switch (ctrlIdx) { + switch (ctrlIdx) + { case 1: return keys; case 2: return gain; case 3: return scope; @@ -37,8 +38,10 @@ IPlugResponsiveUI::IPlugResponsiveUI(const InstanceInfo& info) }; // Layout controls on resize - if(pGraphics->NControls()) { - for (int ctrlIdx = 0; ctrlIdx < pGraphics->NControls(); ctrlIdx++) { + if (pGraphics->NControls()) + { + for (int ctrlIdx = 0; ctrlIdx < pGraphics->NControls(); ctrlIdx++) + { pGraphics->GetControl(ctrlIdx)->SetTargetAndDrawRECTs(GetBounds(ctrlIdx, b)); } return; @@ -49,7 +52,7 @@ IPlugResponsiveUI::IPlugResponsiveUI(const InstanceInfo& info) pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->AttachPopupMenuControl(); - //Create controls + // Create controls pGraphics->AttachPanelBackground(COLOR_GRAY); pGraphics->AttachControl(new IVKeyboardControl(GetBounds(1, b))); pGraphics->AttachControl(new IVSliderControl(GetBounds(2, b), kGain)); @@ -65,10 +68,7 @@ void IPlugResponsiveUI::OnParentWindowResize(int width, int height) GetUI()->Resize(width, height, 1.f, false); } -bool IPlugResponsiveUI::OnHostRequestingSupportedViewConfiguration(int width, int height) -{ - return ConstrainEditorResize(width, height); -} +bool IPlugResponsiveUI::OnHostRequestingSupportedViewConfiguration(int width, int height) { return ConstrainEditorResize(width, height); } void IPlugResponsiveUI::OnHostSelectedViewConfiguration(int width, int height) { @@ -81,45 +81,40 @@ void IPlugResponsiveUI::OnHostSelectedViewConfiguration(int width, int height) void IPlugResponsiveUI::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double gain = GetParam(kGain)->DBToAmp(); - - for (int s = 0; s < nFrames; s++) { + + for (int s = 0; s < nFrames; s++) + { outputs[0][s] = mOsc.Process() * gain; outputs[1][s] = outputs[0][s]; } - + mScopeSender.ProcessBlock(outputs, nFrames, kCtrlTagScope, 1); } void IPlugResponsiveUI::ProcessMidiMsg(const IMidiMsg& msg) { TRACE; - + int status = msg.StatusMsg(); - + switch (status) { case IMidiMsg::kNoteOn: -// case IMidiMsg::kNoteOff: - { - goto handle; - } - default: - return; + // case IMidiMsg::kNoteOff: + { + goto handle; + } + default: return; } - + handle: - - auto midi2CPS = [](int pitch) { - return 440. * pow(2., (pitch - 69.) / 12.); - }; - + + auto midi2CPS = [](int pitch) { return 440. * pow(2., (pitch - 69.) / 12.); }; + mOsc.SetFreqCPS(midi2CPS(msg.NoteNumber())); SendMidiMsg(msg); } -void IPlugResponsiveUI::OnIdle() -{ - mScopeSender.TransmitData(*this); -} +void IPlugResponsiveUI::OnIdle() { mScopeSender.TransmitData(*this); } #endif diff --git a/Examples/IPlugResponsiveUI/IPlugResponsiveUI.h b/Examples/IPlugResponsiveUI/IPlugResponsiveUI.h index 46f15926cf..44d03a03da 100644 --- a/Examples/IPlugResponsiveUI/IPlugResponsiveUI.h +++ b/Examples/IPlugResponsiveUI/IPlugResponsiveUI.h @@ -3,8 +3,8 @@ #include "IPlug_include_in_plug_hdr.h" #if IPLUG_DSP -#include "Oscillator.h" -#include "ISender.h" + #include "Oscillator.h" + #include "ISender.h" #endif const int kNumPresets = 1; @@ -34,13 +34,14 @@ class IPlugResponsiveUI final : public Plugin bool OnHostRequestingSupportedViewConfiguration(int width, int height) override; void OnHostSelectedViewConfiguration(int width, int height) override; #endif - + #if IPLUG_DSP // http://bit.ly/2S64BDd void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; void ProcessMidiMsg(const IMidiMsg& msg) override; void OnIdle() override; + private: - FastSinOscillator mOsc {440.f}; + FastSinOscillator mOsc{440.f}; IBufferSender<> mScopeSender; #endif }; diff --git a/Examples/IPlugResponsiveUI/resources/AUv3Framework.h b/Examples/IPlugResponsiveUI/resources/AUv3Framework.h index dbf75e6dc8..de31011908 100644 --- a/Examples/IPlugResponsiveUI/resources/AUv3Framework.h +++ b/Examples/IPlugResponsiveUI/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugSideChain/IPlugSideChain.cpp b/Examples/IPlugSideChain/IPlugSideChain.cpp index d2646140d1..535307315a 100644 --- a/Examples/IPlugSideChain/IPlugSideChain.cpp +++ b/Examples/IPlugSideChain/IPlugSideChain.cpp @@ -11,42 +11,40 @@ IPlugSideChain::IPlugSideChain(const InstanceInfo& info) GetParam(kGain)->InitGain("Gain"); - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, 1.); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, 1.); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); IRECT b = pGraphics->GetBounds().GetPadded(-10.f); IRECT s = b.ReduceFromRight(50.f); - + const IVStyle meterStyle = DEFAULT_STYLE.WithColor(kFG, COLOR_WHITE.WithOpacity(0.3f)); - pGraphics->AttachControl(mInputMeter = new IVPeakAvgMeterControl<4>(b.FracRectVertical(0.5, true), "Inputs", meterStyle, EDirection::Horizontal, {"Main L", "Main R", "SideChain L", "SideChain R"}), kCtrlTagInputMeter); + pGraphics->AttachControl( + mInputMeter = new IVPeakAvgMeterControl<4>(b.FracRectVertical(0.5, true), "Inputs", meterStyle, EDirection::Horizontal, {"Main L", "Main R", "SideChain L", "SideChain R"}), kCtrlTagInputMeter); pGraphics->AttachControl(mOutputMeter = new IVPeakAvgMeterControl<2>(b.FracRectVertical(0.5, false), "Outputs", meterStyle, EDirection::Vertical, {"Main L", "Main R"}), kCtrlTagOutputMeter); pGraphics->AttachControl(new IVSliderControl(s, kGain)); }; - } void IPlugSideChain::OnIdle() { mInputPeakSender.TransmitData(*this); mOutputPeakSender.TransmitData(*this); - + if (mSendUpdate) { - if(GetUI()) + if (GetUI()) { mInputMeter->SetTrackName(0, mInputChansConnected[0] ? "Main L (Connected)" : "Main L (Not connected)"); mInputMeter->SetTrackName(1, mInputChansConnected[1] ? "Main R (Connected)" : "Main R (Not connected)"); mInputMeter->SetTrackName(2, mInputChansConnected[2] ? "SideChain L (Connected)" : "SideChain L (Not connected)"); mInputMeter->SetTrackName(3, mInputChansConnected[3] ? "SideChain R (Connected)" : "SideChain R (Not connected)"); - + mOutputMeter->SetTrackName(0, mOutputChansConnected[0] ? "Main L (Connected)" : "Main L (Not connected)"); mOutputMeter->SetTrackName(1, mOutputChansConnected[1] ? "Main R (Connected)" : "Main R (Not connected)"); - + GetUI()->SetAllControlsDirty(); } mSendUpdate = false; @@ -74,54 +72,60 @@ void IPlugSideChain::GetBusName(ERoute direction, int busIdx, int nBuses, WDL_St } } -void IPlugSideChain::OnActivate(bool enable) -{ - mSendUpdate = true; -} +void IPlugSideChain::OnActivate(bool enable) { mSendUpdate = true; } void IPlugSideChain::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double gain = GetParam(kGain)->DBToAmp(); const int nChans = NOutChansConnected(); - for (int i=0; i < 4; i++) { + for (int i = 0; i < 4; i++) + { bool connected = IsChannelConnected(ERoute::kInput, i); - if(connected != mInputChansConnected[i]) { + if (connected != mInputChansConnected[i]) + { mInputChansConnected[i] = connected; mSendUpdate = true; } } - - for (int i=0; i < 2; i++) { + + for (int i = 0; i < 2; i++) + { bool connected = IsChannelConnected(ERoute::kOutput, i); - if(connected != mOutputChansConnected[i]) { + if (connected != mOutputChansConnected[i]) + { mOutputChansConnected[i] = connected; mSendUpdate = true; } } - - for (int s = 0; s < nFrames; s++) { - for (int c = 0; c < nChans; c++) { + + for (int s = 0; s < nFrames; s++) + { + for (int c = 0; c < nChans; c++) + { outputs[c][s] = inputs[c][s] * gain; } } - + /* - + Logic/Garageband have an long-standing bug where if no sidechain is selected, the same buffers that are sent to the first bus, are sent to the sidechain bus https://forum.juce.com/t/sidechain-is-not-silent-as-expected-au-logic-x-10-2-2/17068/8 https://lists.apple.com/archives/coreaudio-api/2012/Feb/msg00127.html - + Imperfect hack around it here. Probably a better solution is to have an enable sidechain button in the plug-in UI, in addition to the host sidechain routing. */ - + #if defined OS_MAC && defined AU_API - if(GetHost() == kHostLogic || GetHost() == kHostGarageBand) { + if (GetHost() == kHostLogic || GetHost() == kHostGarageBand) + { const int sz = nFrames * sizeof(sample); - if(!memcmp(inputs[0], inputs[2], sz)) { + if (!memcmp(inputs[0], inputs[2], sz)) + { memset(inputs[2], 0, sz); mInputChansConnected[2] = false; } - if(!memcmp(inputs[1], inputs[3], sz)) { + if (!memcmp(inputs[1], inputs[3], sz)) + { memset(inputs[3], 0, sz); mInputChansConnected[3] = false; } diff --git a/Examples/IPlugSideChain/IPlugSideChain.h b/Examples/IPlugSideChain/IPlugSideChain.h index 34f4f1d8c5..f5f7650bb6 100644 --- a/Examples/IPlugSideChain/IPlugSideChain.h +++ b/Examples/IPlugSideChain/IPlugSideChain.h @@ -42,7 +42,7 @@ class IPlugSideChain final : public Plugin bool mInputChansConnected[4] = {}; bool mOutputChansConnected[2] = {}; bool mSendUpdate = false; - + IPeakAvgSender<4> mInputPeakSender; IPeakAvgSender<2> mOutputPeakSender; IVMeterControl<4>* mInputMeter = nullptr; diff --git a/Examples/IPlugSideChain/config.h b/Examples/IPlugSideChain/config.h index 94f1e5fe99..98abdeb68a 100644 --- a/Examples/IPlugSideChain/config.h +++ b/Examples/IPlugSideChain/config.h @@ -15,7 +15,8 @@ #define SHARED_RESOURCES_SUBPATH "IPlugSideChain" -#define PLUG_CHANNEL_IO "\ +#define PLUG_CHANNEL_IO \ + "\ 1-1 \ 1.1-1 \ 1.2-1 \ diff --git a/Examples/IPlugSideChain/resources/AUv3Framework.h b/Examples/IPlugSideChain/resources/AUv3Framework.h index 5c972f2152..1b7d1a857a 100644 --- a/Examples/IPlugSideChain/resources/AUv3Framework.h +++ b/Examples/IPlugSideChain/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugSurroundEffect/IPlugSurroundEffect.cpp b/Examples/IPlugSurroundEffect/IPlugSurroundEffect.cpp index 5f62a0b1fb..0957f00319 100644 --- a/Examples/IPlugSurroundEffect/IPlugSurroundEffect.cpp +++ b/Examples/IPlugSurroundEffect/IPlugSurroundEffect.cpp @@ -6,7 +6,7 @@ uint64_t GetAPIBusTypeForChannelIOConfig(int configIdx, ERoute dir, int busIdx, { assert(pConfig != nullptr); assert(busIdx >= 0 && busIdx < pConfig->NBuses(dir)); - + int numChans = pConfig->GetBusInfo(dir, busIdx)->NChans(); #if defined AU_API || defined AUv3_API @@ -17,10 +17,10 @@ uint64_t GetAPIBusTypeForChannelIOConfig(int configIdx, ERoute dir, int busIdx, case 2: APIBusTypes->Add(kAudioChannelLayoutTag_Stereo); break; case 6: APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_5_1); break; case 8: APIBusTypes->Add(kAudioChannelLayoutTag_AudioUnit_7_1); break; -#if defined (MAC_OS_VERSION_11_0) + #if defined(MAC_OS_VERSION_11_0) case 10: APIBusTypes->Add(kAudioChannelLayoutTag_Atmos_7_1_2); break; case 12: APIBusTypes->Add(kAudioChannelLayoutTag_Atmos_7_1_4); break; -#endif + #endif default: APIBusTypes->Add(kAudioChannelLayoutTag_DiscreteInOrder | numChans); break; } return 0; @@ -57,10 +57,8 @@ IPlugSurroundEffect::IPlugSurroundEffect(const InstanceInfo& info) GetParam(kGain)->InitDouble("Gain", 0., 0., 100.0, 0.01, "%"); #if IPLUG_EDITOR // http://bit.ly/2S64BDd - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); pGraphics->AttachPanelBackground(COLOR_GRAY); @@ -69,8 +67,10 @@ IPlugSurroundEffect::IPlugSurroundEffect(const InstanceInfo& info) IRECT s = b.ReduceFromRight(50.f); const IVStyle meterStyle = DEFAULT_STYLE.WithColor(kFG, COLOR_WHITE.WithOpacity(0.3f)); - pGraphics->AttachControl(new IVPeakAvgMeterControl<12>(b.FracRectVertical(0.5, true), "Inputs", meterStyle, EDirection::Vertical, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}), kCtrlTagInputMeter); - pGraphics->AttachControl(new IVPeakAvgMeterControl<12>(b.FracRectVertical(0.5, false), "Outputs", meterStyle, EDirection::Vertical, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}), kCtrlTagOutputMeter); + pGraphics->AttachControl( + new IVPeakAvgMeterControl<12>(b.FracRectVertical(0.5, true), "Inputs", meterStyle, EDirection::Vertical, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}), kCtrlTagInputMeter); + pGraphics->AttachControl( + new IVPeakAvgMeterControl<12>(b.FracRectVertical(0.5, false), "Outputs", meterStyle, EDirection::Vertical, {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"}), kCtrlTagOutputMeter); pGraphics->AttachControl(new IVSliderControl(s, kGain)); }; #endif @@ -87,9 +87,11 @@ void IPlugSurroundEffect::ProcessBlock(sample** inputs, sample** outputs, int nF { const double gain = GetParam(kGain)->Value() / 100.; const int nChans = NOutChansConnected(); - - for (int s = 0; s < nFrames; s++) { - for (int c = 0; c < nChans; c++) { + + for (int s = 0; s < nFrames; s++) + { + for (int c = 0; c < nChans; c++) + { outputs[c][s] = inputs[c][s] * gain; } } diff --git a/Examples/IPlugSurroundEffect/IPlugSurroundEffect.h b/Examples/IPlugSurroundEffect/IPlugSurroundEffect.h index 7ddee01f35..9dc0f93512 100644 --- a/Examples/IPlugSurroundEffect/IPlugSurroundEffect.h +++ b/Examples/IPlugSurroundEffect/IPlugSurroundEffect.h @@ -29,7 +29,7 @@ class IPlugSurroundEffect final : public Plugin #if IPLUG_DSP // http://bit.ly/2S64BDd void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; void OnIdle() override; - + IPeakAvgSender<12> mInputPeakSender; IPeakAvgSender<12> mOutputPeakSender; #endif diff --git a/Examples/IPlugSurroundEffect/resources/AUv3Framework.h b/Examples/IPlugSurroundEffect/resources/AUv3Framework.h index f4597bc2b4..9514c1b8b1 100644 --- a/Examples/IPlugSurroundEffect/resources/AUv3Framework.h +++ b/Examples/IPlugSurroundEffect/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Examples/IPlugSwiftUI/IPlugSwiftUI-Shared.h b/Examples/IPlugSwiftUI/IPlugSwiftUI-Shared.h index 75aeae5596..ef08659d58 100644 --- a/Examples/IPlugSwiftUI/IPlugSwiftUI-Shared.h +++ b/Examples/IPlugSwiftUI/IPlugSwiftUI-Shared.h @@ -14,6 +14,6 @@ const NSInteger kUpdateMessage = 0; // must match ISender::kUpdateMessage const NSInteger kMsgTagHello = 1; const NSInteger kMsgTagRestorePreset = 2; -const NSInteger kDataPacketSize = 1024; //floats +const NSInteger kDataPacketSize = 1024; // floats #endif /* IPlugSwiftUI_Shared_h */ diff --git a/Examples/IPlugSwiftUI/IPlugSwiftUI.h b/Examples/IPlugSwiftUI/IPlugSwiftUI.h index 88b9caa63d..39533dc054 100644 --- a/Examples/IPlugSwiftUI/IPlugSwiftUI.h +++ b/Examples/IPlugSwiftUI/IPlugSwiftUI.h @@ -11,7 +11,7 @@ class IPlugSwiftUI final : public Plugin IPlugSwiftUI(const InstanceInfo& info); void* OpenWindow(void* pParent) override; - + void OnParentWindowResize(int width, int height) override; bool OnHostRequestingSupportedViewConfiguration(int width, int height) override; diff --git a/Examples/IPlugSwiftUI/resources/AUv3Framework.h b/Examples/IPlugSwiftUI/resources/AUv3Framework.h index 43d52b13d1..c68951cbb7 100644 --- a/Examples/IPlugSwiftUI/resources/AUv3Framework.h +++ b/Examples/IPlugSwiftUI/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif #import diff --git a/Examples/IPlugWebUI/IPlugWebUI.cpp b/Examples/IPlugWebUI/IPlugWebUI.cpp index db4bb48a3d..9911ed0bc0 100644 --- a/Examples/IPlugWebUI/IPlugWebUI.cpp +++ b/Examples/IPlugWebUI/IPlugWebUI.cpp @@ -8,8 +8,7 @@ IPlugWebUI::IPlugWebUI(const InstanceInfo& info) // Hard-coded paths must be modified! #ifdef OS_WIN - SetWebViewPaths(R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugWebUI\packages\Microsoft.Web.WebView2.1.0.1462.37\build\native\x64\WebView2Loader.dll)", - R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugWebUI)"); + SetWebViewPaths(R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugWebUI\packages\Microsoft.Web.WebView2.1.0.1462.37\build\native\x64\WebView2Loader.dll)", R"(C:\Users\oli\Dev\iPlug2\Examples\IPlugWebUI)"); #endif @@ -19,10 +18,10 @@ IPlugWebUI::IPlugWebUI(const InstanceInfo& info) #else LoadFile("index.html", GetBundleID()); #endif - + EnableScroll(false); }; - + MakePreset("One", -70.); MakePreset("Two", -30.); MakePreset("Three", 0.); @@ -31,20 +30,20 @@ IPlugWebUI::IPlugWebUI(const InstanceInfo& info) void IPlugWebUI::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double gain = GetParam(kGain)->DBToAmp(); - + sample maxVal = 0.; - + mOscillator.ProcessBlock(inputs[0], nFrames); // comment for audio in for (int s = 0; s < nFrames; s++) { outputs[0][s] = inputs[0][s] * mGainSmoother.Process(gain); outputs[1][s] = outputs[0][s]; // copy left - + maxVal += std::fabs(outputs[0][s]); } - - mLastPeak = static_cast(maxVal / (sample) nFrames); + + mLastPeak = static_cast(maxVal / (sample)nFrames); } void IPlugWebUI::OnReset() @@ -58,14 +57,14 @@ bool IPlugWebUI::OnMessage(int msgTag, int ctrlTag, int dataSize, const void* pD { if (msgTag == kMsgTagButton1) Resize(512, 335); - else if(msgTag == kMsgTagButton2) + else if (msgTag == kMsgTagButton2) Resize(1024, 335); - else if(msgTag == kMsgTagButton3) + else if (msgTag == kMsgTagButton3) Resize(1024, 768); else if (msgTag == kMsgTagBinaryTest) { auto uint8Data = reinterpret_cast(pData); - DBGMSG("Data Size %i bytes\n", dataSize); + DBGMSG("Data Size %i bytes\n", dataSize); DBGMSG("Byte values: %i, %i, %i, %i\n", uint8Data[0], uint8Data[1], uint8Data[2], uint8Data[3]); } @@ -78,15 +77,12 @@ void IPlugWebUI::OnIdle() SendControlValueFromDelegate(kCtrlTagMeter, mLastPeak); } -void IPlugWebUI::OnParamChange(int paramIdx) -{ - DBGMSG("gain %f\n", GetParam(paramIdx)->Value()); -} +void IPlugWebUI::OnParamChange(int paramIdx) { DBGMSG("gain %f\n", GetParam(paramIdx)->Value()); } void IPlugWebUI::ProcessMidiMsg(const IMidiMsg& msg) { TRACE; - + msg.PrintMsg(); SendMidiMsg(msg); } diff --git a/Examples/IPlugWebUI/IPlugWebUI.h b/Examples/IPlugWebUI/IPlugWebUI.h index 687c81256b..3f810f25a9 100644 --- a/Examples/IPlugWebUI/IPlugWebUI.h +++ b/Examples/IPlugWebUI/IPlugWebUI.h @@ -31,7 +31,7 @@ class IPlugWebUI final : public Plugin { public: IPlugWebUI(const InstanceInfo& info); - + void ProcessBlock(sample** inputs, sample** outputs, int nFrames) override; void ProcessMidiMsg(const IMidiMsg& msg) override; void OnReset() override; @@ -41,6 +41,6 @@ class IPlugWebUI final : public Plugin private: float mLastPeak = 0.; - FastSinOscillator mOscillator {0., 440.}; + FastSinOscillator mOscillator{0., 440.}; LogParamSmooth mGainSmoother; }; diff --git a/Examples/IPlugWebUI/resources/AUv3Framework.h b/Examples/IPlugWebUI/resources/AUv3Framework.h index 2145b9b8f1..59c60f03d4 100644 --- a/Examples/IPlugWebUI/resources/AUv3Framework.h +++ b/Examples/IPlugWebUI/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Tests/IGraphicsStressTest/IGraphicsStressTest.cpp b/Tests/IGraphicsStressTest/IGraphicsStressTest.cpp index 16912661e5..83e04139e2 100644 --- a/Tests/IGraphicsStressTest/IGraphicsStressTest.cpp +++ b/Tests/IGraphicsStressTest/IGraphicsStressTest.cpp @@ -7,18 +7,16 @@ IGraphicsStressTest::IGraphicsStressTest(const InstanceInfo& info) : Plugin(info, MakeConfig(kNumParams, 1)) { GetParam(0)->InitGain("Dummy"); - + #if IPLUG_EDITOR - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS); - }; + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS); }; #endif } #if IPLUG_EDITOR void IGraphicsStressTest::OnParentWindowResize(int width, int height) { - if(GetUI()) + if (GetUI()) GetUI()->Resize(width, height, 1.f, false); } @@ -29,43 +27,53 @@ void IGraphicsStressTest::LayoutUI(IGraphics* pGraphics) auto labelsArea = visualsArea.GetFromBottom(50.f); auto buttonsArea = bounds.GetFromBRHC(bounds.W(), 50).GetPadded(-5.f); - if(pGraphics->NControls()) { + if (pGraphics->NControls()) + { pGraphics->GetBackgroundControl()->SetTargetAndDrawRECTs(bounds); pGraphics->GetControl(1)->SetTargetAndDrawRECTs(visualsArea); pGraphics->GetControlWithTag(kCtrlTagNumThings)->SetTargetAndDrawRECTs(labelsArea.GetGridCell(0, 1, 2)); pGraphics->GetControlWithTag(kCtrlTagTestNum)->SetTargetAndDrawRECTs(labelsArea.GetGridCell(1, 1, 2)); - - for(int button=0;button<6;button++) { + + for (int button = 0; button < 6; button++) + { pGraphics->GetControlWithTag(kCtrlTagButton1 + button)->SetTargetAndDrawRECTs(buttonsArea.GetGridCell(button, 1, 6)); } return; } - + pGraphics->AttachCornerResizer(EUIResizerMode::Size, true); - - enum class EFunc {Next, Prev, More, Less, Set}; - - auto DoFunc = [&](EFunc func, int thing = 0){ - switch (func) { + + enum class EFunc + { + Next, + Prev, + More, + Less, + Set + }; + + auto DoFunc = [&](EFunc func, int thing = 0) { + switch (func) + { case EFunc::Next: this->mKindOfThing++; break; case EFunc::Prev: this->mKindOfThing--; break; case EFunc::More: this->mNumberOfThings++; break; case EFunc::Less: this->mNumberOfThings--; break; case EFunc::Set: this->mKindOfThing = thing; break; - default: - break; + default: break; } - + GetUI()->GetControlWithTag(kCtrlTagNumThings)->As()->SetStrFmt(64, "Number of things = %i", mNumberOfThings); GetUI()->GetControlWithTag(kCtrlTagTestNum)->As()->SetStrFmt(64, "Test %i/%i", this->mKindOfThing, 32); GetUI()->SetAllControlsDirty(); }; - - pGraphics->SetKeyHandlerFunc([DoFunc](const IKeyPress& key, bool isUp) - { - if(!isUp) { - switch (key.VK) { + + pGraphics->SetKeyHandlerFunc([DoFunc](const IKeyPress& key, bool isUp) { + if (!isUp) + { + switch (key.VK) + { case kVK_UP: DoFunc(EFunc::More); return true; case kVK_DOWN: DoFunc(EFunc::Less); return true; case kVK_TAB: key.S ? DoFunc(EFunc::Prev) : DoFunc(EFunc::Next); return true; @@ -74,97 +82,100 @@ void IGraphicsStressTest::LayoutUI(IGraphics* pGraphics) } return false; }); - + pGraphics->EnableMouseOver(false); pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); pGraphics->AttachPanelBackground(COLOR_GRAY); - pGraphics->AttachControl(new ILambdaControl(visualsArea, [&](ILambdaControl* pCaller, IGraphics& g, IRECT& r) { - static IBitmap smiley = g.LoadBitmap(SMILEY_FN); - static ISVG tiger = g.LoadSVG(TIGER_FN); - - g.FillRect(COLOR_WHITE, r); - - if(this->mKindOfThing == 0) - { - g.DrawText(IText(30), "Press tab to go to next test", r); - g.DrawText(IText(30), "up/down to change the # of things", r.GetVShifted(40.f)); - } - else - // if (!g.CheckLayer(pCaller->mLayer)) - { - // g.StartLayer(r); - - for (int i=0; imNumberOfThings; i++) + pGraphics->AttachControl(new ILambdaControl( + visualsArea, + [&](ILambdaControl* pCaller, IGraphics& g, IRECT& r) { + static IBitmap smiley = g.LoadBitmap(SMILEY_FN); + static ISVG tiger = g.LoadSVG(TIGER_FN); + + g.FillRect(COLOR_WHITE, r); + + if (this->mKindOfThing == 0) + { + g.DrawText(IText(30), "Press tab to go to next test", r); + g.DrawText(IText(30), "up/down to change the # of things", r.GetVShifted(40.f)); + } + else + // if (!g.CheckLayer(pCaller->mLayer)) { - IRECT rr = r.GetRandomSubRect(); - IColor rc = IColor::GetRandomColor(); - IBlend rb = {}; - static bool dir = 0; - static float thickness = 5.f; - static float roundness = 5.f; - float rrad1 = rand() % 360; - float rrad2 = rand() % 360; - - switch (this->mKindOfThing) + // g.StartLayer(r); + + for (int i = 0; i < this->mNumberOfThings; i++) { - case 1: g.DrawRect(rc, rr, &rb); break; - case 2: g.FillRect(rc, rr, &rb); break; - case 3: g.DrawRoundRect(rc, rr, roundness, &rb); break; - case 4: g.FillRoundRect(rc, rr, roundness, &rb); break; - case 5: g.DrawEllipse(rc, rr, &rb); break; - case 6: g.FillEllipse(rc, rr, &rb); break; - case 7: g.DrawArc(rc, rr.MW(), rr.MH(), rr.W() > rr.H() ? rr.H() : rr.W(), rrad1, rrad2, &rb,thickness); break; - case 8: g.FillArc(rc, rr.MW(), rr.MH(), rr.W() > rr.H() ? rr.H() : rr.W(), rrad1, rrad2, &rb); break; - case 9: g.DrawLine(rc, dir == 0 ? rr.L : rr.R, rr.B, dir == 0 ? rr.R : rr.L, rr.T, &rb,thickness); break; - case 10: g.DrawDottedLine(rc, dir == 0 ? rr.L : rr.R, rr.B, dir == 0 ? rr.R : rr.L, rr.T, &rb, thickness); break; - case 11: g.DrawFittedBitmap(smiley, rr, &rb); break; - case 12: g.DrawSVG(tiger, rr); break; - default: - break; + IRECT rr = r.GetRandomSubRect(); + IColor rc = IColor::GetRandomColor(); + IBlend rb = {}; + static bool dir = 0; + static float thickness = 5.f; + static float roundness = 5.f; + float rrad1 = rand() % 360; + float rrad2 = rand() % 360; + + switch (this->mKindOfThing) + { + case 1: g.DrawRect(rc, rr, &rb); break; + case 2: g.FillRect(rc, rr, &rb); break; + case 3: g.DrawRoundRect(rc, rr, roundness, &rb); break; + case 4: g.FillRoundRect(rc, rr, roundness, &rb); break; + case 5: g.DrawEllipse(rc, rr, &rb); break; + case 6: g.FillEllipse(rc, rr, &rb); break; + case 7: g.DrawArc(rc, rr.MW(), rr.MH(), rr.W() > rr.H() ? rr.H() : rr.W(), rrad1, rrad2, &rb, thickness); break; + case 8: g.FillArc(rc, rr.MW(), rr.MH(), rr.W() > rr.H() ? rr.H() : rr.W(), rrad1, rrad2, &rb); break; + case 9: g.DrawLine(rc, dir == 0 ? rr.L : rr.R, rr.B, dir == 0 ? rr.R : rr.L, rr.T, &rb, thickness); break; + case 10: g.DrawDottedLine(rc, dir == 0 ? rr.L : rr.R, rr.B, dir == 0 ? rr.R : rr.L, rr.T, &rb, thickness); break; + case 11: g.DrawFittedBitmap(smiley, rr, &rb); break; + case 12: g.DrawSVG(tiger, rr); break; + default: break; + } + + dir = !dir; } - - dir = !dir; + // pCaller->mLayer = g.EndLayer(); } - // pCaller->mLayer = g.EndLayer(); - } - - // g.DrawLayer(pCaller->mLayer); - - }, 10000, false, false)); - + + // g.DrawLayer(pCaller->mLayer); + }, + 10000, false, false)); + pGraphics->AttachControl(new ITextControl(labelsArea.GetGridCell(0, 1, 2), "", IText(20)), kCtrlTagNumThings); pGraphics->AttachControl(new ITextControl(labelsArea.GetGridCell(1, 1, 2), "", IText(20)), kCtrlTagTestNum); - + int button = 0; - for (auto buttonLabel : {"Select test", "Next test", "Prev test", "Things++", "Things--"}) { - pGraphics->AttachControl(new IVButtonControl(buttonsArea.GetGridCell(button, 1, 6), SplashClickActionFunc, buttonLabel, DEFAULT_STYLE.WithLabelText(DEFAULT_TEXT.WithVAlign(EVAlign::Middle)).WithRoundness(0.2)), kCtrlTagButton1 + button)->SetAnimationEndActionFunction([button, DoFunc, pGraphics](IControl* pCaller) { - - switch (button){ - case 0: + for (auto buttonLabel : {"Select test", "Next test", "Prev test", "Things++", "Things--"}) + { + pGraphics + ->AttachControl( + new IVButtonControl(buttonsArea.GetGridCell(button, 1, 6), SplashClickActionFunc, buttonLabel, DEFAULT_STYLE.WithLabelText(DEFAULT_TEXT.WithVAlign(EVAlign::Middle)).WithRoundness(0.2)), + kCtrlTagButton1 + button) + ->SetAnimationEndActionFunction([button, DoFunc, pGraphics](IControl* pCaller) { + switch (button) { - static IPopupMenu menu {"Test", {"Start", "DrawRect", "FillRect", "DrawRoundRect", "FillRoundRect", "DrawEllipse", "FillEllipse", "DrawArc", "FillArc", "DrawLine", "DrawDottedLine", "DrawFittedBitmap", "DrawSVG"}, - [DoFunc](IPopupMenu* pMenu) { - DoFunc(EFunc::Set, pMenu->GetChosenItemIdx()); - }}; - - pGraphics->CreatePopupMenu(*pCaller, menu, pCaller->GetRECT()); - break; + case 0: + { + static IPopupMenu menu{ + "Test", + {"Start", "DrawRect", "FillRect", "DrawRoundRect", "FillRoundRect", "DrawEllipse", "FillEllipse", "DrawArc", "FillArc", "DrawLine", "DrawDottedLine", "DrawFittedBitmap", "DrawSVG"}, + [DoFunc](IPopupMenu* pMenu) { DoFunc(EFunc::Set, pMenu->GetChosenItemIdx()); }}; + + pGraphics->CreatePopupMenu(*pCaller, menu, pCaller->GetRECT()); + break; + } + case 1: DoFunc(EFunc::Next); break; + case 2: DoFunc(EFunc::Prev); break; + case 3: DoFunc(EFunc::More); break; + case 4: DoFunc(EFunc::Less); break; + default: break; } - case 1: DoFunc(EFunc::Next); break; - case 2: DoFunc(EFunc::Prev); break; - case 3: DoFunc(EFunc::More); break; - case 4: DoFunc(EFunc::Less); break; - default: - break; - } - }); - + }); + button++; } - - pGraphics->AttachControl(new IVToggleControl(buttonsArea.GetGridCell(button, 1, 6), SplashClickActionFunc, "", DEFAULT_STYLE.WithRoundness(0.2), "FPS OFF", "FPS ON"), kCtrlTagButton6)->SetAnimationEndActionFunction([](IControl* pCaller){ - pCaller->GetUI()->ShowFPSDisplay(pCaller->GetValue() > 0.5); - }); + pGraphics->AttachControl(new IVToggleControl(buttonsArea.GetGridCell(button, 1, 6), SplashClickActionFunc, "", DEFAULT_STYLE.WithRoundness(0.2), "FPS OFF", "FPS ON"), kCtrlTagButton6) + ->SetAnimationEndActionFunction([](IControl* pCaller) { pCaller->GetUI()->ShowFPSDisplay(pCaller->GetValue() > 0.5); }); } #endif diff --git a/Tests/IGraphicsStressTest/IGraphicsStressTest.h b/Tests/IGraphicsStressTest/IGraphicsStressTest.h index 32567c4f4d..b19257a1f8 100644 --- a/Tests/IGraphicsStressTest/IGraphicsStressTest.h +++ b/Tests/IGraphicsStressTest/IGraphicsStressTest.h @@ -30,6 +30,7 @@ class IGraphicsStressTest final : public Plugin #if IPLUG_EDITOR void LayoutUI(IGraphics* pGraphics) override; void OnParentWindowResize(int width, int height) override; + public: int mNumberOfThings = 16; int mKindOfThing = 0; diff --git a/Tests/IGraphicsStressTest/resources/AUv3Framework.h b/Tests/IGraphicsStressTest/resources/AUv3Framework.h index 90cec5bded..7fd66f42ba 100644 --- a/Tests/IGraphicsStressTest/resources/AUv3Framework.h +++ b/Tests/IGraphicsStressTest/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Tests/IGraphicsTest/IGraphicsTest.cpp b/Tests/IGraphicsTest/IGraphicsTest.cpp index 25ddd5e07c..c49411277a 100644 --- a/Tests/IGraphicsTest/IGraphicsTest.cpp +++ b/Tests/IGraphicsTest/IGraphicsTest.cpp @@ -2,8 +2,8 @@ #include "IPlug_include_in_plug_src.h" #if IPLUG_EDITOR -#include "IControls.h" -#include "Test/TestControls.h" + #include "IControls.h" + #include "Test/TestControls.h" #endif enum EParam @@ -21,48 +21,45 @@ IGraphicsTest::IGraphicsTest(const InstanceInfo& info) : Plugin(info, MakeConfig(kNumParams, 1)) { GetParam(kParamDummy)->InitPercentage("Dummy", 100.f); - + #if IPLUG_EDITOR - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + mLayoutFunc = [&](IGraphics* pGraphics) { - - if(pGraphics->NControls()) + if (pGraphics->NControls()) { IRECT bounds = pGraphics->GetBounds(); pGraphics->GetBackgroundControl()->SetRECT(bounds); -// pGraphics->GetControlWithTag(kCtrlTagSize)->SetRECT(bounds); + // pGraphics->GetControlWithTag(kCtrlTagSize)->SetRECT(bounds); DBGMSG("SELECTED: W %i, H%i\n", pGraphics->Width(), pGraphics->Height()); - + return; } pGraphics->EnableMouseOver(true); pGraphics->EnableTooltips(true); pGraphics->EnableMultiTouch(true); - + pGraphics->AttachCornerResizer(EUIResizerMode::Scale, true); - + pGraphics->SetKeyHandlerFunc([&](const IKeyPress& key, bool isUp) { - if(!isUp) { - switch (key.VK) { - case kVK_TAB: - GetUI()->GetBackgroundControl()->As()->SetPattern(IColor::GetRandomColor()); - break; - - default: - break; + if (!isUp) + { + switch (key.VK) + { + case kVK_TAB: GetUI()->GetBackgroundControl()->As()->SetPattern(IColor::GetRandomColor()); break; + + default: break; } return true; } - + return false; }); - + pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); - if (!pGraphics->LoadFont("Alternative Font", "Times New Roman", ETextStyle::Normal)) { + if (!pGraphics->LoadFont("Alternative Font", "Times New Roman", ETextStyle::Normal)) + { // This covers cases where we can't load system fonts, or the font doesn't exist pGraphics->LoadFont("Alternative Font", MONTSERRAT_FN); } @@ -72,41 +69,39 @@ IGraphicsTest::IGraphicsTest(const InstanceInfo& info) auto testRect = bounds.GetFromTop(480.f).GetCentredInside(480.f); pGraphics->AttachPanelBackground(COLOR_GRAY); - - auto testNames = { - "Gradient", - "Multi-stop gradient", - "Polygon", - "Arcs", - "Beziers", - "MultiPath", - "Text", - "Animation", - "Draw contexts", - "SVG", - "Image", - "Layer", - "Blend modes", - "DropShadow", - "Cursor", - "Keyboard", - "ShadowGradient", - "Font", - "TextOrientation", - "TextSize", - "MPS (NanoVG MTL only)", - "Custom Shader (NanoVG only)", - "Gesture Recognizers (iOS only)", - "MultiTouch (iOS/Win/Web only)", - "FlexBox", - "Mask" - }; - + + auto testNames = {"Gradient", + "Multi-stop gradient", + "Polygon", + "Arcs", + "Beziers", + "MultiPath", + "Text", + "Animation", + "Draw contexts", + "SVG", + "Image", + "Layer", + "Blend modes", + "DropShadow", + "Cursor", + "Keyboard", + "ShadowGradient", + "Font", + "TextOrientation", + "TextSize", + "MPS (NanoVG MTL only)", + "Custom Shader (NanoVG only)", + "Gesture Recognizers (iOS only)", + "MultiTouch (iOS/Win/Web only)", + "FlexBox", + "Mask"}; + auto chooseTestControl = [&, pGraphics, testRect](int idx) { - IControl* pNewControl = nullptr; - - switch (idx) { + + switch (idx) + { case 0: pNewControl = new TestGradientControl(testRect, kParamDummy); break; case 1: pNewControl = new TestColorControl(testRect); break; case 2: pNewControl = new TestPolyControl(testRect, kParamDummy); break; @@ -130,47 +125,51 @@ IGraphicsTest::IGraphicsTest(const InstanceInfo& info) case 20: pNewControl = new TestMPSControl(testRect, pGraphics->LoadBitmap(SMILEY_FN), kParamDummy); break; case 21: pNewControl = new TestCustomShaderControl(testRect, kParamDummy); break; case 22: pNewControl = new TestGesturesControl(testRect); break; - case 23: pNewControl = new TestMTControl(testRect); pNewControl->SetWantsMultiTouch(true); break; + case 23: + pNewControl = new TestMTControl(testRect); + pNewControl->SetWantsMultiTouch(true); + break; case 24: pNewControl = new TestFlexBoxControl(testRect); break; case 25: pNewControl = new TestMaskControl(testRect, pGraphics->LoadBitmap(SMILEY_FN)); break; } - - if(pNewControl) + + if (pNewControl) pGraphics->AttachControl(pNewControl, kCtrlTagTestControl); - + SendCurrentParamValuesFromDelegate(); }; - - pGraphics->AttachControl(new IVRadioButtonControl(bounds.FracRectHorizontal(0.2f), - [pGraphics, chooseTestControl](IControl* pCaller) { - pGraphics->RemoveControlWithTag(kCtrlTagTestControl); - SplashClickActionFunc(pCaller); - int selectedTest = pCaller->As()->GetSelectedIdx(); - chooseTestControl(selectedTest); - }, - testNames - )); - + + pGraphics->AttachControl(new IVRadioButtonControl( + bounds.FracRectHorizontal(0.2f), + [pGraphics, chooseTestControl](IControl* pCaller) { + pGraphics->RemoveControlWithTag(kCtrlTagTestControl); + SplashClickActionFunc(pCaller); + int selectedTest = pCaller->As()->GetSelectedIdx(); + chooseTestControl(selectedTest); + }, + testNames)); + pGraphics->AttachControl(new IVSliderControl(bounds.FracRectHorizontal(0.2f, true).GetCentredInside(100, 200), kParamDummy, "Value")); - pGraphics->AttachControl(new GFXLabelControl(bounds.GetFromTRHC(230, 50)));//.GetTranslated(25, -25))); - + pGraphics->AttachControl(new GFXLabelControl(bounds.GetFromTRHC(230, 50))); //.GetTranslated(25, -25))); + chooseTestControl(0); }; - + #endif } void IGraphicsTest::OnHostSelectedViewConfiguration(int width, int height) { DBGMSG("SELECTED: W %i, H%i\n", width, height); -// const float scale = (float) height / (float) PLUG_HEIGHT; - -// if(GetUI()) -// GetUI()->Resize(width, height, 1); + // const float scale = (float) height / (float) PLUG_HEIGHT; + + // if(GetUI()) + // GetUI()->Resize(width, height, 1); } bool IGraphicsTest::OnHostRequestingSupportedViewConfiguration(int width, int height) { - DBGMSG("SUPPORTED: W %i, H%i\n", width, height); return true; + DBGMSG("SUPPORTED: W %i, H%i\n", width, height); + return true; } diff --git a/Tests/IGraphicsTest/IGraphicsTest.h b/Tests/IGraphicsTest/IGraphicsTest.h index ad8d7ac6bb..d9aed74898 100644 --- a/Tests/IGraphicsTest/IGraphicsTest.h +++ b/Tests/IGraphicsTest/IGraphicsTest.h @@ -9,7 +9,7 @@ class IGraphicsTest final : public Plugin { public: IGraphicsTest(const InstanceInfo& info); - + void OnHostSelectedViewConfiguration(int width, int height) override; bool OnHostRequestingSupportedViewConfiguration(int width, int height) override; }; diff --git a/Tests/IGraphicsTest/resources/AUv3Framework.h b/Tests/IGraphicsTest/resources/AUv3Framework.h index 6417909985..04fe57afc7 100644 --- a/Tests/IGraphicsTest/resources/AUv3Framework.h +++ b/Tests/IGraphicsTest/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework. diff --git a/Tests/MetaParamTest/MetaParamTest.cpp b/Tests/MetaParamTest/MetaParamTest.cpp index 429b0b67b1..0e496bd97a 100644 --- a/Tests/MetaParamTest/MetaParamTest.cpp +++ b/Tests/MetaParamTest/MetaParamTest.cpp @@ -2,7 +2,7 @@ #include "IPlug_include_in_plug_src.h" #if IPLUG_EDITOR -#include "IControls.h" + #include "IControls.h" #endif #if IPLUG_EDITOR @@ -15,35 +15,28 @@ struct FourValues : public IControl mText.mVAlign = EVAlign::Middle; mDisablePrompt = false; } - + int GetValIdxForPos(float x, float y) const override { int a = x > mRECT.MW(); int b = y > mRECT.MH(); - + return b * 2 + a; } - - IRECT GetRect(int num) - { - return mRECT.GetGridCell(num / 2, num % 2, 2, 2).GetPadded(-120, -5, -120, -5); - } - - void OnMouseDblClick(float x, float y, const IMouseMod&) override - { - PromptUserInput(GetRect(GetValIdxForPos(x, y)), GetValIdxForPos(x, y)); - } - + + IRECT GetRect(int num) { return mRECT.GetGridCell(num / 2, num % 2, 2, 2).GetPadded(-120, -5, -120, -5); } + + void OnMouseDblClick(float x, float y, const IMouseMod&) override { PromptUserInput(GetRect(GetValIdxForPos(x, y)), GetValIdxForPos(x, y)); } + void Draw(IGraphics& g) override { - auto drawVal = [this, &g](int num) - { + auto drawVal = [this, &g](int num) { WDL_String str; IRECT r = GetRect(num); GetParam(num)->GetDisplay(str); g.DrawText(mText, str.Get(), r); }; - + for (int i = 0; i < 4; i++) drawVal(i); } @@ -58,7 +51,7 @@ MetaParamTest::MetaParamTest(const InstanceInfo& info) GetParam(kParamRightX)->InitDouble("X2", 100., 0., 100.0, 0.01, "%"); GetParam(kParamRightY)->InitDouble("Y2", 100., 0., 100.0, 0.01, "%"); GetParam(kParamLink)->InitBool("link", false); - + GetParam(kParamEnum1)->InitEnum("Enum 1", 0, 4); GetParam(kParamEnum1)->SetDisplayText(0, "Apple"); GetParam(kParamEnum1)->SetDisplayText(1, "Orange"); @@ -69,63 +62,58 @@ MetaParamTest::MetaParamTest(const InstanceInfo& info) GetParam(kParamEnum2)->SetDisplayText(1, "Diamonds"); GetParam(kParamEnum2)->SetDisplayText(2, "Hearts"); GetParam(kParamEnum2)->SetDisplayText(3, "Clubs"); - + #if IPLUG_EDITOR - mMakeGraphicsFunc = [&]() { - return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); - }; - + mMakeGraphicsFunc = [&]() { return MakeGraphics(*this, PLUG_WIDTH, PLUG_HEIGHT, PLUG_FPS, GetScaleForScreen(PLUG_WIDTH, PLUG_HEIGHT)); }; + auto updatePeersFunc = - mLayoutFunc = [&](IGraphics* pGraphics) { - - pGraphics->EnableMultiTouch(true); - pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); - pGraphics->AttachPanelBackground(COLOR_GRAY); - pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); - pGraphics->ShowFPSDisplay(true); - const IRECT b = pGraphics->GetBounds(); - pGraphics->AttachControl(new IVXYPadControl(b.GetGridCell(0, 2, 2), {kParamLeftX, kParamLeftY}), kCtrlLeftXYPad, "mux"); - pGraphics->AttachControl(new IVXYPadControl(b.GetGridCell(1, 2, 2), {kParamRightX, kParamRightY}), kCtrlRightXYPad, "mux"); - pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(2, 2, 2).FracRectHorizontal(0.5), kParamLeftX), kCtrlLeftXKnob, "mux"); - pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(2, 2, 2).FracRectHorizontal(0.5, true), kParamLeftY), kCtrlLeftYKnob, "mux"); - pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(3, 2, 2).FracRectHorizontal(0.5), kParamRightX), kCtrlRightXKnob, "mux"); - pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(3, 2, 2).FracRectHorizontal(0.5, true), kParamRightY), kCtrlRightYKnob, "mux"); - pGraphics->AttachControl(new IVSwitchControl(b.GetCentredInside(50), kParamLink)); -// pGraphics->AttachControl(new FourValues(b.GetFromBottom(100).GetPadded(-20), kParamEnum1, kParamLeftX, kParamLeftY, kParamEnum2)); - - pGraphics->ForControlInGroup("mux", [&](IControl* pControl) - { - pControl->SetActionFunction([&](IControl* pCaller) - { - if(GetParam(kParamLink)->Bool()) - { - if(pCaller->GetTag() == kCtrlLeftXKnob || pCaller->GetTag() == kCtrlLeftYKnob || pCaller->GetTag() == kCtrlLeftXYPad) - { - double x = GetParam(kParamLeftX)->GetNormalized(); - double y = GetParam(kParamLeftY)->GetNormalized(); - SetParameterValue(kParamRightX, x); - SetParameterValue(kParamRightY, y); - GetUI()->GetControlWithTag(kCtrlRightXKnob)->SetValueFromDelegate(x); - GetUI()->GetControlWithTag(kCtrlRightYKnob)->SetValueFromDelegate(y); - GetUI()->GetControlWithTag(kCtrlRightXYPad)->SetValueFromDelegate(x, 0); - GetUI()->GetControlWithTag(kCtrlRightXYPad)->SetValueFromDelegate(y, 1); - } - else if(pCaller->GetTag() == kCtrlRightXKnob || pCaller->GetTag() == kCtrlRightYKnob || pCaller->GetTag() == kCtrlRightXYPad) + mLayoutFunc = [&](IGraphics* pGraphics) { + pGraphics->EnableMultiTouch(true); + pGraphics->AttachCornerResizer(EUIResizerMode::Scale, false); + pGraphics->AttachPanelBackground(COLOR_GRAY); + pGraphics->LoadFont("Roboto-Regular", ROBOTO_FN); + pGraphics->ShowFPSDisplay(true); + const IRECT b = pGraphics->GetBounds(); + pGraphics->AttachControl(new IVXYPadControl(b.GetGridCell(0, 2, 2), {kParamLeftX, kParamLeftY}), kCtrlLeftXYPad, "mux"); + pGraphics->AttachControl(new IVXYPadControl(b.GetGridCell(1, 2, 2), {kParamRightX, kParamRightY}), kCtrlRightXYPad, "mux"); + pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(2, 2, 2).FracRectHorizontal(0.5), kParamLeftX), kCtrlLeftXKnob, "mux"); + pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(2, 2, 2).FracRectHorizontal(0.5, true), kParamLeftY), kCtrlLeftYKnob, "mux"); + pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(3, 2, 2).FracRectHorizontal(0.5), kParamRightX), kCtrlRightXKnob, "mux"); + pGraphics->AttachControl(new IVKnobControl(b.GetGridCell(3, 2, 2).FracRectHorizontal(0.5, true), kParamRightY), kCtrlRightYKnob, "mux"); + pGraphics->AttachControl(new IVSwitchControl(b.GetCentredInside(50), kParamLink)); + // pGraphics->AttachControl(new FourValues(b.GetFromBottom(100).GetPadded(-20), kParamEnum1, kParamLeftX, kParamLeftY, kParamEnum2)); + + pGraphics->ForControlInGroup("mux", [&](IControl* pControl) { + pControl->SetActionFunction([&](IControl* pCaller) { + if (GetParam(kParamLink)->Bool()) { - double x = GetParam(kParamRightX)->GetNormalized(); - double y = GetParam(kParamRightY)->GetNormalized(); - SetParameterValue(kParamLeftX, x); - SetParameterValue(kParamLeftY, y); - GetUI()->GetControlWithTag(kCtrlLeftXKnob)->SetValueFromDelegate(x); - GetUI()->GetControlWithTag(kCtrlLeftYKnob)->SetValueFromDelegate(y); - GetUI()->GetControlWithTag(kCtrlLeftXYPad)->SetValueFromDelegate(x, 0); - GetUI()->GetControlWithTag(kCtrlLeftXYPad)->SetValueFromDelegate(y, 1); + if (pCaller->GetTag() == kCtrlLeftXKnob || pCaller->GetTag() == kCtrlLeftYKnob || pCaller->GetTag() == kCtrlLeftXYPad) + { + double x = GetParam(kParamLeftX)->GetNormalized(); + double y = GetParam(kParamLeftY)->GetNormalized(); + SetParameterValue(kParamRightX, x); + SetParameterValue(kParamRightY, y); + GetUI()->GetControlWithTag(kCtrlRightXKnob)->SetValueFromDelegate(x); + GetUI()->GetControlWithTag(kCtrlRightYKnob)->SetValueFromDelegate(y); + GetUI()->GetControlWithTag(kCtrlRightXYPad)->SetValueFromDelegate(x, 0); + GetUI()->GetControlWithTag(kCtrlRightXYPad)->SetValueFromDelegate(y, 1); + } + else if (pCaller->GetTag() == kCtrlRightXKnob || pCaller->GetTag() == kCtrlRightYKnob || pCaller->GetTag() == kCtrlRightXYPad) + { + double x = GetParam(kParamRightX)->GetNormalized(); + double y = GetParam(kParamRightY)->GetNormalized(); + SetParameterValue(kParamLeftX, x); + SetParameterValue(kParamLeftY, y); + GetUI()->GetControlWithTag(kCtrlLeftXKnob)->SetValueFromDelegate(x); + GetUI()->GetControlWithTag(kCtrlLeftYKnob)->SetValueFromDelegate(y); + GetUI()->GetControlWithTag(kCtrlLeftXYPad)->SetValueFromDelegate(x, 0); + GetUI()->GetControlWithTag(kCtrlLeftXYPad)->SetValueFromDelegate(y, 1); + } } - } + }); }); - }); - }; + }; #endif } @@ -134,8 +122,9 @@ void MetaParamTest::ProcessBlock(sample** inputs, sample** outputs, int nFrames) { const double gainX = GetParam(kParamLeftX)->Value() / 100.; const double gainY = GetParam(kParamLeftY)->Value() / 100.; - - for (int s = 0; s < nFrames; s++) { + + for (int s = 0; s < nFrames; s++) + { outputs[0][s] = inputs[0][s] * gainX; outputs[1][s] = inputs[1][s] * gainY; } diff --git a/Tests/MetaParamTest/resources/AUv3Framework.h b/Tests/MetaParamTest/resources/AUv3Framework.h index 0bd3f75e5a..af5171f1de 100644 --- a/Tests/MetaParamTest/resources/AUv3Framework.h +++ b/Tests/MetaParamTest/resources/AUv3Framework.h @@ -1,9 +1,9 @@ #include #if TARGET_OS_IOS == 1 -#import + #import #else -#import + #import #endif //! Project version number for AUv3Framework.