commit x64 compilation from lulu cause the other branch dont seems to compile properly at home
This commit is contained in:
52
include/framework/audio/audio_io.cpp
Normal file
52
include/framework/audio/audio_io.cpp
Normal file
@ -0,0 +1,52 @@
|
||||
/* -----------------------------------------------------------------------------
|
||||
GSFramework
|
||||
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
|
||||
----------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#include "audio/audio_io.h"
|
||||
#include "filesystem/filesystem.h"
|
||||
#include "platform.h"
|
||||
#include "log/log.h"
|
||||
|
||||
using namespace GS;
|
||||
|
||||
template<> AudioIO *Singleton <AudioIO> ::i = NULL;
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void AudioIO::RegisterStreamFactory(IAudioStreamFactory *f)
|
||||
{ stream_factories.Add(f); }
|
||||
void AudioIO::RegisterSampleFactory(ISampleFactory *f)
|
||||
{ sample_factories.Add(f); }
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
ISample *AudioIO::LoadSample(const char *path, const char *format)
|
||||
{
|
||||
String fmt(format);
|
||||
if (Platform::Get().io->Exists(path))
|
||||
ListForeachPtr(ISampleFactory *, codec, sample_factories)
|
||||
if (ISample *sample = codec->Load(path))
|
||||
{
|
||||
if (!fmt || (fmt == sample->GetFormat()))
|
||||
return sample;
|
||||
_safe_delete(sample);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
IAudioStream *AudioIO::OpenStream(const char *path, const char *format)
|
||||
{
|
||||
String fmt(format);
|
||||
if (Platform::Get().io->Exists(path))
|
||||
ListForeachPtr(IAudioStreamFactory *, codec, stream_factories)
|
||||
if (IAudioStream *stream = codec->Open(path))
|
||||
{
|
||||
if (!fmt || (fmt == stream->GetFormat()))
|
||||
return stream;
|
||||
_safe_delete(stream);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user