Correctly proceed to new Redbook track if songnum != Song_playing (hopefully - to confirm); Using songs_stop_all() in songs_uninit() to clear redundancy; added some notes to functions to shine a bit light on the mess of some functions
This commit is contained in:
parent
497dfd0b09
commit
5c660b3a2d
|
@ -1,5 +1,9 @@
|
||||||
D1X-Rebirth Changelog
|
D1X-Rebirth Changelog
|
||||||
|
|
||||||
|
20110716
|
||||||
|
--------
|
||||||
|
main/songs.c: Correctly proceed to new Redbook track if songnum != Song_playing (hopefully - to confirm); Using songs_stop_all() in songs_uninit() to clear redundancy; added some notes to functions to shine a bit light on the mess of some functions
|
||||||
|
|
||||||
20110715
|
20110715
|
||||||
--------
|
--------
|
||||||
arch/sdl/digi.c, main/digi.h, main/songs.c, misc/hmp.c: Bail out of hmp_reset() if midiOutOpen fails and return error with -debug set; execute hmp_reset() before first song plays; renamed digi_win32_stop_current_song() to digi_win32_stop_midi_song() to keep naming convention; Fixed some compiler warnings
|
arch/sdl/digi.c, main/digi.h, main/songs.c, misc/hmp.c: Bail out of hmp_reset() if midiOutOpen fails and return error with -debug set; execute hmp_reset() before first song plays; renamed digi_win32_stop_current_song() to digi_win32_stop_midi_song() to keep naming convention; Fixed some compiler warnings
|
||||||
|
|
19
main/songs.c
19
main/songs.c
|
@ -44,6 +44,7 @@ int Num_bim_songs;
|
||||||
#define EXTMUSIC_VOLUME_SCALE (255)
|
#define EXTMUSIC_VOLUME_SCALE (255)
|
||||||
|
|
||||||
//takes volume in range 0..8
|
//takes volume in range 0..8
|
||||||
|
//NOTE that we do not check what is playing right now (except Redbook) This is because here we don't (want) know WHAT we're playing - let the subfunctions do it (i.e. digi_win32_set_music_volume() knows if a MIDI plays or not)
|
||||||
void songs_set_volume(int volume)
|
void songs_set_volume(int volume)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -59,6 +60,8 @@ void songs_set_volume(int volume)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set up everything for our music
|
||||||
|
// NOTE: you might think this is done once per runtime but it's not! It's done for EACH song so that each mission can have it's own descent.sng structure. We COULD optimize that by only doing this once per mission.
|
||||||
void songs_init()
|
void songs_init()
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@ -175,19 +178,12 @@ void songs_init()
|
||||||
|
|
||||||
void songs_uninit()
|
void songs_uninit()
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
songs_stop_all();
|
||||||
digi_win32_stop_midi_song(); // Stop midi song, if playing
|
|
||||||
#endif
|
|
||||||
RBAStop();
|
|
||||||
// RBAExit();
|
|
||||||
#ifdef USE_SDLMIXER
|
#ifdef USE_SDLMIXER
|
||||||
mix_stop_music();
|
|
||||||
jukebox_unload();
|
jukebox_unload();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (BIMSongs != NULL)
|
if (BIMSongs != NULL)
|
||||||
d_free(BIMSongs);
|
d_free(BIMSongs);
|
||||||
Song_playing = -1;
|
|
||||||
Songs_initialized = 0;
|
Songs_initialized = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -286,6 +282,10 @@ int songs_play_song( int songnum, int repeat )
|
||||||
{
|
{
|
||||||
case MUSIC_TYPE_BUILTIN:
|
case MUSIC_TYPE_BUILTIN:
|
||||||
{
|
{
|
||||||
|
// EXCEPTION: If SONG_ENDLEVEL is not available, continue playing level song.
|
||||||
|
if (Song_playing >= SONG_FIRST_LEVEL_SONG && songnum == SONG_ENDLEVEL && !PHYSFSX_exists(BIMSongs[songnum].filename, 1))
|
||||||
|
return Song_playing;
|
||||||
|
|
||||||
Song_playing = -1;
|
Song_playing = -1;
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (GameArg.SndDisableSdlMixer)
|
if (GameArg.SndDisableSdlMixer)
|
||||||
|
@ -424,7 +424,8 @@ int songs_play_level_song( int levelnum, int offset )
|
||||||
|
|
||||||
if (!offset)
|
if (!offset)
|
||||||
{
|
{
|
||||||
if (Song_playing >= SONG_FIRST_LEVEL_SONG)
|
// we have just been told to play the same as we do already -> ignore
|
||||||
|
if (Song_playing >= SONG_FIRST_LEVEL_SONG && songnum + SONG_FIRST_LEVEL_SONG == Song_playing)
|
||||||
return Song_playing;
|
return Song_playing;
|
||||||
|
|
||||||
tracknum = REDBOOK_FIRST_LEVEL_TRACK + ((n_tracks<=REDBOOK_FIRST_LEVEL_TRACK) ? 0 : (songnum % (n_tracks-REDBOOK_FIRST_LEVEL_TRACK)));
|
tracknum = REDBOOK_FIRST_LEVEL_TRACK + ((n_tracks<=REDBOOK_FIRST_LEVEL_TRACK) ? 0 : (songnum % (n_tracks-REDBOOK_FIRST_LEVEL_TRACK)));
|
||||||
|
|
Loading…
Reference in a new issue