mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-17 17:50:57 +00:00
e7ff22457e
FMOD_INIT_ENABLE_PROFILE. Renamed the corresponding cvar to snd_profile. - Removed the normalize parameter from SoundStream::Play(). - Disabled the chorus and reverb effects added to SDL_mixer's Timidity, because they were probably never tested well, either. Thanks to the bug in vc_alloc(), they were never even activated. - Restored the exact frequency range search that was missing from SDL_mixer's verion of select_sample(). - Fixed: vc_alloc(), kill_others(), and note_on() treated Voice::status as a bit mask, when it's not. These were changes made to SDL_mixer's Timidity. - Restored the original Timidity volume equation. The other louder one was put in when I didn't realize all channels were mono and many notes sounded too quiet because they never completed their attack phase. - Fixed: FileReader::Gets() acted as if fgets() always read the maximum number of characters. - Fixed: FileReader::Open() did not set FilePos and StartPos to 0. SVN r908 (trunk)
110 lines
1.7 KiB
C++
110 lines
1.7 KiB
C++
#include "i_musicinterns.h"
|
|
|
|
void StreamSong::Play (bool looping)
|
|
{
|
|
m_Status = STATE_Stopped;
|
|
m_Looping = looping;
|
|
|
|
if (m_Stream->Play (m_Looping, 1))
|
|
{
|
|
m_Status = STATE_Playing;
|
|
m_LastPos = 0;
|
|
}
|
|
}
|
|
|
|
void StreamSong::Pause ()
|
|
{
|
|
if (m_Status == STATE_Playing && m_Stream != NULL)
|
|
{
|
|
if (m_Stream->SetPaused (true))
|
|
m_Status = STATE_Paused;
|
|
}
|
|
}
|
|
|
|
void StreamSong::Resume ()
|
|
{
|
|
if (m_Status == STATE_Paused && m_Stream != NULL)
|
|
{
|
|
if (m_Stream->SetPaused (false))
|
|
m_Status = STATE_Playing;
|
|
}
|
|
}
|
|
|
|
void StreamSong::Stop ()
|
|
{
|
|
if (m_Status != STATE_Stopped && m_Stream)
|
|
{
|
|
m_Stream->Stop ();
|
|
}
|
|
m_Status = STATE_Stopped;
|
|
}
|
|
|
|
StreamSong::~StreamSong ()
|
|
{
|
|
Stop ();
|
|
if (m_Stream != NULL)
|
|
{
|
|
delete m_Stream;
|
|
m_Stream = NULL;
|
|
}
|
|
}
|
|
|
|
StreamSong::StreamSong (const char *filename_or_data, int offset, int len)
|
|
{
|
|
if (GSnd != NULL)
|
|
{
|
|
m_Stream = GSnd->OpenStream (filename_or_data, SoundStream::Loop, offset, len);
|
|
}
|
|
else
|
|
{
|
|
m_Stream = NULL;
|
|
}
|
|
}
|
|
|
|
bool StreamSong::IsPlaying ()
|
|
{
|
|
if (m_Status != STATE_Stopped)
|
|
{
|
|
if (m_Looping)
|
|
return true;
|
|
|
|
int pos = m_Stream->GetPosition ();
|
|
|
|
if (pos < m_LastPos)
|
|
{
|
|
Stop ();
|
|
return false;
|
|
}
|
|
|
|
m_LastPos = pos;
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
//
|
|
// StreamSong :: SetPosition
|
|
//
|
|
// Sets the current order number for a MOD-type song, or the position in ms
|
|
// for anything else.
|
|
|
|
bool StreamSong::SetPosition(int order)
|
|
{
|
|
if (m_Stream != NULL)
|
|
{
|
|
return m_Stream->SetPosition(order);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
FString StreamSong::GetStats()
|
|
{
|
|
if (m_Stream != NULL)
|
|
{
|
|
return m_Stream->GetStats();
|
|
}
|
|
return "No song loaded\n";
|
|
}
|