1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 07:53:52 +00:00

Make the sound decoder's Open method return void

Errors are thrown, not returned
This commit is contained in:
Chris Robinson 2012-03-17 03:18:28 -07:00
parent 1b41987e18
commit caf5d71d44
6 changed files with 8 additions and 11 deletions

View file

@ -9,10 +9,9 @@ namespace MWSound
static void fail(const std::string &msg)
{ throw std::runtime_error("FFmpeg exception: "+msg); }
bool FFmpeg_Decoder::Open(const std::string &fname)
void FFmpeg_Decoder::Open(const std::string &fname)
{
fail("Not currently working");
return false;
}
void FFmpeg_Decoder::Close()

View file

@ -16,7 +16,7 @@ namespace MWSound
{
class FFmpeg_Decoder : public Sound_Decoder
{
virtual bool Open(const std::string &fname);
virtual void Open(const std::string &fname);
virtual void Close();
virtual void GetInfo(int *samplerate, ChannelConfig *chans, SampleType *type);

View file

@ -12,7 +12,7 @@ static void fail(const std::string &msg)
namespace MWSound
{
bool MpgSnd_Decoder::Open(const std::string &fname)
void MpgSnd_Decoder::Open(const std::string &fname)
{
Close();
@ -31,7 +31,7 @@ bool MpgSnd_Decoder::Open(const std::string &fname)
fail("Unsupported channel count in "+fname);
}
sampleRate = info.samplerate;
return true;
return;
}
mpgFile = mpg123_new(NULL, NULL);
@ -49,7 +49,7 @@ bool MpgSnd_Decoder::Open(const std::string &fname)
fail("Unsupported channel count in "+fname);
chanConfig = ((channels==2)?StereoChannels:MonoChannels);
sampleRate = rate;
return true;
return;
}
catch(std::exception &e)
{
@ -64,7 +64,6 @@ bool MpgSnd_Decoder::Open(const std::string &fname)
mpgFile = NULL;
fail("Unsupported file type: "+fname);
return false;
}
void MpgSnd_Decoder::Close()

View file

@ -19,7 +19,7 @@ namespace MWSound
ChannelConfig chanConfig;
int sampleRate;
virtual bool Open(const std::string &fname);
virtual void Open(const std::string &fname);
virtual void Close();
virtual void GetInfo(int *samplerate, ChannelConfig *chans, SampleType *type);

View file

@ -236,8 +236,7 @@ Sound* OpenAL_Output::StreamSound(const std::string &fname, std::auto_ptr<Sound_
{
std::auto_ptr<OpenAL_SoundStream> sound;
if(!decoder->Open(fname))
return NULL;
decoder->Open(fname);
sound.reset(new OpenAL_SoundStream(decoder));
sound->Play();

View file

@ -14,7 +14,7 @@ namespace MWSound
MonoChannels,
StereoChannels
};
virtual bool Open(const std::string &fname) = 0;
virtual void Open(const std::string &fname) = 0;
virtual void Close() = 0;
virtual void GetInfo(int *samplerate, ChannelConfig *chans, SampleType *type) = 0;