1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 00:45:32 +00:00

Move OpenAL_SoundStream function definitions out of the class

This commit is contained in:
Chris Robinson 2012-03-17 03:15:07 -07:00
parent 2f6b73d461
commit 1b41987e18

View file

@ -63,8 +63,17 @@ class OpenAL_SoundStream : public Sound
std::auto_ptr<Sound_Decoder> Decoder;
public:
OpenAL_SoundStream(std::auto_ptr<Sound_Decoder> decoder) : Decoder(decoder)
{
OpenAL_SoundStream(std::auto_ptr<Sound_Decoder> decoder);
virtual ~OpenAL_SoundStream();
virtual bool Play();
virtual void Stop();
virtual bool isPlaying();
};
OpenAL_SoundStream::OpenAL_SoundStream(std::auto_ptr<Sound_Decoder> decoder)
: Decoder(decoder)
{
throwALerror();
alGenSources(1, &Source);
@ -84,8 +93,8 @@ public:
try
{
int srate;
enum Sound_Decoder::ChannelConfig chans;
enum Sound_Decoder::SampleType type;
Sound_Decoder::ChannelConfig chans;
Sound_Decoder::SampleType type;
Decoder->GetInfo(&srate, &chans, &type);
Format = getALFormat(chans, type);
@ -98,17 +107,17 @@ public:
alGetError();
throw;
}
}
virtual ~OpenAL_SoundStream()
{
}
OpenAL_SoundStream::~OpenAL_SoundStream()
{
alDeleteSources(1, &Source);
alDeleteBuffers(NumBuffers, Buffers);
alGetError();
Decoder->Close();
}
}
virtual bool Play()
{
bool OpenAL_SoundStream::Play()
{
std::vector<char> data(BufferSize);
alSourceStop(Source);
@ -128,18 +137,18 @@ public:
throwALerror();
return true;
}
}
virtual void Stop()
{
void OpenAL_SoundStream::Stop()
{
alSourceStop(Source);
alSourcei(Source, AL_BUFFER, 0);
throwALerror();
// FIXME: Rewind decoder
}
}
virtual bool isPlaying()
{
bool OpenAL_SoundStream::isPlaying()
{
ALint processed, state;
alGetSourcei(Source, AL_SOURCE_STATE, &state);
@ -180,8 +189,7 @@ public:
}
return true;
}
};
}
bool OpenAL_Output::Initialize(const std::string &devname)