GUI: add metronome volume setting
This commit is contained in:
parent
2cd454a59d
commit
2e2fafd878
|
@ -2025,6 +2025,10 @@ void DivEngine::setMetronome(bool enable) {
|
||||||
metroAmp=0;
|
metroAmp=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DivEngine::setMetronomeVol(float vol) {
|
||||||
|
metroVol=vol;
|
||||||
|
}
|
||||||
|
|
||||||
void DivEngine::setConsoleMode(bool enable) {
|
void DivEngine::setConsoleMode(bool enable) {
|
||||||
consoleMode=enable;
|
consoleMode=enable;
|
||||||
}
|
}
|
||||||
|
@ -2196,6 +2200,9 @@ bool DivEngine::initAudioBackend() {
|
||||||
|
|
||||||
lowQuality=getConfInt("audioQuality",0);
|
lowQuality=getConfInt("audioQuality",0);
|
||||||
forceMono=getConfInt("forceMono",0);
|
forceMono=getConfInt("forceMono",0);
|
||||||
|
metroVol=(float)(getConfInt("metroVol",100))/100.0f;
|
||||||
|
if (metroVol<0.0f) metroVol=0.0f;
|
||||||
|
if (metroVol>2.0f) metroVol=2.0f;
|
||||||
|
|
||||||
switch (audioEngine) {
|
switch (audioEngine) {
|
||||||
case DIV_AUDIO_JACK:
|
case DIV_AUDIO_JACK:
|
||||||
|
|
|
@ -252,6 +252,7 @@ class DivEngine {
|
||||||
size_t metroTickLen;
|
size_t metroTickLen;
|
||||||
float metroFreq, metroPos;
|
float metroFreq, metroPos;
|
||||||
float metroAmp;
|
float metroAmp;
|
||||||
|
float metroVol;
|
||||||
|
|
||||||
size_t totalProcessed;
|
size_t totalProcessed;
|
||||||
|
|
||||||
|
@ -622,6 +623,9 @@ class DivEngine {
|
||||||
// set metronome
|
// set metronome
|
||||||
void setMetronome(bool enable);
|
void setMetronome(bool enable);
|
||||||
|
|
||||||
|
// set metronome volume (1.0 = 100%)
|
||||||
|
void setMetronomeVol(float vol);
|
||||||
|
|
||||||
// halt now
|
// halt now
|
||||||
void halt();
|
void halt();
|
||||||
|
|
||||||
|
@ -772,6 +776,7 @@ class DivEngine {
|
||||||
metroFreq(0),
|
metroFreq(0),
|
||||||
metroPos(0),
|
metroPos(0),
|
||||||
metroAmp(0.0f),
|
metroAmp(0.0f),
|
||||||
|
metroVol(1.0f),
|
||||||
totalProcessed(0),
|
totalProcessed(0),
|
||||||
oscBuf{NULL,NULL},
|
oscBuf{NULL,NULL},
|
||||||
oscSize(1),
|
oscSize(1),
|
||||||
|
|
|
@ -1925,8 +1925,8 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
|
||||||
metroAmp=0.7f;
|
metroAmp=0.7f;
|
||||||
}
|
}
|
||||||
if (metroAmp>0.0f) {
|
if (metroAmp>0.0f) {
|
||||||
out[0][i]+=(sin(metroPos*2*M_PI))*metroAmp;
|
out[0][i]+=(sin(metroPos*2*M_PI))*metroAmp*metroVol;
|
||||||
out[1][i]+=(sin(metroPos*2*M_PI))*metroAmp;
|
out[1][i]+=(sin(metroPos*2*M_PI))*metroAmp*metroVol;
|
||||||
}
|
}
|
||||||
metroAmp-=0.0003f;
|
metroAmp-=0.0003f;
|
||||||
if (metroAmp<0.0f) metroAmp=0.0f;
|
if (metroAmp<0.0f) metroAmp=0.0f;
|
||||||
|
|
|
@ -810,6 +810,7 @@ class FurnaceGUI {
|
||||||
int oscBorder;
|
int oscBorder;
|
||||||
int separateFMColors;
|
int separateFMColors;
|
||||||
int insEditColorize;
|
int insEditColorize;
|
||||||
|
int metroVol;
|
||||||
unsigned int maxUndoSteps;
|
unsigned int maxUndoSteps;
|
||||||
String mainFontPath;
|
String mainFontPath;
|
||||||
String patFontPath;
|
String patFontPath;
|
||||||
|
@ -876,6 +877,7 @@ class FurnaceGUI {
|
||||||
oscBorder(1),
|
oscBorder(1),
|
||||||
separateFMColors(0),
|
separateFMColors(0),
|
||||||
insEditColorize(0),
|
insEditColorize(0),
|
||||||
|
metroVol(100),
|
||||||
maxUndoSteps(100),
|
maxUndoSteps(100),
|
||||||
mainFontPath(""),
|
mainFontPath(""),
|
||||||
patFontPath(""),
|
patFontPath(""),
|
||||||
|
|
|
@ -198,9 +198,6 @@ struct MappedInput {
|
||||||
scan(s), val(v) {}
|
scan(s), val(v) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// - add metronome volume setting
|
|
||||||
// - maybe add metronome sound setting
|
|
||||||
void FurnaceGUI::drawSettings() {
|
void FurnaceGUI::drawSettings() {
|
||||||
if (nextWindow==GUI_WINDOW_SETTINGS) {
|
if (nextWindow==GUI_WINDOW_SETTINGS) {
|
||||||
settingsOpen=true;
|
settingsOpen=true;
|
||||||
|
@ -385,6 +382,14 @@ void FurnaceGUI::drawSettings() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Combo("##Quality",&settings.audioQuality,audioQualities,2);
|
ImGui::Combo("##Quality",&settings.audioQuality,audioQualities,2);
|
||||||
|
|
||||||
|
ImGui::Text("Metronome volume");
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::SliderInt("##MetroVol",&settings.metroVol,0,200,"%d%%")) {
|
||||||
|
if (settings.metroVol<0) settings.metroVol=0;
|
||||||
|
if (settings.metroVol>200) settings.metroVol=200;
|
||||||
|
e->setMetronomeVol(((float)settings.metroVol)/100.0f);
|
||||||
|
}
|
||||||
|
|
||||||
bool forceMonoB=settings.forceMono;
|
bool forceMonoB=settings.forceMono;
|
||||||
if (ImGui::Checkbox("Force mono audio",&forceMonoB)) {
|
if (ImGui::Checkbox("Force mono audio",&forceMonoB)) {
|
||||||
settings.forceMono=forceMonoB;
|
settings.forceMono=forceMonoB;
|
||||||
|
@ -1562,6 +1567,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
settings.oscBorder=e->getConfInt("oscBorder",1);
|
settings.oscBorder=e->getConfInt("oscBorder",1);
|
||||||
settings.separateFMColors=e->getConfInt("separateFMColors",0);
|
settings.separateFMColors=e->getConfInt("separateFMColors",0);
|
||||||
settings.insEditColorize=e->getConfInt("insEditColorize",0);
|
settings.insEditColorize=e->getConfInt("insEditColorize",0);
|
||||||
|
settings.metroVol=e->getConfInt("metroVol",100);
|
||||||
|
|
||||||
clampSetting(settings.mainFontSize,2,96);
|
clampSetting(settings.mainFontSize,2,96);
|
||||||
clampSetting(settings.patFontSize,2,96);
|
clampSetting(settings.patFontSize,2,96);
|
||||||
|
@ -1617,6 +1623,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
clampSetting(settings.sampleLayout,0,1);
|
clampSetting(settings.sampleLayout,0,1);
|
||||||
clampSetting(settings.separateFMColors,0,1);
|
clampSetting(settings.separateFMColors,0,1);
|
||||||
clampSetting(settings.insEditColorize,0,1);
|
clampSetting(settings.insEditColorize,0,1);
|
||||||
|
clampSetting(settings.metroVol,0,200);
|
||||||
|
|
||||||
// keybinds
|
// keybinds
|
||||||
for (int i=0; i<GUI_ACTION_MAX; i++) {
|
for (int i=0; i<GUI_ACTION_MAX; i++) {
|
||||||
|
@ -1632,6 +1639,7 @@ void FurnaceGUI::syncSettings() {
|
||||||
midiMap.compile();
|
midiMap.compile();
|
||||||
|
|
||||||
e->setMidiDirect(midiMap.directChannel);
|
e->setMidiDirect(midiMap.directChannel);
|
||||||
|
e->setMetronomeVol(((float)settings.metroVol)/100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::commitSettings() {
|
void FurnaceGUI::commitSettings() {
|
||||||
|
@ -1698,6 +1706,7 @@ void FurnaceGUI::commitSettings() {
|
||||||
e->setConf("oscBorder",settings.oscBorder);
|
e->setConf("oscBorder",settings.oscBorder);
|
||||||
e->setConf("separateFMColors",settings.separateFMColors);
|
e->setConf("separateFMColors",settings.separateFMColors);
|
||||||
e->setConf("insEditColorize",settings.insEditColorize);
|
e->setConf("insEditColorize",settings.insEditColorize);
|
||||||
|
e->setConf("metroVol",settings.metroVol);
|
||||||
|
|
||||||
// colors
|
// colors
|
||||||
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
for (int i=0; i<GUI_COLOR_MAX; i++) {
|
||||||
|
|
Loading…
Reference in a new issue