|
@@ -1,6 +1,6 @@
|
|
|
/*
|
|
|
SoLoud audio engine
|
|
|
-Copyright (c) 2013-2015 Jari Komppa
|
|
|
+Copyright (c) 2013-2021 Jari Komppa
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
@@ -32,12 +32,20 @@ freely, subject to the following restrictions:
|
|
|
#include "soloud_wav.h"
|
|
|
#include "soloud_padsynth.h"
|
|
|
#include "soloud_basicwave.h"
|
|
|
+#include "soloud_ay.h"
|
|
|
+
|
|
|
+
|
|
|
+#include "soloud_bassboostfilter.h"
|
|
|
+#include "soloud_biquadresonantfilter.h"
|
|
|
+#include "soloud_dcremovalfilter.h"
|
|
|
#include "soloud_echofilter.h"
|
|
|
-#include "soloud_speech.h"
|
|
|
#include "soloud_fftfilter.h"
|
|
|
-#include "soloud_biquadresonantfilter.h"
|
|
|
+#include "soloud_flangerfilter.h"
|
|
|
+#include "soloud_freeverbfilter.h"
|
|
|
#include "soloud_lofifilter.h"
|
|
|
-#include "soloud_dcremovalfilter.h"
|
|
|
+#include "soloud_robotizefilter.h"
|
|
|
+#include "soloud_waveshaperfilter.h"
|
|
|
+#include "soloud_eqfilter.h"
|
|
|
|
|
|
#include "RtMidi.h"
|
|
|
|
|
@@ -47,25 +55,35 @@ struct plonked
|
|
|
float mRel;
|
|
|
};
|
|
|
|
|
|
-SoLoud::Speech gSpeech;
|
|
|
-SoLoud::Soloud gSoloud; // SoLoud engine core
|
|
|
-SoLoud::Basicwave gWave; // Simple wave audio source
|
|
|
+SoLoud::Soloud gSoloud;
|
|
|
+SoLoud::Basicwave gWave;
|
|
|
+SoLoud::Ay gAy;
|
|
|
SoLoud::Wav gLoadedWave;
|
|
|
SoLoud::Wav gPadsynth;
|
|
|
-SoLoud::EchoFilter gEchoFilter; // Simple echo filter
|
|
|
-SoLoud::BiquadResonantFilter gBQRFilter; // BQR filter
|
|
|
SoLoud::Bus gBus;
|
|
|
-SoLoud::FFTFilter gFftFilter;
|
|
|
-SoLoud::LofiFilter gLofiFilter;
|
|
|
-SoLoud::DCRemovalFilter gDCRemovalFilter;
|
|
|
+SoLoud::Filter* gFilter[11];
|
|
|
+int gFilterSelect[4] = { 0, 0, 0, 0 };
|
|
|
|
|
|
float gAttack = 0.02f;
|
|
|
float gRelease = 0.5f;
|
|
|
+int gSynthEngine = 0;
|
|
|
+bool gSynthWindow = true;
|
|
|
+bool gInfoWindow = true;
|
|
|
+bool gFilterWindow = false;
|
|
|
+
|
|
|
+float harm[7] = { 0.7f, 0.3f, 0.2f, 1.7f, 0.4f, 1.3f, 0.2f };
|
|
|
+float bw = 0.25f;
|
|
|
+float bws = 1.0f;
|
|
|
+
|
|
|
+float filter_param0[4] = { 0, 0, 1, 1 };
|
|
|
+float filter_param1[4] = { 8000, 0, 1000, 0 };
|
|
|
+float filter_param2[4] = { 3, 0, 2, 0 };
|
|
|
+
|
|
|
+int bushandle;
|
|
|
+
|
|
|
|
|
|
plonked gPlonked[128] = { 0 };
|
|
|
-int gWaveSelect = 2;
|
|
|
-int gFilterSelect = 0;
|
|
|
-int gEcho = 0;
|
|
|
+int gWaveSelect = SoLoud::Soloud::WAVE_SQUARE;
|
|
|
char *gInfo = (char*)"";
|
|
|
|
|
|
RtMidiIn *midi = NULL;
|
|
@@ -80,21 +98,27 @@ void plonk(float rel, float vol = 0x50)
|
|
|
vol *= vol;
|
|
|
float pan = (float)sin(DemoTick() * 0.0234);
|
|
|
int handle;
|
|
|
- if (gWaveSelect < 4)
|
|
|
+ switch (gSynthEngine)
|
|
|
{
|
|
|
+ default:
|
|
|
+ case 0:
|
|
|
+ gWave.setFreq(440.0f * rel * 2);
|
|
|
handle = gBus.play(gWave, 0);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (gWaveSelect == 4)
|
|
|
- handle = gBus.play(gLoadedWave, 0);
|
|
|
- if (gWaveSelect == 5)
|
|
|
- {
|
|
|
- handle = gBus.play(gPadsynth, 0);
|
|
|
- }
|
|
|
- }
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ handle = gBus.play(gPadsynth, 0);
|
|
|
+ gSoloud.setRelativePlaySpeed(handle, 2 * rel);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ handle = gBus.play(gLoadedWave, 0);
|
|
|
+ gSoloud.setRelativePlaySpeed(handle, 2 * rel);
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ gWave.setFreq(440.0f * rel * 2, true);
|
|
|
+ handle = gBus.play(gWave, 0);
|
|
|
+ break;
|
|
|
+ }
|
|
|
gSoloud.fadeVolume(handle, vol, gAttack);
|
|
|
- gSoloud.setRelativePlaySpeed(handle, 2 * rel);
|
|
|
gPlonked[i].mHandle = handle;
|
|
|
gPlonked[i].mRel = rel;
|
|
|
}
|
|
@@ -109,35 +133,12 @@ void unplonk(float rel)
|
|
|
gPlonked[i].mHandle = 0;
|
|
|
}
|
|
|
|
|
|
-void replonk(float vol = 0x50)
|
|
|
-{
|
|
|
- int i = 0;
|
|
|
- while (i < 128 && gPlonked[i].mHandle != 0) i++;
|
|
|
- if (i == 128) return;
|
|
|
-
|
|
|
- vol = (vol + 10) / (float)(0x7f + 10);
|
|
|
- vol *= vol;
|
|
|
- for (i = 0; i < 128; i++)
|
|
|
- {
|
|
|
- if (gPlonked[i].mHandle != 0)
|
|
|
- {
|
|
|
- gSoloud.fadeVolume(gPlonked[i].mHandle, vol, 0.1);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
|
|
|
void say(const char *text)
|
|
|
{
|
|
|
gInfo = (char*)text;
|
|
|
- gSpeech.setText(text);
|
|
|
- gSoloud.play(gSpeech, 4);
|
|
|
}
|
|
|
|
|
|
-float harm[7] = { 0.7f, 0.3f, 0.2f, 1.7f, 0.4f, 1.3f, 0.2f };
|
|
|
-float bw = 0.25f;
|
|
|
-float bws = 1.0f;
|
|
|
-
|
|
|
-int bushandle;
|
|
|
|
|
|
void midicallback(double deltatime, std::vector< unsigned char > *message, void *userData)
|
|
|
{
|
|
@@ -158,11 +159,6 @@ void midicallback(double deltatime, std::vector< unsigned char > *message, void
|
|
|
{
|
|
|
unplonk((float)pow(0.943875f, 0x3c - (*message)[1]));
|
|
|
}
|
|
|
- // aftertouch
|
|
|
- if (((*message)[0] & 0xf0) == 0xd0)
|
|
|
- {
|
|
|
- replonk((float)(*message)[1]);
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
int DemoEntry(int argc, char *argv[])
|
|
@@ -192,34 +188,212 @@ int DemoEntry(int argc, char *argv[])
|
|
|
gSoloud.init(SoLoud::Soloud::CLIP_ROUNDOFF | SoLoud::Soloud::ENABLE_VISUALIZATION);
|
|
|
gSoloud.setGlobalVolume(0.75);
|
|
|
gSoloud.setPostClipScaler(0.75);
|
|
|
- // gBus.setFilter(0, &gBQRFilter);
|
|
|
- // gBus.setFilter(1, &gFilter);
|
|
|
- gEchoFilter.setParams(0.5f, 0.5f);
|
|
|
bushandle = gSoloud.play(gBus);
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- gSpeech.setFilter(1, &gFftFilter);
|
|
|
|
|
|
- gSpeech.setText(". . . . . . . . . . . . . . . Use keyboard to play!");
|
|
|
- gInfo = (char*)"Use keyboard to play!";
|
|
|
- gSoloud.play(gSpeech, 4);
|
|
|
+ gInfo = (char*)"Use keyboard or midi to play!";
|
|
|
|
|
|
gLoadedWave.load("audio/AKWF_c604_0024.wav");
|
|
|
gLoadedWave.setLooping(1);
|
|
|
|
|
|
- gBus.setFilter(0, &gLofiFilter);
|
|
|
- gBus.setFilter(1, &gEchoFilter);
|
|
|
- gBus.setFilter(3, &gDCRemovalFilter);
|
|
|
-
|
|
|
SoLoud::generatePadsynth(gPadsynth, 7, harm, bw, bws);
|
|
|
|
|
|
+ gFilter[0] = new SoLoud::BassboostFilter;
|
|
|
+ gFilter[1] = new SoLoud::BiquadResonantFilter;
|
|
|
+ gFilter[2] = new SoLoud::DCRemovalFilter;
|
|
|
+ gFilter[3] = new SoLoud::EchoFilter;
|
|
|
+ gFilter[4] = new SoLoud::FFTFilter;
|
|
|
+ gFilter[5] = new SoLoud::FlangerFilter;
|
|
|
+ gFilter[6] = new SoLoud::FreeverbFilter;
|
|
|
+ gFilter[7] = new SoLoud::LofiFilter;
|
|
|
+ gFilter[8] = new SoLoud::RobotizeFilter;
|
|
|
+ gFilter[9] = new SoLoud::WaveShaperFilter;
|
|
|
+ gFilter[10] = new SoLoud::EqFilter;
|
|
|
+
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-float filter_param0[4] = { 0, 0, 1, 1 };
|
|
|
-float filter_param1[4] = { 8000, 0, 1000, 0 };
|
|
|
-float filter_param2[4] = { 3, 0, 2, 0 };
|
|
|
+
|
|
|
+void waveform_window()
|
|
|
+{
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(320, 20)));
|
|
|
+ ONCE(ImGui::SetNextWindowSize(ImVec2(200, 350)));
|
|
|
+ ImGui::Begin("Waveform");
|
|
|
+
|
|
|
+ if (ImGui::Combo("Wave", &gWaveSelect,
|
|
|
+ "Square wave\x00"
|
|
|
+ "Saw wave\x00"
|
|
|
+ "Sine wave\x00"
|
|
|
+ "Triangle wave\x00"
|
|
|
+ "Bounce wave\x00"
|
|
|
+ "Jaws wave\x00"
|
|
|
+ "Humps wave\x00"
|
|
|
+ "Antialized square wave\x00"
|
|
|
+ "Antialiazed sawe wave\x00"
|
|
|
+ "\x00"))
|
|
|
+ {
|
|
|
+ gWave.setWaveform(gWaveSelect);
|
|
|
+ }
|
|
|
+
|
|
|
+ ImGui::DragFloat("Attack", &gWave.mADSR.mA, 0.01f);
|
|
|
+ ImGui::DragFloat("Decay", &gWave.mADSR.mD, 0.01f);
|
|
|
+ ImGui::DragFloat("Sustain", &gWave.mADSR.mS, 0.01f);
|
|
|
+ ImGui::DragFloat("Release", &gRelease, 0.01f);
|
|
|
+
|
|
|
+ ImGui::End();
|
|
|
+}
|
|
|
+
|
|
|
+void superwave_window()
|
|
|
+{
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(320, 20)));
|
|
|
+ ONCE(ImGui::SetNextWindowSize(ImVec2(200, 350)));
|
|
|
+ ImGui::Begin("Superwave");
|
|
|
+
|
|
|
+ ImGui::DragFloat("Scale", &gWave.mSuperwaveScale, 0.01f);
|
|
|
+ ImGui::DragFloat("Detune", &gWave.mSuperwaveDetune, 0.001f);
|
|
|
+
|
|
|
+ if (ImGui::Combo("Wave", &gWaveSelect,
|
|
|
+ "Square wave\x00"
|
|
|
+ "Saw wave\x00"
|
|
|
+ "Sine wave\x00"
|
|
|
+ "Triangle wave\x00"
|
|
|
+ "Bounce wave\x00"
|
|
|
+ "Jaws wave\x00"
|
|
|
+ "Humps wave\x00"
|
|
|
+ "Antialized square wave\x00"
|
|
|
+ "Antialiazed sawe wave\x00"
|
|
|
+ "\x00"))
|
|
|
+ {
|
|
|
+ gWave.setWaveform(gWaveSelect);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ ImGui::DragFloat("Attack", &gWave.mADSR.mA, 0.01f);
|
|
|
+ ImGui::DragFloat("Decay", &gWave.mADSR.mD, 0.01f);
|
|
|
+ ImGui::DragFloat("Sustain", &gWave.mADSR.mS, 0.01f);
|
|
|
+ ImGui::DragFloat("Release", &gRelease, 0.01f);
|
|
|
+
|
|
|
+ ImGui::End();
|
|
|
+}
|
|
|
+
|
|
|
+void info_window()
|
|
|
+{
|
|
|
+ float* buf = gSoloud.getWave();
|
|
|
+ float* fft = gSoloud.calcFFT();
|
|
|
+
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(520, 20)));
|
|
|
+ ImGui::Begin("Output");
|
|
|
+ ImGui::PlotLines("##Wave", buf, 256, 0, "Wave", -1, 1, ImVec2(264, 80));
|
|
|
+ ImGui::PlotHistogram("##FFT", fft, 256 / 2, 0, "FFT", 0, 10, ImVec2(264, 80), 8);
|
|
|
+ ImGui::Text("Active voices : %d", gSoloud.getActiveVoiceCount());
|
|
|
+ ImGui::Text("1 2 3 5 6 8 9 0");
|
|
|
+ ImGui::Text(" Q W E R T Y U I O P");
|
|
|
+ ImGui::Text(gInfo);
|
|
|
+ ImGui::End();
|
|
|
+}
|
|
|
+
|
|
|
+void padsynth_window()
|
|
|
+{
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(320, 20)));
|
|
|
+ ONCE(ImGui::SetNextWindowSize(ImVec2(200, 350)));
|
|
|
+ ImGui::Begin("Padsynth");
|
|
|
+ {
|
|
|
+ int changed = 0;
|
|
|
+ if (ImGui::DragFloat("Harmonic 1", &harm[0], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 2", &harm[1], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 3", &harm[2], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 4", &harm[3], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 5", &harm[4], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 6", &harm[5], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Harmonic 7", &harm[6], 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Bandwidth", &bw, 0.1f)) changed = 1;
|
|
|
+ if (ImGui::DragFloat("Bandwidth scale", &bws, 0.1f)) changed = 1;
|
|
|
+ if (changed)
|
|
|
+ SoLoud::generatePadsynth(gPadsynth, 5, harm, bw, bws);
|
|
|
+ }
|
|
|
+ ImGui::End();
|
|
|
+}
|
|
|
+
|
|
|
+void filter_window()
|
|
|
+{
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(320, 20)));
|
|
|
+ ONCE(ImGui::SetNextWindowSize(ImVec2(200, 350)));
|
|
|
+ ImGui::Begin("Filters");
|
|
|
+ for (int filterindex = 0; filterindex < 4; filterindex++)
|
|
|
+ {
|
|
|
+ if (filterindex != 0)
|
|
|
+ ImGui::Separator();
|
|
|
+
|
|
|
+ char* label[4] = { "Filter 1", "Filter 2", "Filter 3", "Filter 4" };
|
|
|
+
|
|
|
+ if (ImGui::Combo(label[filterindex], &gFilterSelect[filterindex],
|
|
|
+ "None\x00"
|
|
|
+ "BassboostFilter\x00"
|
|
|
+ "BiquadResonantFilter\x00"
|
|
|
+ "DCRemovalFilter\x00"
|
|
|
+ "EchoFilter\x00"
|
|
|
+ "FFTFilter\x00"
|
|
|
+ "FlangerFilter\x00"
|
|
|
+ "FreeverbFilter\x00"
|
|
|
+ "LofiFilter\x00"
|
|
|
+ "RobotizeFilter\x00"
|
|
|
+ "WaveShaperFilter\x00"
|
|
|
+ "EqFilter\x00\x00"))
|
|
|
+ {
|
|
|
+ if (gFilterSelect[filterindex])
|
|
|
+ gSoloud.setGlobalFilter(filterindex, gFilter[gFilterSelect[filterindex] - 1]);
|
|
|
+ else
|
|
|
+ gSoloud.setGlobalFilter(filterindex, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (gFilterSelect[filterindex] != 0)
|
|
|
+ {
|
|
|
+ SoLoud::Filter* f = gFilter[gFilterSelect[filterindex] - 1];
|
|
|
+ int count = f->getParamCount();
|
|
|
+ for (int i = 0; i < count; i++)
|
|
|
+ {
|
|
|
+ int filtertype = f->getParamType(i);
|
|
|
+ float filtermin = f->getParamMin(i);
|
|
|
+ float filtermax = f->getParamMax(i);
|
|
|
+
|
|
|
+ if (filtertype == SoLoud::Filter::INT_PARAM)
|
|
|
+ {
|
|
|
+ int v = (int)gSoloud.getFilterParameter(0, filterindex, i);
|
|
|
+ char temp[128];
|
|
|
+ sprintf(temp, "%s##%d-%d", f->getParamName(i), filterindex, i);
|
|
|
+ if (ImGui::SliderInt(temp, &v, (int)filtermin, (int)filtermax))
|
|
|
+ {
|
|
|
+ gSoloud.setFilterParameter(0, filterindex, i, (float)v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (filtertype == SoLoud::Filter::FLOAT_PARAM)
|
|
|
+ {
|
|
|
+ float v = gSoloud.getFilterParameter(0, filterindex, i);
|
|
|
+ char temp[128];
|
|
|
+ sprintf(temp, "%s##%d-%d", f->getParamName(i), filterindex, i);
|
|
|
+ if (ImGui::SliderFloat(temp, &v, filtermin, filtermax))
|
|
|
+ {
|
|
|
+ gSoloud.setFilterParameter(0, filterindex, i, v);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (filtertype == SoLoud::Filter::BOOL_PARAM)
|
|
|
+ {
|
|
|
+ float v = gSoloud.getFilterParameter(0, filterindex, i);
|
|
|
+ bool bv = v > 0.5f;
|
|
|
+ char temp[128];
|
|
|
+ sprintf(temp, "%s##%d-%d", f->getParamName(i), filterindex, i);
|
|
|
+ if (ImGui::Checkbox(temp, &bv))
|
|
|
+ {
|
|
|
+ gSoloud.setFilterParameter(0, filterindex, i, bv ? 1.0f : 0.0f);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ImGui::End();
|
|
|
+}
|
|
|
|
|
|
void DemoMainloop()
|
|
|
{
|
|
@@ -257,139 +431,42 @@ void DemoMainloop()
|
|
|
|
|
|
DemoUpdateStart();
|
|
|
|
|
|
- float *buf = gSoloud.getWave();
|
|
|
- float *fft = gSoloud.calcFFT();
|
|
|
-
|
|
|
- ONCE(ImGui::SetNextWindowPos(ImVec2(320, 20)));
|
|
|
- ONCE(ImGui::SetNextWindowSize(ImVec2(200, 350)));
|
|
|
- ImGui::Begin("Padsynth");
|
|
|
+ ONCE(ImGui::SetNextWindowPos(ImVec2(20, 20)));
|
|
|
+ ONCE(ImGui::SetNextWindowSize(ImVec2(300, 350)));
|
|
|
+ ImGui::Begin("Master Control");
|
|
|
+ if (ImGui::Combo("Synth engine", &gSynthEngine,
|
|
|
+ "Basic wave\x00"
|
|
|
+ "Padsynth\x00"
|
|
|
+ "Basic sample\x00"
|
|
|
+ "Superwave\x00"
|
|
|
+ "\x00"))
|
|
|
{
|
|
|
- int changed = 0;
|
|
|
- if (ImGui::DragFloat("Harmonic 1", &harm[0], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 2", &harm[1], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 3", &harm[2], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 4", &harm[3], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 5", &harm[4], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 6", &harm[5], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Harmonic 7", &harm[6], 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Bandwidth", &bw, 0.1f)) changed = 1;
|
|
|
- if (ImGui::DragFloat("Bandwidth scale", &bws, 0.1f)) changed = 1;
|
|
|
- if (changed)
|
|
|
- SoLoud::generatePadsynth(gPadsynth, 5, harm, bw, bws);
|
|
|
}
|
|
|
- ImGui::End();
|
|
|
|
|
|
- ONCE(ImGui::SetNextWindowPos(ImVec2(500, 20)));
|
|
|
- ImGui::Begin("Output");
|
|
|
- ImGui::PlotLines("##Wave", buf, 256, 0, "Wave", -1, 1, ImVec2(264, 80));
|
|
|
- ImGui::PlotHistogram("##FFT", fft, 256 / 2, 0, "FFT", 0, 10, ImVec2(264, 80), 8);
|
|
|
- ImGui::Text("Active voices : %d", gSoloud.getActiveVoiceCount());
|
|
|
- ImGui::Text("1 2 3 5 6 8 9 0");
|
|
|
- ImGui::Text(" Q W E R T Y U I O P");
|
|
|
- ImGui::Text(gInfo);
|
|
|
- ImGui::End();
|
|
|
+ ImGui::Checkbox("Synth window", &gSynthWindow);
|
|
|
+ ImGui::Checkbox("Info window", &gInfoWindow);
|
|
|
+ ImGui::Checkbox("Filter window", &gFilterWindow);
|
|
|
|
|
|
- ONCE(ImGui::SetNextWindowPos(ImVec2(20, 20)));
|
|
|
- ONCE(ImGui::SetNextWindowSize(ImVec2(300, 350)));
|
|
|
- ImGui::Begin("Control");
|
|
|
+ if (gInfoWindow)
|
|
|
+ info_window();
|
|
|
|
|
|
- if (ImGui::CollapsingHeader("Waveform",0,true,true))
|
|
|
- {
|
|
|
- if (ImGui::RadioButton("Sine", gWaveSelect == 0))
|
|
|
- {
|
|
|
- gWaveSelect = 0;
|
|
|
- gWave.setWaveform(SoLoud::Basicwave::SINE);
|
|
|
- say("Sine wave");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Triangle", gWaveSelect == 1))
|
|
|
- {
|
|
|
- gWaveSelect = 1;
|
|
|
- gWave.setWaveform(SoLoud::Basicwave::TRIANGLE);
|
|
|
- say("Triangle wave");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Square", gWaveSelect == 2))
|
|
|
- {
|
|
|
- gWaveSelect = 2;
|
|
|
- gWave.setWaveform(SoLoud::Basicwave::SQUARE);
|
|
|
- say("Square wave");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Saw", gWaveSelect == 3))
|
|
|
- {
|
|
|
- gWaveSelect = 3;
|
|
|
- gWave.setWaveform(SoLoud::Basicwave::SAW);
|
|
|
- say("Saw wave");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Looping sample", gWaveSelect == 4))
|
|
|
- {
|
|
|
- gWaveSelect = 4;
|
|
|
- say("Looping sample");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Padsynth", gWaveSelect == 5))
|
|
|
- {
|
|
|
- gWaveSelect = 5;
|
|
|
- say("Padsynth");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (ImGui::CollapsingHeader("BQRFilter",0,true,true))
|
|
|
+ if (gFilterWindow)
|
|
|
+ filter_window();
|
|
|
+
|
|
|
+ if (gSynthWindow)
|
|
|
{
|
|
|
- if (ImGui::RadioButton("None", gFilterSelect == 0))
|
|
|
- {
|
|
|
- gFilterSelect = 0;
|
|
|
- gBus.setFilter(2, 0);
|
|
|
- say("Filter disabled");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Lowpass", gFilterSelect == 1))
|
|
|
- {
|
|
|
- gFilterSelect = 1;
|
|
|
- gBQRFilter.setParams(SoLoud::BiquadResonantFilter::LOWPASS, 1000, 2);
|
|
|
- gBus.setFilter(2, &gBQRFilter);
|
|
|
- say("Low pass filter");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Highpass", gFilterSelect == 2))
|
|
|
- {
|
|
|
- gFilterSelect = 2;
|
|
|
- gBQRFilter.setParams(SoLoud::BiquadResonantFilter::HIGHPASS, 1000, 2);
|
|
|
- gBus.setFilter(2, &gBQRFilter);
|
|
|
- say("High pass filter");
|
|
|
- }
|
|
|
- if (ImGui::RadioButton("Bandpass", gFilterSelect == 3))
|
|
|
- {
|
|
|
- gFilterSelect = 3;
|
|
|
- gBQRFilter.setParams(SoLoud::BiquadResonantFilter::BANDPASS, 1000, 2);
|
|
|
- gBus.setFilter(2, &gBQRFilter);
|
|
|
- say("Band pass filter");
|
|
|
- }
|
|
|
- ImGui::SliderFloat("Wet##4", &filter_param0[2], 0, 1);
|
|
|
- filter_param1[2] = gSoloud.getFilterParameter(bushandle, 2, 2);
|
|
|
- if (ImGui::SliderFloat("Frequency##4", &filter_param1[2], 0, 8000))
|
|
|
+ switch (gSynthEngine)
|
|
|
{
|
|
|
- gSoloud.setFilterParameter(bushandle, 2, 2, filter_param1[2]);
|
|
|
+ case 0:
|
|
|
+ waveform_window();
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ padsynth_window();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ superwave_window();
|
|
|
+ break;
|
|
|
}
|
|
|
- if (ImGui::SliderFloat("Resonance##4", &filter_param2[2], 1, 20))
|
|
|
- {
|
|
|
- gSoloud.setFilterParameter(bushandle, 2, 3, filter_param2[2]);
|
|
|
- }
|
|
|
- if (ImGui::Button("Oscillate +/- 1kHz"))
|
|
|
- {
|
|
|
- float from = filter_param1[2] - 500;
|
|
|
- if (from < 0) from = 0;
|
|
|
- gSoloud.oscillateFilterParameter(bushandle, 2, 2, from, from + 1000, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- if (ImGui::CollapsingHeader("Lofi filter", 0, true, true))
|
|
|
- {
|
|
|
- ImGui::SliderFloat("Wet##2", &filter_param0[0], 0, 1);
|
|
|
- ImGui::SliderFloat("Rate##2", &filter_param1[0], 1000, 8000);
|
|
|
- ImGui::SliderFloat("Bit depth##2", &filter_param2[0], 0, 8);
|
|
|
- }
|
|
|
- if (ImGui::CollapsingHeader("Echo filter", 0, true, true))
|
|
|
- {
|
|
|
- ImGui::SliderFloat("Wet##3", &filter_param0[1], 0, 1);
|
|
|
- }
|
|
|
- if (ImGui::CollapsingHeader("DC Removal filter", 0, true, true))
|
|
|
- {
|
|
|
- ImGui::SliderFloat("Wet##1", &filter_param0[3], 0, 1);
|
|
|
}
|
|
|
|
|
|
|