Skip to content

Commit

Permalink
refactor(zc): remove digi_music volume control
Browse files Browse the repository at this point in the history
`digi_music` is a global volume control for all allegro 4 music streams,
which is only used for GME (so all those chiptune formats). But we
already apply `emusic_volume` (enhanced music) to all non-MIDI music,
so `digi_music` was at best redundant, and at worse a confusing knob
that only modified some music formats.

It's been removed from the Sound dialog, and now defaults to 255 (100%).
It can still be modified via scripts, though this should be changed to
just set/read `emusic_volume` sometime in the near future.

BTW - ~6 months ago OGG was changed to use Allegro 5 instead of 4, which
means at that point `digi_music` no longer had any effect on OGG volume.
  • Loading branch information
connorjclark committed Jan 23, 2024
1 parent d57d031 commit e426c5d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 45 deletions.
2 changes: 0 additions & 2 deletions resources/base_config/zc.cfg
Expand Up @@ -61,8 +61,6 @@ btn_right = 16

[Volume]
# 0-255
digi = 64
# 0-255
midi = 64
# 0-255
sfx = 64
Expand Down
58 changes: 15 additions & 43 deletions src/zc/zc_sys.cpp
Expand Up @@ -389,7 +389,6 @@ void load_game_configs()

epilepsyFlashReduction = zc_get_config(cfg_sect,"epilepsy_flash_reduction",0);

digi_volume = zc_get_config(sfx_sect,"digi",248);
midi_volume = zc_get_config(sfx_sect,"midi",255);
sfx_volume = zc_get_config(sfx_sect,"sfx",248);
emusic_volume = zc_get_config(sfx_sect,"emusic",248);
Expand Down Expand Up @@ -5855,14 +5854,7 @@ static DIALOG keyboard_control_dlg[] =
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL }
};

/*
int32_t midi_dp[3] = {0,147,104};
int32_t digi_dp[3] = {1,147,120};
int32_t pan_dp[3] = {0,147,136};
int32_t buf_dp[3] = {0,147,152};
*/
int32_t midi_dp[3] = {0,0,0};
int32_t digi_dp[3] = {1,0,0};
int32_t emus_dp[3] = {2,0,0};
int32_t buf_dp[3] = {0,0,0};
int32_t sfx_dp[3] = {3,0,0};
Expand All @@ -5878,33 +5870,32 @@ static DIALOG sound_dlg[] =
{ d_timer_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ jwin_frame_proc, 10, 28, 300, 112, 0, 0, 0, 0, FR_ETCHED, 0, NULL, NULL, NULL },
{ jwin_rtext_proc, 190, 40, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_a, NULL, NULL },
{ jwin_rtext_proc, 190, 56, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_b, NULL, NULL },
{ jwin_rtext_proc, 190, 72, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_l, NULL, NULL },
{ jwin_rtext_proc, 190, 88, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_m, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ jwin_rtext_proc, 190, 56, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_l, NULL, NULL },
{ jwin_rtext_proc, 190, 72, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_m, NULL, NULL },
// 10
{ jwin_rtext_proc, 190, 104, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_r, NULL, NULL },
{ jwin_rtext_proc, 190, 120, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_s, NULL, NULL },
{ jwin_rtext_proc, 190, 88, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_r, NULL, NULL },
{ jwin_rtext_proc, 190, 104, 40, 8, vc(7), vc(11), 0, 0, 0, 0, (void *) str_s, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ jwin_slider_proc, 196, 40, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, midi_dp },
{ jwin_slider_proc, 196, 56, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, digi_dp },
{ jwin_slider_proc, 196, 72, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, emus_dp },
{ jwin_slider_proc, 196, 88, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 127, 0, NULL, (void *) set_buf, buf_dp },
{ jwin_slider_proc, 196, 104, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, sfx_dp },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ jwin_slider_proc, 196, 56, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, emus_dp },
{ jwin_slider_proc, 196, 72, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 127, 0, NULL, (void *) set_buf, buf_dp },
{ jwin_slider_proc, 196, 88, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 32, 0, NULL, (void *) set_vol, sfx_dp },
//20
{ jwin_slider_proc, 196, 120, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 3, 0, NULL, (void *) set_pan, pan_dp },
{ jwin_slider_proc, 196, 104, 96, 8, vc(0), jwin_pal[jcBOX], 0, 0, 3, 0, NULL, (void *) set_pan, pan_dp },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ jwin_text_proc, 17, 40, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Master MIDI Volume", NULL, NULL },
{ jwin_text_proc, 17, 56, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Master Digi Volume", NULL, NULL },
{ jwin_text_proc, 17, 72, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Volume", NULL, NULL },
{ jwin_text_proc, 17, 88, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Buffer", NULL, NULL },
{ jwin_text_proc, 17, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Volume", NULL, NULL },
{ jwin_text_proc, 17, 120, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Pan", NULL, NULL },
//30
{ jwin_text_proc, 17, 56, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Volume", NULL, NULL },
{ jwin_text_proc, 17, 72, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "Enhanced Music Buffer", NULL, NULL },
{ jwin_text_proc, 17, 88, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Volume", NULL, NULL },
{ jwin_text_proc, 17, 104, 48, 8, vc(0), vc(11), 0, 0, 0, 0, (void *) "SFX Pan", NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
//30
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ d_dummy_proc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
{ NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL },
Expand Down Expand Up @@ -6870,7 +6861,6 @@ int32_t onSound()
}

int32_t m = midi_volume;
int32_t d = digi_volume;
int32_t e = emusic_volume;
int32_t b = zcmusic_bufsz;
int32_t s = sfx_volume;
Expand All @@ -6883,8 +6873,6 @@ int32_t onSound()

midi_dp[1] = sound_dlg[6].x;
midi_dp[2] = sound_dlg[6].y;
digi_dp[1] = sound_dlg[7].x;
digi_dp[2] = sound_dlg[7].y;
emus_dp[1] = sound_dlg[8].x;
emus_dp[2] = sound_dlg[8].y;
buf_dp[1] = sound_dlg[9].x;
Expand All @@ -6894,7 +6882,6 @@ int32_t onSound()
pan_dp[1] = sound_dlg[11].x;
pan_dp[2] = sound_dlg[11].y;
sound_dlg[15].d2 = (midi_volume==255) ? 32 : midi_volume>>3;
sound_dlg[16].d2 = (digi_volume==255) ? 32 : digi_volume>>3;
sound_dlg[17].d2 = (emusic_volume==255) ? 32 : emusic_volume>>3;
sound_dlg[18].d2 = zcmusic_bufsz;
sound_dlg[19].d2 = (sfx_volume==255) ? 32 : sfx_volume>>3;
Expand All @@ -6917,7 +6904,6 @@ int32_t onSound()
if(sfx_voice[i] > 0)
voice_set_volume(sfx_voice[i], temp_volume);
}
zc_set_config(sfx_sect,"digi",digi_volume);
zc_set_config(sfx_sect,"midi",midi_volume);
zc_set_config(sfx_sect,"sfx",sfx_volume);
zc_set_config(sfx_sect,"emusic",emusic_volume);
Expand All @@ -6927,7 +6913,6 @@ int32_t onSound()
else
{
midi_volume = m;
digi_volume = d;
emusic_volume = e;
zcmusic_bufsz = b;
sfx_volume = s;
Expand Down Expand Up @@ -8092,19 +8077,6 @@ void fix_dialogs()
jwin_center_dialog(scrsaver_dlg);
jwin_center_dialog(sound_dlg);
jwin_center_dialog(triforce_dlg);

// digi_dp[1] += scrx;
// digi_dp[2] += scry;
// midi_dp[1] += scrx;
// midi_dp[2] += scry;
// pan_dp[1] += scrx;
// pan_dp[2] += scry;
// emus_dp[1] += scrx;
// emus_dp[2] += scry;
// buf_dp[1] += scrx;
// buf_dp[2] += scry;
// sfx_dp[1] += scrx;
// sfx_dp[2] += scry;
}

/*****************************/
Expand Down
6 changes: 6 additions & 0 deletions src/zc/zelda.cpp
Expand Up @@ -4299,6 +4299,12 @@ int main(int argc, char **argv)
}

three_finger_flag=false;

// TODO: digi_volume has been removed as a user controllable setting. It is a global volume control for
// a4 music streams, but we use emusic_volume for all enhanced music, so it was a weird double volume control.
// Should remove all usages of digi_volume (maybe replacing with emusic_volume where appropriate). For now,
// just set to 255.
digi_volume = 255;

load_game_configs();

Expand Down

0 comments on commit e426c5d

Please sign in to comment.