mirror of
https://github.com/ZDoom/raze-gles.git
synced 2025-01-11 18:50:46 +00:00
Fix MIDI playback on non-Windows platforms
git-svn-id: https://svn.eduke32.com/eduke32@6889 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5ee2bbc771
commit
03f2cdd9b3
5 changed files with 9 additions and 7 deletions
|
@ -65,7 +65,7 @@ void MUSIC_SetLoopFlag( int32_t loopflag );
|
||||||
void MUSIC_Continue( void );
|
void MUSIC_Continue( void );
|
||||||
void MUSIC_Pause( void );
|
void MUSIC_Pause( void );
|
||||||
int32_t MUSIC_StopSong( void );
|
int32_t MUSIC_StopSong( void );
|
||||||
int32_t MUSIC_PlaySong( char *song, int32_t loopflag );
|
int32_t MUSIC_PlaySong( char *song, int32_t songsize, int32_t loopflag );
|
||||||
void MUSIC_Update(void);
|
void MUSIC_Update(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -89,8 +89,10 @@ int32_t MUSIC_StopSong(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
int32_t MUSIC_PlaySong(char *song, int32_t songsize, int32_t loopflag)
|
||||||
{
|
{
|
||||||
|
UNREFERENCED_PARAMETER(songsize);
|
||||||
|
|
||||||
MUSIC_SetErrorCode(MUSIC_Ok)
|
MUSIC_SetErrorCode(MUSIC_Ok)
|
||||||
|
|
||||||
if (MIDI_PlaySong(song, loopflag) != MIDI_Ok)
|
if (MIDI_PlaySong(song, loopflag) != MIDI_Ok)
|
||||||
|
|
|
@ -405,7 +405,7 @@ static void sigchld_handler(int signo)
|
||||||
|
|
||||||
// Duke3D-specific. --ryan.
|
// Duke3D-specific. --ryan.
|
||||||
// void MUSIC_PlayMusic(char *_filename)
|
// void MUSIC_PlayMusic(char *_filename)
|
||||||
int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
int32_t MUSIC_PlaySong(char *song, int32_t songsize, int32_t loopflag)
|
||||||
{
|
{
|
||||||
// initprintf("MUSIC_PlaySong");
|
// initprintf("MUSIC_PlaySong");
|
||||||
// TODO: graceful failure
|
// TODO: graceful failure
|
||||||
|
@ -435,7 +435,7 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
||||||
fp = Bfopen(external_midi_tempfn, "wb");
|
fp = Bfopen(external_midi_tempfn, "wb");
|
||||||
if (fp)
|
if (fp)
|
||||||
{
|
{
|
||||||
fwrite(song, 1, g_musicSize, fp);
|
fwrite(song, 1, songsize, fp);
|
||||||
Bfclose(fp);
|
Bfclose(fp);
|
||||||
|
|
||||||
#if defined FORK_EXEC_MIDI
|
#if defined FORK_EXEC_MIDI
|
||||||
|
@ -450,7 +450,7 @@ int32_t MUSIC_PlaySong(char *song, int32_t loopflag)
|
||||||
else initprintf("%s: fopen: %s\n", __func__, strerror(errno));
|
else initprintf("%s: fopen: %s\n", __func__, strerror(errno));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem(song, g_musicSize)
|
music_musicchunk = Mix_LoadMUS_RW(SDL_RWFromMem(song, songsize)
|
||||||
#if (SDL_MAJOR_VERSION > 1)
|
#if (SDL_MAJOR_VERSION > 1)
|
||||||
, SDL_FALSE
|
, SDL_FALSE
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -230,7 +230,7 @@ static int32_t S_PlayMusic(const char *fn)
|
||||||
|
|
||||||
if (!Bmemcmp(MyMusicPtr, "MThd", 4))
|
if (!Bmemcmp(MyMusicPtr, "MThd", 4))
|
||||||
{
|
{
|
||||||
int32_t retval = MUSIC_PlaySong(MyMusicPtr, MUSIC_LoopSong);
|
int32_t retval = MUSIC_PlaySong(MyMusicPtr, MyMusicSize, MUSIC_LoopSong);
|
||||||
|
|
||||||
if (retval != MUSIC_Ok)
|
if (retval != MUSIC_Ok)
|
||||||
{
|
{
|
||||||
|
|
|
@ -501,7 +501,7 @@ PlaySong(char *song_file_name, int cdaudio_track, SWBOOL loop, SWBOOL restart)
|
||||||
|
|
||||||
if (!memcmp(SongPtr, "MThd", 4))
|
if (!memcmp(SongPtr, "MThd", 4))
|
||||||
{
|
{
|
||||||
MUSIC_PlaySong(SongPtr, /*SongLength,*/ MUSIC_LoopSong);
|
MUSIC_PlaySong(SongPtr, SongLength, MUSIC_LoopSong);
|
||||||
SongType = SongTypeMIDI;
|
SongType = SongTypeMIDI;
|
||||||
SongName = strdup(song_file_name);
|
SongName = strdup(song_file_name);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
Loading…
Reference in a new issue