Loose ends other targets

(cherry picked from commit 9a5fc5f66a31baf713c6f32f7a696b933da6907b)
This commit is contained in:
mazmazz 2018-08-23 09:37:02 -04:00
parent 1199a5f9b4
commit b59aa27104
6 changed files with 74 additions and 107 deletions

View file

@ -64,12 +64,12 @@ void I_InitMusic(void){}
void I_ShutdownMusic(void){}
void I_PauseSong(INT32 handle)
void I_PauseSong(void)
{
(void)handle;
}
void I_ResumeSong(INT32 handle)
void I_ResumeSong(void)
{
(void)handle;
}
@ -80,23 +80,19 @@ void I_ResumeSong(INT32 handle)
UINT8 midimusic_started = 0;
void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
void I_SetMIDIMusicVolume(INT32 volume)
{
(void)volume;
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, INT32 looping)
void I_SetMIDIMusicVolume(INT32 volume)
{
(void)volume;
}
boolean I_PlaySong(boolean looping)
{
(void)handle;
(void)looping;

View file

@ -408,31 +408,7 @@ void I_ShutdownMIDIMusic(void)
music_started=false;
}
void I_InitDigMusic(void)
{
// CONS_Printf("Digital music not yet supported under DOS.\n");
}
void I_ShutdownDigMusic(void)
{
// CONS_Printf("Digital music not yet supported under DOS.\n");
}
void I_InitMusic(void)
{
if (!nodigimusic)
I_InitDigMusic();
if (!nomidimusic)
I_InitMIDIMusic();
}
void I_ShutdownMusic(void)
{
I_ShutdownMIDIMusic();
I_ShutdownDigMusic();
}
boolean I_PlaySong(INT32 handle, INT32 looping)
boolean I_PlaySong(boolean looping)
{
handle = 0;
if (nomidimusic)
@ -495,7 +471,7 @@ void I_UnRegisterSong(INT32 handle)
//destroy_midi(currsong);
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_LoadSong(char *data, size_t len)
{
int e = len; //Alam: For error
if (nomidimusic)

View file

@ -70,7 +70,7 @@ void I_PauseSong(INT32 handle)
(void)handle;
}
void I_ResumeSong(INT32 handle)
void I_ResumeSong(void)
{
(void)handle;
}
@ -79,23 +79,14 @@ void I_ResumeSong(INT32 handle)
// MIDI I/O
//
void I_InitMIDIMusic(void){}
void I_ShutdownMIDIMusic(void){}
void I_SetMIDIMusicVolume(UINT8 volume)
{
(void)volume;
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_LoadSong(char *data, size_t len)
{
(void)data;
(void)len;
return -1;
}
boolean I_PlaySong(INT32 handle, boolean looping)
boolean I_PlaySong(boolean looping)
{
(void)handle;
(void)looping;

View file

@ -1605,7 +1605,7 @@ static void I_PauseGME(void)
#endif
}
void I_PauseSong(INT32 handle)
void I_PauseSong(void)
{
(void)handle;
I_PauseGME();
@ -1625,7 +1625,7 @@ static void I_ResumeGME(void)
#endif
}
void I_ResumeSong(INT32 handle)
void I_ResumeSong(void)
{
(void)handle;
I_ResumeGME();
@ -1669,7 +1669,7 @@ void I_UnRegisterSong(INT32 handle)
#endif
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_LoadSong(char *data, size_t len)
{
#ifdef HAVE_MIXER
if (nomidimusic || !musicStarted)

View file

@ -110,9 +110,9 @@ static LRESULT CALLBACK MainWndproc(HWND hWnd, UINT message, WPARAM wParam, LPAR
// pause music when alt-tab
if (appActive && !paused)
I_ResumeSong(0);
I_ResumeSong();
else if (!paused)
I_PauseSong(0);
I_PauseSong();
{
HANDLE ci = GetStdHandle(STD_INPUT_HANDLE);
DWORD mode;

View file

@ -456,14 +456,14 @@ void I_ShutdownMusic(void)
I_ShutdownMIDIMusic();
}
void I_PauseSong(INT32 handle)
void I_PauseSong(void)
{
UNREFERENCED_PARAMETER(handle);
if (music_stream)
FMR_MUSIC(FMOD_Channel_SetPaused(music_channel, true));
}
void I_ResumeSong(INT32 handle)
void I_ResumeSong(void)
{
UNREFERENCED_PARAMETER(handle);
if (music_stream)
@ -644,60 +644,64 @@ boolean I_StartDigSong(const char *musicname, boolean looping)
current_track = 0;
// Try to find a loop point in streaming music formats (ogg, mp3)
if (looping)
{
FMOD_RESULT e;
FMOD_TAG tag;
unsigned int loopstart, loopend;
FMOD_RESULT e;
FMOD_TAG tag;
unsigned int loopstart, loopend;
// A proper LOOPPOINT is its own tag, stupid.
e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
// A proper LOOPPOINT is its own tag, stupid.
e = FMOD_Sound_GetTag(music_stream, "LOOPPOINT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// todo
// if(music type == MIDI)
// {
// FMR(FMOD_Sound_SetMode(music_stream, FMOD_LOOP_NORMAL));
// return true;
// }
// Use LOOPMS for time in miliseconds.
e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Try to fetch it from the COMMENT tag, like A.J. Freda
e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
char *loopText;
// Handle any errors that arose, first
FMR(e);
// Figure out where the number starts
loopText = strstr((char *)tag.data,"LOOPPOINT=");
if (loopText != NULL)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
// Skip the "LOOPPOINT=" part.
loopText += 10;
// Convert it to our looppoint
// FMOD seems to ensure the tag is properly NULL-terminated.
// atoi will stop when it reaches anything that's not a number.
loopstart = atoi(loopText);
// Now do the rest like above
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Use LOOPMS for time in miliseconds.
e = FMOD_Sound_GetTag(music_stream, "LOOPMS", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
FMR(e);
loopstart = atoi((char *)tag.data); // assumed to be a string data tag.
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_MS, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_MS, loopend, FMOD_TIMEUNIT_PCM));
return true;
}
// Try to fetch it from the COMMENT tag, like A.J. Freda
e = FMOD_Sound_GetTag(music_stream, "COMMENT", 0, &tag);
if (e != FMOD_ERR_TAGNOTFOUND)
{
char *loopText;
// Handle any errors that arose, first
FMR(e);
// Figure out where the number starts
loopText = strstr((char *)tag.data,"LOOPPOINT=");
if (loopText != NULL)
{
// Skip the "LOOPPOINT=" part.
loopText += 10;
// Convert it to our looppoint
// FMOD seems to ensure the tag is properly NULL-terminated.
// atoi will stop when it reaches anything that's not a number.
loopstart = atoi(loopText);
// Now do the rest like above
FMR(FMOD_Sound_GetLoopPoints(music_stream, NULL, FMOD_TIMEUNIT_PCM, &loopend, FMOD_TIMEUNIT_PCM));
if (loopstart > 0)
FMR(FMOD_Sound_SetLoopPoints(music_stream, loopstart, FMOD_TIMEUNIT_PCM, loopend, FMOD_TIMEUNIT_PCM));
}
return true;
}
return true;
}
// No special loop point, but we're playing so it's all good.
@ -825,7 +829,7 @@ void I_SetMIDIMusicVolume(UINT8 volume)
FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0));
}
INT32 I_RegisterSong(void *data, size_t len)
boolean I_PlaySong(boolean looping)
{
FMOD_CREATESOUNDEXINFO fmt;
memset(&fmt, 0, sizeof(FMOD_CREATESOUNDEXINFO));