mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-31 05:40:44 +00:00
- Fixed spurious warnings on 32-bit VC++ debug builds.
- Made the subsong (order) number a proper parameter to MusInfo::Play() instead of requiring a separate SetPosition() call to do it. SVN r1104 (trunk)
This commit is contained in:
parent
8d3e67ac88
commit
9f21b22cc5
16 changed files with 133 additions and 93 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
August 2, 2008
|
||||||
|
- Fixed spurious warnings on 32-bit VC++ debug builds.
|
||||||
|
- Made the subsong (order) number a proper parameter to MusInfo::Play()
|
||||||
|
instead of requiring a separate SetPosition() call to do it.
|
||||||
|
|
||||||
August 2, 2008 (Changes by Graf Zahl)
|
August 2, 2008 (Changes by Graf Zahl)
|
||||||
- Added Gez's submission for custom bridge things.
|
- Added Gez's submission for custom bridge things.
|
||||||
- Fixed: ASpecialSpot must check the array's size before dividing by it.
|
- Fixed: ASpecialSpot must check the array's size before dividing by it.
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
struct MusPlayingInfo
|
struct MusPlayingInfo
|
||||||
{
|
{
|
||||||
FString name;
|
FString name;
|
||||||
void *handle;
|
MusInfo *handle;
|
||||||
int baseorder;
|
int baseorder;
|
||||||
bool loop;
|
bool loop;
|
||||||
};
|
};
|
||||||
|
@ -1838,8 +1838,10 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
{
|
{
|
||||||
if (order != mus_playing.baseorder)
|
if (order != mus_playing.baseorder)
|
||||||
{
|
{
|
||||||
mus_playing.baseorder =
|
if (mus_playing.handle->SetSubsong(order))
|
||||||
(I_SetSongPosition (mus_playing.handle, order) ? order : 0);
|
{
|
||||||
|
mus_playing.baseorder = order;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1862,7 +1864,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
int lumpnum = -1;
|
int lumpnum = -1;
|
||||||
int offset = 0, length = 0;
|
int offset = 0, length = 0;
|
||||||
int device = MDEV_DEFAULT;
|
int device = MDEV_DEFAULT;
|
||||||
void *handle = NULL;
|
MusInfo *handle = NULL;
|
||||||
|
|
||||||
int *devp = MidiDevices.CheckKey(FName(musicname));
|
int *devp = MidiDevices.CheckKey(FName(musicname));
|
||||||
if (devp != NULL) device = *devp;
|
if (devp != NULL) device = *devp;
|
||||||
|
@ -1932,7 +1934,7 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
{
|
{
|
||||||
mus_playing.loop = looping;
|
mus_playing.loop = looping;
|
||||||
mus_playing.name = "";
|
mus_playing.name = "";
|
||||||
mus_playing.baseorder = 0;
|
mus_playing.baseorder = order;
|
||||||
LastSong = musicname;
|
LastSong = musicname;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1956,13 +1958,13 @@ bool S_ChangeMusic (const char *musicname, int order, bool looping, bool force)
|
||||||
|
|
||||||
mus_playing.loop = looping;
|
mus_playing.loop = looping;
|
||||||
mus_playing.name = musicname;
|
mus_playing.name = musicname;
|
||||||
|
mus_playing.baseorder = 0;
|
||||||
LastSong = "";
|
LastSong = "";
|
||||||
|
|
||||||
if (mus_playing.handle != 0)
|
if (mus_playing.handle != 0)
|
||||||
{ // play it
|
{ // play it
|
||||||
I_PlaySong (mus_playing.handle, looping, S_GetMusicVolume (musicname));
|
I_PlaySong (mus_playing.handle, looping, S_GetMusicVolume (musicname), order);
|
||||||
mus_playing.baseorder =
|
mus_playing.baseorder = order;
|
||||||
(I_SetSongPosition (mus_playing.handle, order) ? order : 0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -454,21 +454,16 @@ public:
|
||||||
Volume = volume;
|
Volume = volume;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets the current order number for a MOD-type song, or the position in ms
|
// Sets the position in ms.
|
||||||
// for anything else.
|
bool SetPosition(unsigned int ms_pos)
|
||||||
bool SetPosition(int pos)
|
|
||||||
{
|
{
|
||||||
FMOD_SOUND_TYPE type;
|
return FMOD_OK == Channel->setPosition(ms_pos, FMOD_TIMEUNIT_MS);
|
||||||
|
}
|
||||||
|
|
||||||
if (FMOD_OK == Stream->getFormat(&type, NULL, NULL, NULL) &&
|
// Sets the order number for MOD formats.
|
||||||
(type == FMOD_SOUND_TYPE_IT ||
|
bool SetOrder(int order_pos)
|
||||||
type == FMOD_SOUND_TYPE_MOD ||
|
{
|
||||||
type == FMOD_SOUND_TYPE_S3M ||
|
return FMOD_OK == Channel->setPosition(order_pos, FMOD_TIMEUNIT_MODORDER);
|
||||||
type == FMOD_SOUND_TYPE_XM))
|
|
||||||
{
|
|
||||||
return FMOD_OK == Channel->setPosition(pos, FMOD_TIMEUNIT_MODORDER);
|
|
||||||
}
|
|
||||||
return FMOD_OK == Channel->setPosition(pos, FMOD_TIMEUNIT_MS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FString GetStats()
|
FString GetStats()
|
||||||
|
|
|
@ -121,7 +121,12 @@ MusInfo::~MusInfo ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MusInfo::SetPosition (int order)
|
bool MusInfo::SetPosition (unsigned int ms)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool MusInfo::SetSubsong (int subsong)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -197,7 +202,7 @@ void I_ShutdownMusic(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void I_PlaySong (void *handle, int _looping, float rel_vol)
|
void I_PlaySong (void *handle, int _looping, float rel_vol, int subsong)
|
||||||
{
|
{
|
||||||
MusInfo *info = (MusInfo *)handle;
|
MusInfo *info = (MusInfo *)handle;
|
||||||
|
|
||||||
|
@ -206,7 +211,7 @@ void I_PlaySong (void *handle, int _looping, float rel_vol)
|
||||||
|
|
||||||
saved_relative_volume = relative_volume = rel_vol;
|
saved_relative_volume = relative_volume = rel_vol;
|
||||||
info->Stop ();
|
info->Stop ();
|
||||||
info->Play (_looping ? true : false);
|
info->Play (!!_looping, subsong);
|
||||||
info->m_NotStartedYet = false;
|
info->m_NotStartedYet = false;
|
||||||
|
|
||||||
if (info->m_Status == MusInfo::STATE_Playing)
|
if (info->m_Status == MusInfo::STATE_Playing)
|
||||||
|
@ -256,7 +261,7 @@ void I_UnRegisterSong (void *handle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_RegisterURLSong (const char *url)
|
MusInfo *I_RegisterURLSong (const char *url)
|
||||||
{
|
{
|
||||||
StreamSong *song;
|
StreamSong *song;
|
||||||
|
|
||||||
|
@ -269,7 +274,7 @@ void *I_RegisterURLSong (const char *url)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_RegisterSong (const char *filename, char *musiccache, int offset, int len, int device)
|
MusInfo *I_RegisterSong (const char *filename, char *musiccache, int offset, int len, int device)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
MusInfo *info = NULL;
|
MusInfo *info = NULL;
|
||||||
|
@ -539,7 +544,7 @@ void *I_RegisterSong (const char *filename, char *musiccache, int offset, int le
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *I_RegisterCDSong (int track, int id)
|
MusInfo *I_RegisterCDSong (int track, int id)
|
||||||
{
|
{
|
||||||
MusInfo *info = new CDSong (track, id);
|
MusInfo *info = new CDSong (track, id);
|
||||||
|
|
||||||
|
@ -635,7 +640,7 @@ CCMD (writeopl)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dumper->Play(false);
|
dumper->Play(false, 0); // FIXME: Remember subsong.
|
||||||
delete dumper;
|
delete dumper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -673,7 +678,7 @@ CCMD (writewave)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dumper->Play(false);
|
dumper->Play(false, 0); // FIXME: Remember subsong
|
||||||
delete dumper;
|
delete dumper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,14 +54,15 @@ void I_PauseSong (void *handle);
|
||||||
void I_ResumeSong (void *handle);
|
void I_ResumeSong (void *handle);
|
||||||
|
|
||||||
// Registers a song handle to song data.
|
// Registers a song handle to song data.
|
||||||
void *I_RegisterSong (const char *file, char * musiccache, int offset, int length, int device);
|
class MusInfo;
|
||||||
void *I_RegisterCDSong (int track, int cdid = 0);
|
MusInfo *I_RegisterSong (const char *file, char * musiccache, int offset, int length, int device);
|
||||||
void *I_RegisterURLSong (const char *url);
|
MusInfo *I_RegisterCDSong (int track, int cdid = 0);
|
||||||
|
MusInfo *I_RegisterURLSong (const char *url);
|
||||||
|
|
||||||
// Called by anything that wishes to start music.
|
// Called by anything that wishes to start music.
|
||||||
// Plays a song, and when the song is done,
|
// Plays a song, and when the song is done,
|
||||||
// starts playing it again in an endless loop.
|
// starts playing it again in an endless loop.
|
||||||
void I_PlaySong (void *handle, int looping, float relative_vol=1.f);
|
void I_PlaySong (void *handle, int looping, float relative_vol=1.f, int subsong=0);
|
||||||
|
|
||||||
// Stops a song.
|
// Stops a song.
|
||||||
void I_StopSong (void *handle);
|
void I_StopSong (void *handle);
|
||||||
|
@ -75,4 +76,38 @@ bool I_SetSongPosition (void *handle, int order);
|
||||||
// Is the song still playing?
|
// Is the song still playing?
|
||||||
bool I_QrySongPlaying (void *handle);
|
bool I_QrySongPlaying (void *handle);
|
||||||
|
|
||||||
|
// The base music class. Everything is derived from this --------------------
|
||||||
|
|
||||||
|
class MusInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MusInfo ();
|
||||||
|
virtual ~MusInfo ();
|
||||||
|
virtual void MusicVolumeChanged(); // snd_musicvolume changed
|
||||||
|
virtual void TimidityVolumeChanged(); // timidity_mastervolume changed
|
||||||
|
virtual void Play (bool looping, int subsong) = 0;
|
||||||
|
virtual void Pause () = 0;
|
||||||
|
virtual void Resume () = 0;
|
||||||
|
virtual void Stop () = 0;
|
||||||
|
virtual bool IsPlaying () = 0;
|
||||||
|
virtual bool IsMIDI () const = 0;
|
||||||
|
virtual bool IsValid () const = 0;
|
||||||
|
virtual bool SetPosition (unsigned int ms);
|
||||||
|
virtual bool SetSubsong (int subsong);
|
||||||
|
virtual void Update();
|
||||||
|
virtual FString GetStats();
|
||||||
|
virtual MusInfo *GetOPLDumper(const char *filename);
|
||||||
|
virtual MusInfo *GetWaveDumper(const char *filename, int rate);
|
||||||
|
|
||||||
|
enum EState
|
||||||
|
{
|
||||||
|
STATE_Stopped,
|
||||||
|
STATE_Playing,
|
||||||
|
STATE_Paused
|
||||||
|
} m_Status;
|
||||||
|
bool m_Looping;
|
||||||
|
bool m_NotStartedYet; // Song has been created but not yet played
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif //__I_MUSIC_H__
|
#endif //__I_MUSIC_H__
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "c_cvars.h"
|
#include "c_cvars.h"
|
||||||
#include "mus2midi.h"
|
#include "mus2midi.h"
|
||||||
#include "i_sound.h"
|
#include "i_sound.h"
|
||||||
|
#include "i_music.h"
|
||||||
|
|
||||||
void I_InitMusicWin32 ();
|
void I_InitMusicWin32 ();
|
||||||
void I_ShutdownMusicWin32 ();
|
void I_ShutdownMusicWin32 ();
|
||||||
|
@ -29,38 +30,6 @@ extern float relative_volume;
|
||||||
EXTERN_CVAR (Float, timidity_mastervolume)
|
EXTERN_CVAR (Float, timidity_mastervolume)
|
||||||
|
|
||||||
|
|
||||||
// The base music class. Everything is derived from this --------------------
|
|
||||||
|
|
||||||
class MusInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MusInfo ();
|
|
||||||
virtual ~MusInfo ();
|
|
||||||
virtual void MusicVolumeChanged(); // snd_musicvolume changed
|
|
||||||
virtual void TimidityVolumeChanged(); // timidity_mastervolume changed
|
|
||||||
virtual void Play (bool looping) = 0;
|
|
||||||
virtual void Pause () = 0;
|
|
||||||
virtual void Resume () = 0;
|
|
||||||
virtual void Stop () = 0;
|
|
||||||
virtual bool IsPlaying () = 0;
|
|
||||||
virtual bool IsMIDI () const = 0;
|
|
||||||
virtual bool IsValid () const = 0;
|
|
||||||
virtual bool SetPosition (int order);
|
|
||||||
virtual void Update();
|
|
||||||
virtual FString GetStats();
|
|
||||||
virtual MusInfo *GetOPLDumper(const char *filename);
|
|
||||||
virtual MusInfo *GetWaveDumper(const char *filename, int rate);
|
|
||||||
|
|
||||||
enum EState
|
|
||||||
{
|
|
||||||
STATE_Stopped,
|
|
||||||
STATE_Playing,
|
|
||||||
STATE_Paused
|
|
||||||
} m_Status;
|
|
||||||
bool m_Looping;
|
|
||||||
bool m_NotStartedYet; // Song has been created but not yet played
|
|
||||||
};
|
|
||||||
|
|
||||||
// A device that provides a WinMM-like MIDI streaming interface -------------
|
// A device that provides a WinMM-like MIDI streaming interface -------------
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
@ -302,7 +271,7 @@ public:
|
||||||
|
|
||||||
void MusicVolumeChanged();
|
void MusicVolumeChanged();
|
||||||
void TimidityVolumeChanged();
|
void TimidityVolumeChanged();
|
||||||
void Play(bool looping);
|
void Play(bool looping, int subsong);
|
||||||
void Pause();
|
void Pause();
|
||||||
void Resume();
|
void Resume();
|
||||||
void Stop();
|
void Stop();
|
||||||
|
@ -441,14 +410,15 @@ class StreamSong : public MusInfo
|
||||||
public:
|
public:
|
||||||
StreamSong (const char *file, int offset, int length);
|
StreamSong (const char *file, int offset, int length);
|
||||||
~StreamSong ();
|
~StreamSong ();
|
||||||
void Play (bool looping);
|
void Play (bool looping, int subsong);
|
||||||
void Pause ();
|
void Pause ();
|
||||||
void Resume ();
|
void Resume ();
|
||||||
void Stop ();
|
void Stop ();
|
||||||
bool IsPlaying ();
|
bool IsPlaying ();
|
||||||
bool IsMIDI () const { return false; }
|
bool IsMIDI () const { return false; }
|
||||||
bool IsValid () const { return m_Stream != NULL; }
|
bool IsValid () const { return m_Stream != NULL; }
|
||||||
bool SetPosition (int order);
|
bool SetPosition (unsigned int pos);
|
||||||
|
bool SetSubsong (int subsong);
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -464,7 +434,7 @@ class TimiditySong : public StreamSong
|
||||||
public:
|
public:
|
||||||
TimiditySong (FILE *file, char * musiccache, int length);
|
TimiditySong (FILE *file, char * musiccache, int length);
|
||||||
~TimiditySong ();
|
~TimiditySong ();
|
||||||
void Play (bool looping);
|
void Play (bool looping, int subsong);
|
||||||
void Stop ();
|
void Stop ();
|
||||||
bool IsPlaying ();
|
bool IsPlaying ();
|
||||||
bool IsValid () const { return CommandLine.Len() > 0; }
|
bool IsValid () const { return CommandLine.Len() > 0; }
|
||||||
|
@ -502,7 +472,7 @@ class OPLMUSSong : public StreamSong
|
||||||
public:
|
public:
|
||||||
OPLMUSSong (FILE *file, char *musiccache, int length);
|
OPLMUSSong (FILE *file, char *musiccache, int length);
|
||||||
~OPLMUSSong ();
|
~OPLMUSSong ();
|
||||||
void Play (bool looping);
|
void Play (bool looping, int subsong);
|
||||||
bool IsPlaying ();
|
bool IsPlaying ();
|
||||||
bool IsValid () const;
|
bool IsValid () const;
|
||||||
void ResetChips ();
|
void ResetChips ();
|
||||||
|
@ -530,7 +500,7 @@ class CDSong : public MusInfo
|
||||||
public:
|
public:
|
||||||
CDSong (int track, int id);
|
CDSong (int track, int id);
|
||||||
~CDSong ();
|
~CDSong ();
|
||||||
void Play (bool looping);
|
void Play (bool looping, int subsong);
|
||||||
void Pause ();
|
void Pause ();
|
||||||
void Resume ();
|
void Resume ();
|
||||||
void Stop ();
|
void Stop ();
|
||||||
|
|
|
@ -302,7 +302,12 @@ SoundStream::~SoundStream ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SoundStream::SetPosition(int pos)
|
bool SoundStream::SetPosition(unsigned int pos)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SoundStream::SetOrder(int order)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,8 @@ public:
|
||||||
virtual bool SetPaused(bool paused) = 0;
|
virtual bool SetPaused(bool paused) = 0;
|
||||||
virtual unsigned int GetPosition() = 0;
|
virtual unsigned int GetPosition() = 0;
|
||||||
virtual bool IsEnded() = 0;
|
virtual bool IsEnded() = 0;
|
||||||
virtual bool SetPosition(int pos);
|
virtual bool SetPosition(unsigned int pos);
|
||||||
|
virtual bool SetOrder(int order);
|
||||||
virtual FString GetStats();
|
virtual FString GetStats();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "i_musicinterns.h"
|
#include "i_musicinterns.h"
|
||||||
#include "i_cd.h"
|
#include "i_cd.h"
|
||||||
|
|
||||||
void CDSong::Play (bool looping)
|
void CDSong::Play (bool looping, int subsong)
|
||||||
{
|
{
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
|
@ -45,8 +45,9 @@ class input_mod : public StreamSong
|
||||||
public:
|
public:
|
||||||
input_mod(DUH *myduh);
|
input_mod(DUH *myduh);
|
||||||
~input_mod();
|
~input_mod();
|
||||||
bool SetPosition(int order);
|
//bool SetPosition(int ms);
|
||||||
void Play(bool looping);
|
bool SetSubsong(int subsong);
|
||||||
|
void Play(bool looping, int subsong);
|
||||||
FString GetStats();
|
FString GetStats();
|
||||||
|
|
||||||
FString Codec;
|
FString Codec;
|
||||||
|
@ -1153,11 +1154,12 @@ input_mod::~input_mod()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void input_mod::Play(bool looping)
|
void input_mod::Play(bool looping, int order)
|
||||||
{
|
{
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
||||||
|
start_order = order;
|
||||||
if (open2(0) && m_Stream->Play(m_Looping, 1))
|
if (open2(0) && m_Stream->Play(m_Looping, 1))
|
||||||
{
|
{
|
||||||
m_Status = STATE_Playing;
|
m_Status = STATE_Playing;
|
||||||
|
@ -1166,15 +1168,11 @@ void input_mod::Play(bool looping)
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// input_mod :: SetPosition
|
// input_mod :: SetSubsong
|
||||||
//
|
|
||||||
// FIXME: Pass the order number as a subsong parameter to Play, so we don't
|
|
||||||
// need to start playback at one position and then immediately throw that
|
|
||||||
// playback structure away and create a new one to go to the new order.
|
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
bool input_mod::SetPosition(int order)
|
bool input_mod::SetSubsong(int order)
|
||||||
{
|
{
|
||||||
if (order == start_order)
|
if (order == start_order)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ CUSTOM_CVAR (Int, timidity_frequency, 22050, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
|
||||||
self = 65000;
|
self = 65000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimiditySong::Play (bool looping)
|
void TimiditySong::Play (bool looping, int subsong)
|
||||||
{
|
{
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
|
@ -182,7 +182,7 @@ void MIDIStreamer::CheckCaps()
|
||||||
//
|
//
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
||||||
void MIDIStreamer::Play(bool looping)
|
void MIDIStreamer::Play(bool looping, int subsong)
|
||||||
{
|
{
|
||||||
DWORD tid;
|
DWORD tid;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool OPLMUSSong::IsPlaying ()
|
||||||
return m_Status == STATE_Playing;
|
return m_Status == STATE_Playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OPLMUSSong::Play (bool looping)
|
void OPLMUSSong::Play (bool looping, int subsong)
|
||||||
{
|
{
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
#include "i_musicinterns.h"
|
#include "i_musicinterns.h"
|
||||||
|
|
||||||
void StreamSong::Play (bool looping)
|
void StreamSong::Play (bool looping, int subsong)
|
||||||
{
|
{
|
||||||
m_Status = STATE_Stopped;
|
m_Status = STATE_Stopped;
|
||||||
m_Looping = looping;
|
m_Looping = looping;
|
||||||
|
|
||||||
if (m_Stream->Play (m_Looping, 1))
|
if (m_Stream->Play (m_Looping, 1))
|
||||||
{
|
{
|
||||||
|
if (subsong != 0)
|
||||||
|
{
|
||||||
|
m_Stream->SetOrder (subsong);
|
||||||
|
}
|
||||||
m_Status = STATE_Playing;
|
m_Status = STATE_Playing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,14 +74,25 @@ bool StreamSong::IsPlaying ()
|
||||||
//
|
//
|
||||||
// StreamSong :: SetPosition
|
// StreamSong :: SetPosition
|
||||||
//
|
//
|
||||||
// Sets the current order number for a MOD-type song, or the position in ms
|
// Sets the position in ms.
|
||||||
// for anything else.
|
|
||||||
|
|
||||||
bool StreamSong::SetPosition(int order)
|
bool StreamSong::SetPosition(unsigned int pos)
|
||||||
{
|
{
|
||||||
if (m_Stream != NULL)
|
if (m_Stream != NULL)
|
||||||
{
|
{
|
||||||
return m_Stream->SetPosition(order);
|
return m_Stream->SetPosition(pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool StreamSong::SetSubsong(int subsong)
|
||||||
|
{
|
||||||
|
if (m_Stream != NULL)
|
||||||
|
{
|
||||||
|
return m_Stream->SetOrder(subsong);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -139,8 +139,17 @@ public:
|
||||||
operator const char *() const { return Chars; }
|
operator const char *() const { return Chars; }
|
||||||
|
|
||||||
const char *GetChars() const { return Chars; }
|
const char *GetChars() const { return Chars; }
|
||||||
|
|
||||||
const char &operator[] (int index) const { return Chars[index]; }
|
const char &operator[] (int index) const { return Chars[index]; }
|
||||||
|
#if defined(_WIN32) && !defined(_WIN64) && defined(_MSC_VER)
|
||||||
|
// Compiling 32-bit Windows source with MSVC: size_t is typedefed to an
|
||||||
|
// unsigned int with the 64-bit portability warning attribute, so the
|
||||||
|
// prototype cannot substitute unsigned int for size_t, or you get
|
||||||
|
// spurious warnings.
|
||||||
|
const char &operator[] (size_t index) const { return Chars[index]; }
|
||||||
|
#else
|
||||||
const char &operator[] (unsigned int index) const { return Chars[index]; }
|
const char &operator[] (unsigned int index) const { return Chars[index]; }
|
||||||
|
#endif
|
||||||
const char &operator[] (unsigned long index) const { return Chars[index]; }
|
const char &operator[] (unsigned long index) const { return Chars[index]; }
|
||||||
const char &operator[] (unsigned long long index) const { return Chars[index]; }
|
const char &operator[] (unsigned long long index) const { return Chars[index]; }
|
||||||
|
|
||||||
|
|
|
@ -465,7 +465,7 @@
|
||||||
</References>
|
</References>
|
||||||
<Files>
|
<Files>
|
||||||
<Filter
|
<Filter
|
||||||
Name="A Source Files"
|
Name="!Source Files"
|
||||||
Filter="c;cpp"
|
Filter="c;cpp"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
|
@ -1078,7 +1078,7 @@
|
||||||
</Filter>
|
</Filter>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter
|
<Filter
|
||||||
Name="A Header Files"
|
Name="!Header Files"
|
||||||
Filter="h"
|
Filter="h"
|
||||||
>
|
>
|
||||||
<File
|
<File
|
||||||
|
|
Loading…
Reference in a new issue