For each Music playback system defining own volume scaling definition which was wrong for SDL_mixer
This commit is contained in:
parent
709496a932
commit
47255f4e31
|
@ -4,6 +4,7 @@ D2X-Rebirth Changelog
|
|||
--------
|
||||
d2x-rebirth/main/multi.c, d2x-rebirth/main/bmread.c, d2x-rebirth/main/bmread.h, d2x-rebirth/main/paging.c, d2x-rebirth/main/piggy.c, d2x-rebirth/main/render.c, d2x-rebirth/main/net_ipx.c, d2x-rebirth/main/dumpmine.c, d2x-rebirth/main/editor/kmine.c, d2x-rebirth/main/editor/mine.c, d2x-rebirth/main/editor/group.c, d2x-rebirth/main/editor/med.c, d2x-rebirth/main/editor/eswitch.c, d2x-rebirth/main/editor/medwall.c, d2x-rebirth/main/kconfig.c, d2x-rebirth/main/gamecntl.c, d2x-rebirth/ui/window.c, d2x-rebirth/ui/keypad.c, d2x-rebirth/mem/mem.c: Patching together editor so it compiles again (while still not running); Implemented PhysFS for file accessing for editor- and debugging-related code
|
||||
main/gamecntl.c: Removed processing of HandleVRKey() as this code is not usable anymore and blocks some system keys (removal of general VR-code will follow later)
|
||||
main/songs.c, arch/sdl/digi_mixer_music.c, arch/sdl/rbaudio.c, arch/sdl/digi.c: For each Music playback system defining own volume scaling definition which was wrong for SDL_mixer
|
||||
|
||||
20100817
|
||||
--------
|
||||
|
|
|
@ -145,6 +145,7 @@ void digi_debug()
|
|||
|
||||
#ifdef _WIN32
|
||||
// Windows native-MIDI stuff.
|
||||
#define MIDI_VOLUME_SCALE 128
|
||||
int digi_win32_midi_song_playing=0;
|
||||
static hmp_file *cur_hmp=NULL;
|
||||
|
||||
|
@ -152,10 +153,12 @@ void digi_win32_set_midi_volume( int mvolume )
|
|||
{
|
||||
int mm_volume, midi_volume=0;
|
||||
|
||||
mvolume *= MIDI_VOLUME_SCALE/8;
|
||||
|
||||
if (mvolume < 0)
|
||||
midi_volume = 0;
|
||||
else if (mvolume > 127)
|
||||
midi_volume = 127;
|
||||
else if (mvolume > MIDI_VOLUME_SCALE-1)
|
||||
midi_volume = MIDI_VOLUME_SCALE-1;
|
||||
else
|
||||
midi_volume = mvolume;
|
||||
|
||||
|
@ -179,7 +182,7 @@ int digi_win32_play_midi_song( char * filename, int loop )
|
|||
if (hmp_play(cur_hmp,loop) != 0)
|
||||
return 0; // error
|
||||
digi_win32_midi_song_playing = 1;
|
||||
digi_win32_set_midi_volume((GameCfg.MusicVolume*128)/8);
|
||||
digi_win32_set_midi_volume((GameCfg.MusicVolume*MIDI_VOLUME_SCALE)/8);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@ void mix_free_music()
|
|||
|
||||
void mix_set_music_volume(int vol)
|
||||
{
|
||||
vol *= MIX_MAX_VOLUME/8;
|
||||
Mix_VolumeMusic(vol);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "console.h"
|
||||
#include "timer.h"
|
||||
|
||||
#define REDBOOK_VOLUME_SCALE 255
|
||||
|
||||
static SDL_CD *s_cd = NULL;
|
||||
static int initialised = 0;
|
||||
|
||||
|
@ -140,10 +142,10 @@ void RBASetVolume(int volume)
|
|||
if (!s_cd) return;
|
||||
|
||||
cdfile = s_cd->id;
|
||||
level = volume;
|
||||
level = volume*REDBOOK_VOLUME_SCALE/8;
|
||||
|
||||
if ((level<0) || (level>255)) {
|
||||
con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-255)\n");
|
||||
if ((level<0) || (level>REDBOOK_VOLUME_SCALE)) {
|
||||
con_printf(CON_CRITICAL, "illegal volume value (allowed values 0-%i)\n",REDBOOK_VOLUME_SCALE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,15 +49,15 @@ void songs_set_volume(int volume)
|
|||
{
|
||||
#ifdef _WIN32
|
||||
if (GameArg.SndDisableSdlMixer)
|
||||
digi_win32_set_midi_volume((volume*128)/8);
|
||||
digi_win32_set_midi_volume(volume);
|
||||
#endif
|
||||
if (GameCfg.MusicType == MUSIC_TYPE_REDBOOK)
|
||||
{
|
||||
RBASetVolume(0);
|
||||
RBASetVolume(volume*EXTMUSIC_VOLUME_SCALE/8);
|
||||
RBASetVolume(volume);
|
||||
}
|
||||
#ifdef USE_SDLMIXER
|
||||
mix_set_music_volume(volume*EXTMUSIC_VOLUME_SCALE/8);
|
||||
mix_set_music_volume(volume);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue