mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-21 20:11:12 +00:00
Some few changes
This commit is contained in:
parent
db71ba71c9
commit
7d1e59d4ba
3 changed files with 30 additions and 17 deletions
|
@ -42,10 +42,6 @@ extern INT32 msg_id;
|
|||
#include "lua_hook.h" // MusicChange hook
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
#include "libopenmpt/libopenmpt.h"
|
||||
#endif
|
||||
|
||||
#ifdef HW3SOUND
|
||||
// 3D Sound Interface
|
||||
#include "hardware/hw3sound.h"
|
||||
|
@ -63,6 +59,8 @@ static void GameMIDIMusic_OnChange(void);
|
|||
static void GameSounds_OnChange(void);
|
||||
static void GameDigiMusic_OnChange(void);
|
||||
|
||||
static void ModFilter_OnChange(void);
|
||||
|
||||
// commands for music and sound servers
|
||||
#ifdef MUSSERV
|
||||
consvar_t musserver_cmd = {"musserver_cmd", "musserver", CV_SAVE, NULL, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
@ -114,7 +112,7 @@ consvar_t cv_gamesounds = {"sounds", "On", CV_SAVE|CV_CALL|CV_NOINIT, CV_OnOff,
|
|||
|
||||
#ifdef HAVE_OPENMPT
|
||||
static CV_PossibleValue_t interpolationfilter_cons_t[] = {{0, "Default"}, {1, "None"}, {2, "Linear"}, {4, "Cubic"}, {8, "Windowed sinc"}, {0, NULL}};
|
||||
consvar_t cv_modfilter = {"modfilter", "0", CV_SAVE, interpolationfilter_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_modfilter = {"modfilter", "0", CV_SAVE|CV_CALL, interpolationfilter_cons_t, ModFilter_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
#endif
|
||||
|
||||
#define S_MAX_VOLUME 127
|
||||
|
@ -281,11 +279,6 @@ void S_RegisterSoundStuff(void)
|
|||
COM_AddCommand("tunes", Command_Tunes_f);
|
||||
COM_AddCommand("restartaudio", Command_RestartAudio_f);
|
||||
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
CV_RegisterVar(&cv_modfilter);
|
||||
#endif
|
||||
|
||||
#if defined (macintosh) && !defined (HAVE_SDL) // mp3 playlist stuff
|
||||
{
|
||||
INT32 i;
|
||||
|
@ -1855,3 +1848,9 @@ void GameMIDIMusic_OnChange(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModFilter_OnChange(void)
|
||||
{
|
||||
if (mod)
|
||||
openmpt_module_set_render_param(mod, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value);
|
||||
}
|
|
@ -20,6 +20,11 @@
|
|||
#include "command.h"
|
||||
#include "tables.h" // angle_t
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
#include "libopenmpt/libopenmpt.h"
|
||||
openmpt_module *mod;
|
||||
#endif
|
||||
|
||||
// mask used to indicate sound origin is player item pickup
|
||||
#define PICKUP_SOUND 0x8000
|
||||
|
||||
|
|
|
@ -108,7 +108,6 @@ static UINT16 current_track;
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_OPENMPT
|
||||
static openmpt_module *mod = 0;
|
||||
int mod_err = OPENMPT_ERROR_OK;
|
||||
static const char *mod_err_str;
|
||||
static UINT16 current_subsong;
|
||||
|
@ -652,9 +651,13 @@ static void mix_gme(void *udata, Uint8 *stream, int len)
|
|||
// play gme into stream
|
||||
gme_play(gme, len/2, (short *)stream);
|
||||
|
||||
// Limiter to prevent music from being disorted with some formats
|
||||
if (music_volume >= 18)
|
||||
music_volume = 18;
|
||||
|
||||
// apply volume to stream
|
||||
for (i = 0, p = (short *)stream; i < len/2; i++, p++)
|
||||
*p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 42;
|
||||
*p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -664,18 +667,20 @@ static void mix_openmpt(void *udata, Uint8 *stream, int len)
|
|||
int i;
|
||||
short *p;
|
||||
|
||||
(void)udata;
|
||||
|
||||
if (!mod || songpaused)
|
||||
return;
|
||||
|
||||
(void)udata;
|
||||
|
||||
openmpt_module_set_render_param(mod, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value);
|
||||
openmpt_module_set_repeat_count(mod, -1); // Always repeat
|
||||
openmpt_module_read_interleaved_stereo(mod, SAMPLERATE, BUFFERSIZE, (short *)stream);
|
||||
|
||||
// Limiter to prevent music from being disorted with some formats
|
||||
if (music_volume >= 18)
|
||||
music_volume = 18;
|
||||
|
||||
// apply volume to stream
|
||||
for (i = 0, p = (short *)stream; i < len/2; i++, p++)
|
||||
*p = ((INT32)*p) * (music_volume*internal_volume/100) / 31;
|
||||
*p = ((INT32)*p) * (music_volume*internal_volume/100)*2 / 40;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1160,6 +1165,7 @@ boolean I_LoadSong(char *data, size_t len)
|
|||
case MUS_MID:
|
||||
case MUS_OGG:
|
||||
case MUS_MP3:
|
||||
case MUS_FLAC:
|
||||
Mix_HookMusic(NULL, NULL);
|
||||
break;
|
||||
default:
|
||||
|
@ -1295,6 +1301,9 @@ boolean I_PlaySong(boolean looping)
|
|||
if (mod)
|
||||
{
|
||||
openmpt_module_select_subsong(mod, 0);
|
||||
openmpt_module_set_render_param(mod, OPENMPT_MODULE_RENDER_INTERPOLATIONFILTER_LENGTH, cv_modfilter.value);
|
||||
if (looping)
|
||||
openmpt_module_set_repeat_count(mod, -1); // Always repeat
|
||||
current_subsong = 0;
|
||||
Mix_HookMusic(mix_openmpt, mod);
|
||||
return true;
|
||||
|
|
Loading…
Reference in a new issue