- Fixed: FString::StripRight() stripped the final character of the string if

there were no designated characters to strip at the end of it.
- Added support for Shoutcast/Icecast playlists.
- Added an error message when a playlist could not be opened.
- Added support for PLS format playlists, in addition to M3U.
- Changed FPlayList to use an array of FStrings.
- Fixed: Playlists required every song to be specified by an absolute path.


SVN r951 (trunk)
This commit is contained in:
Randy Heit 2008-04-30 05:36:24 +00:00
commit c86d7e0afd
12 changed files with 291 additions and 125 deletions

View file

@ -1181,10 +1181,12 @@ void S_UpdateSounds (void *listener_p)
if (GSnd == NULL)
return;
// [RH] Update playlist
if (PlayList &&
mus_playing.handle &&
!I_QrySongPlaying(mus_playing.handle))
// [RH] Update music and/or playlist. I_QrySongPlaying() must be called
// to attempt to reconnect to broken net streams and to advance the
// playlist when the current song finishes.
if (mus_playing.handle != NULL &&
!I_QrySongPlaying(mus_playing.handle) &&
PlayList)
{
PlayList->Advance();
S_ActivatePlayList(false);
@ -1335,42 +1337,64 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
int lumpnum = -1;
int offset, length;
int device = MDEV_DEFAULT;
void *handle = NULL;
int *devp = MidiDevices.CheckKey(FName(musicname));
if (devp != NULL) device = *devp;
// Strip off any leading file:// component.
if (strncmp(musicname, "file://", 7) == 0)
{
musicname += 7;
}
if (!FileExists (musicname))
{
if ((lumpnum = Wads.CheckNumForFullName (musicname, true, ns_music)) == -1)
{
Printf ("Music \"%s\" not found\n", musicname);
return false;
}
if (!Wads.IsUncompressedFile(lumpnum))
{
// We must cache the music data and use it from memory.
// shut down old music before reallocating and overwriting the cache!
S_StopMusic (true);
offset = -1; // this tells the low level code that the music
// is being used from memory
length = Wads.LumpLength (lumpnum);
if (length == 0)
if (strstr(musicname, "://") > musicname)
{
// Looks like a URL; try it as such.
handle = I_RegisterURLSong(musicname);
if (handle == NULL)
{
Printf ("Could not open \"%s\"\n", musicname);
return false;
}
}
else
{
Printf ("Music \"%s\" not found\n", musicname);
return false;
}
musiccache.Resize(length);
Wads.ReadLump(lumpnum, &musiccache[0]);
}
else
if (handle == NULL)
{
offset = Wads.GetLumpOffset (lumpnum);
length = Wads.LumpLength (lumpnum);
if (length == 0)
if (!Wads.IsUncompressedFile(lumpnum))
{
return false;
// We must cache the music data and use it from memory.
// shut down old music before reallocating and overwriting the cache!
S_StopMusic (true);
offset = -1; // this tells the low level code that the music
// is being used from memory
length = Wads.LumpLength (lumpnum);
if (length == 0)
{
return false;
}
musiccache.Resize(length);
Wads.ReadLump(lumpnum, &musiccache[0]);
}
else
{
offset = Wads.GetLumpOffset (lumpnum);
length = Wads.LumpLength (lumpnum);
if (length == 0)
{
return false;
}
}
}
}
@ -1394,7 +1418,11 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
}
// load & register it
if (offset != -1)
if (handle != NULL)
{
mus_playing.handle = handle;
}
else if (offset != -1)
{
mus_playing.handle = I_RegisterSong (lumpnum != -1 ?
Wads.GetWadFullName (Wads.GetLumpFile (lumpnum)) :