Skip to content

Commit 6044bed

Browse files
committed
put monitor values in macros for better visibility
Signed-off-by: falkTX <[email protected]>
1 parent bc9a83e commit 6044bed

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/monitor/monitor-client.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
#define MOD_MONITOR_STEREO_HANDLING
4646
#endif
4747

48+
#if defined(_DARKGLASS_DEVICE_PABLITO)
49+
#define MOD_MONITOR_VOLUME_MUTE -60.f
50+
#define MOD_MONITOR_VOLUME_WAIT 0.02f
51+
#else
52+
#define MOD_MONITOR_VOLUME_MUTE -30.f
53+
#define MOD_MONITOR_VOLUME_WAIT 0.03f
54+
#endif
55+
4856
#if defined(_MOD_DEVICE_DUOX) || defined(_MOD_DEVICE_DWARF)
4957
#define MOD_IO_PROCESSING_ENABLED
5058
#endif
@@ -352,7 +360,8 @@ static int ProcessMonitor(jack_nframes_t nframes, void *arg)
352360

353361
mon->apply_volume = floats_differ_enough(smooth_volume, 1.0f);
354362
mon->smooth_volume = smooth_volume;
355-
mon->muted = smooth_volume <= db2lin(-30.f) || !floats_differ_enough(smooth_volume, db2lin(-30.0f));
363+
mon->muted = smooth_volume <= db2lin(MOD_MONITOR_VOLUME_MUTE) ||
364+
! floats_differ_enough(smooth_volume, db2lin(MOD_MONITOR_VOLUME_MUTE));
356365

357366
if (mon->wait_volume && fabsf(volume - smooth_volume) < 0.000001f)
358367
{
@@ -435,7 +444,7 @@ int jack_initialize(jack_client_t* client, const char* load_init)
435444
#elif defined(_MOD_DEVICE_DUOX)
436445
const uint32_t numports = mon->extra_active ? 4 : 2;
437446
#elif defined(_DARKGLASS_DEVICE_PABLITO)
438-
const uint32_t numports = 2;
447+
const uint32_t numports = 6;
439448
#else
440449
uint32_t numports = 0;
441450

@@ -671,9 +680,10 @@ bool monitor_client_setup_volume(float volume)
671680

672681
// local variables for calculations before changing the real struct values
673682
const float final_volume = db2lin(volume);
674-
const float step_volume = fabsf(final_volume - mon->smooth_volume) / (0.03f * jack_get_sample_rate(mon->client));
683+
const float step_volume = fabsf(final_volume - mon->smooth_volume)
684+
/ (MOD_MONITOR_VOLUME_WAIT * jack_get_sample_rate(mon->client));
675685
const bool apply_volume = floats_differ_enough(final_volume, 1.0f);
676-
const bool unmute = volume > -30.f;
686+
const bool unmute = volume > MOD_MONITOR_VOLUME_MUTE;
677687

678688
mon->volume = final_volume;
679689
mon->step_volume = step_volume;

0 commit comments

Comments
 (0)