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:
parent
1b41987e18
commit
caf5d71d44
6 changed files with 8 additions and 11 deletions
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue