add sample preview volume setting

it was too loud
This commit is contained in:
tildearrow 2023-09-11 16:04:19 -05:00
parent 41bd28c41a
commit 41544bcced
5 changed files with 31 additions and 2 deletions

View file

@ -3246,6 +3246,10 @@ void DivEngine::setMetronomeVol(float vol) {
metroVol=vol;
}
void DivEngine::setSamplePreviewVol(float vol) {
previewVol=vol;
}
void DivEngine::setConsoleMode(bool enable) {
consoleMode=enable;
}
@ -3450,6 +3454,7 @@ bool DivEngine::initAudioBackend() {
clampSamples=getConfInt("clampSamples",0);
lowLatency=getConfInt("lowLatency",0);
metroVol=(float)(getConfInt("metroVol",100))/100.0f;
previewVol=(float)(getConfInt("sampleVol",50))/100.0f;
midiOutClock=getConfInt("midiOutClock",0);
midiOutTime=getConfInt("midiOutTime",0);
midiOutTimeRate=getConfInt("midiOutTimeRate",0);
@ -3457,6 +3462,8 @@ bool DivEngine::initAudioBackend() {
midiOutMode=getConfInt("midiOutMode",DIV_MIDI_MODE_NOTE);
if (metroVol<0.0f) metroVol=0.0f;
if (metroVol>2.0f) metroVol=2.0f;
if (previewVol<0.0f) previewVol=0.0f;
if (previewVol>1.0f) previewVol=1.0f;
renderPoolThreads=getConfInt("renderPoolThreads",0);
if (lowLatency) logI("using low latency mode.");

View file

@ -490,6 +490,7 @@ class DivEngine {
float metroFreq, metroPos;
float metroAmp;
float metroVol;
float previewVol;
size_t totalProcessed;
@ -729,6 +730,9 @@ class DivEngine {
int getSamplePreviewPos();
double getSamplePreviewRate();
// set sample preview volume (1.0 = 100%)
void setSamplePreviewVol(float vol);
// trigger sample preview
void previewSample(int sample, int note=-1, int pStart=-1, int pEnd=-1);
void stopSamplePreview();
@ -1282,6 +1286,7 @@ class DivEngine {
metroPos(0),
metroAmp(0.0f),
metroVol(1.0f),
previewVol(1.0f),
totalProcessed(0),
renderPoolThreads(0),
renderPool(NULL),

View file

@ -2202,7 +2202,7 @@ void DivEngine::nextBuf(float** in, float** out, int inChans, int outChans, unsi
} else if (srcPortSet==0xffd) {
// sample preview
for (size_t j=0; j<size; j++) {
out[destSubPort][j]+=samp_bbOut[j]/32768.0;
out[destSubPort][j]+=previewVol*(samp_bbOut[j]/32768.0);
}
} else if (srcPortSet==0xffe && playing && !halted) {
// metronome