Tweak audio settings
This commit is contained in:
1 parent
5e8c0c3806
commit
ec3a1fee70
2 files changed
+42
-8
No files matched your search
@@ -1153,6 +1153,13 @@ static menuitem_t OP_SoundAdvancedMenu[] =
|
||||
{IT_STRING | IT_CVAR, NULL, "Stereo Seperation", &cv_stereosep, 35},
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
{IT_HEADER, NULL, "MIDI Settings", NULL, NULL, OPENMPT_MENUOFFSET},
|
||||
{IT_STRING | IT_CVAR | IT_CV_STRING, NULL, "Sound Font File", NULL, &cv_midisoundfontpath, OPENMPT_MENUOFFSET+12},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Chorus", NULL, &cv_midichorus, OPENMPT_MENUOFFSET+40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Reverb", NULL, &cv_midireverb, OPENMPT_MENUOFFSET+50},
|
||||
#endif
|
||||
|
||||
{IT_HEADER, NULL, "Misc", NULL, 45},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Same Sound Limit", &cv_samesoundlimit, 55},
|
||||
@@ -1180,6 +1187,11 @@ static const char* OP_SoundAdvancedTooltips[] =
|
||||
"Which Amiga should be used for .mod playback?",
|
||||
#endif
|
||||
"How far should the four channels in .mod be panned?",
|
||||
#endif
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
"Which MIDI soundfont to use",
|
||||
"Controls the chorus of MIDI playback\n setting this too high might cause some instruments to be overexposed",
|
||||
"Controls the reverb of MIDI playback\n setting this too high might cause notes to be drawn out",
|
||||
#endif
|
||||
NULL,
|
||||
"How many times is the same sound allowed to play at once?\nIf 0 theres no limit.",
|
||||
|
||||
+30
-8
@@ -135,7 +135,7 @@ static void MidiChorus_OnChange(void)
|
||||
{
|
||||
if (synth_settings != NULL)
|
||||
{
|
||||
fluid_settings_setnum(synth_settings, "synth.chorus.active", cv_midichorus.value > 0);
|
||||
fluid_settings_setint(synth_settings, "synth.chorus.active", cv_midichorus.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.chorus.level", FixedToFloat(cv_midichorus.value));
|
||||
}
|
||||
}
|
||||
@@ -144,14 +144,16 @@ static void MidiReverb_OnChange(void)
|
||||
{
|
||||
if (synth_settings != NULL)
|
||||
{
|
||||
fluid_settings_setnum(synth_settings, "synth.reverb.active", cv_midireverb.value > 0);
|
||||
fluid_settings_setint(synth_settings, "synth.reverb.active", cv_midireverb.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.reverb.level", FixedToFloat(cv_midireverb.value));
|
||||
}
|
||||
}
|
||||
|
||||
consvar_t cv_midisoundfontpath = CVAR_INIT ("midisoundfont", "sf2/GeneralUser-GS.sf2", "Which MIDI soundfont to use", CV_CALL|CV_NOINIT|CV_SAVE, NULL, MidiSoundfontPath_Onchange);
|
||||
consvar_t cv_midichorus = CVAR_INIT ("midichorus", "1", "Controls the chorus level of MIDI playback; setting this too high might cause some instruments to be overexposed", CV_CALL|CV_SAVE|CV_FLOAT, CV_Unsigned, MidiChorus_OnChange);
|
||||
consvar_t cv_midireverb = CVAR_INIT ("midireverb", "1", "Controls the reverb level of MIDI playback; setting this too high might cause notes to be drawn out", CV_CALL|CV_SAVE|CV_FLOAT, CV_Unsigned, MidiReverb_OnChange);
|
||||
static CV_PossibleValue_t chorus_const_t[] = {{0, "MIN"}, {2 << FRACBITS, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_midichorus = CVAR_INIT ("midichorus", "1", "Controls the chorus of MIDI playback; setting this too high might cause some instruments to be overexposed", CV_CALL|CV_SAVE|CV_FLOAT, chorus_const_t, MidiChorus_OnChange);
|
||||
static CV_PossibleValue_t reverb_const_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_midireverb = CVAR_INIT ("midireverb", "0.8", "Controls the reverb of MIDI playback; setting this too high might cause notes to be drawn out", CV_CALL|CV_SAVE|CV_FLOAT, reverb_const_t, MidiReverb_OnChange);
|
||||
#endif
|
||||
|
||||
//FIXME: this is not how it should be lol
|
||||
@@ -1091,18 +1093,38 @@ void I_SetSfxVolume(UINT8 volume)
|
||||
/// Music System
|
||||
/// ------------------------
|
||||
|
||||
static void LogFluidMessage(int level, const char *message, void *data)
|
||||
{
|
||||
(void)data;
|
||||
switch (level)
|
||||
{
|
||||
case FLUID_WARN:
|
||||
CONS_Alert(CONS_WARNING, "%s\n", message);
|
||||
break;
|
||||
case FLUID_ERR:
|
||||
case FLUID_PANIC:
|
||||
CONS_Alert(CONS_ERROR, "%s\n", message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void I_InitMusic(void)
|
||||
{
|
||||
#ifdef HAVE_FLUIDSYNTH
|
||||
if (synth == NULL)
|
||||
{
|
||||
fluid_set_log_function(FLUID_DBG, NULL, NULL);
|
||||
fluid_set_log_function(FLUID_INFO, NULL, NULL);
|
||||
fluid_set_log_function(FLUID_WARN, LogFluidMessage, NULL);
|
||||
fluid_set_log_function(FLUID_ERR, LogFluidMessage, NULL);
|
||||
fluid_set_log_function(FLUID_PANIC, LogFluidMessage, NULL);
|
||||
synth_settings = new_fluid_settings();
|
||||
fluid_settings_setnum(synth_settings, "synth.gain", 1.0f);
|
||||
fluid_settings_setnum(synth_settings, "synth.sample-rate", virtual_spec.freq);
|
||||
fluid_settings_setnum(synth_settings, "synth.chorus.active", cv_midichorus.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.chorus.level", cv_midichorus.value);
|
||||
fluid_settings_setnum(synth_settings, "synth.reverb.active", cv_midireverb.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.reverb.level", cv_midireverb.value);
|
||||
fluid_settings_setint(synth_settings, "synth.chorus.active", cv_midichorus.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.chorus.level", FixedToFloat(cv_midichorus.value));
|
||||
fluid_settings_setint(synth_settings, "synth.reverb.active", cv_midireverb.value > 0);
|
||||
fluid_settings_setnum(synth_settings, "synth.reverb.level", FixedToFloat(cv_midireverb.value));
|
||||
synth = new_fluid_synth(synth_settings);
|
||||
if (synth == NULL)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user