aboutsummaryrefslogtreecommitdiff
path: root/src/libjin/audio/sdl/source.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2018-05-29 12:39:52 +0800
committerchai <chaifix@163.com>2018-05-29 12:39:52 +0800
commite024e5a23c4f5c8e8fb02e7b03c8e9265ac6c1ef (patch)
treea19511ccb880db2f7dd99778efc956435474a518 /src/libjin/audio/sdl/source.cpp
parent2add73bb54ce9376ffcd44ffd929049d3c430628 (diff)
Image改为工厂
Diffstat (limited to 'src/libjin/audio/sdl/source.cpp')
-rw-r--r--src/libjin/audio/sdl/source.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libjin/audio/sdl/source.cpp b/src/libjin/audio/sdl/source.cpp
index 2bb63f5..b647229 100644
--- a/src/libjin/audio/sdl/source.cpp
+++ b/src/libjin/audio/sdl/source.cpp
@@ -54,7 +54,7 @@ namespace audio
shared std::vector<SDLSource*> Manager::sources;
shared Manager* Manager::manager = nullptr;
- SDLSource* SDLSource::createSource(SourceType format, const char* file)
+ SDLSource* SDLSource::createSource(const char* file)
{
std::ifstream fs;
fs.open(file, std::ios::binary);
@@ -69,12 +69,12 @@ namespace audio
char* buffer = (char*)malloc(size);
memset(buffer, 0, size);
fs.read(buffer, size);
- SDLSource* source = createSource(format, buffer, size);
+ SDLSource* source = createSource(buffer, size);
free(buffer);
return source;
}
- SDLSource* SDLSource::createSource(SourceType format, void* mem, size_t size)
+ SDLSource* SDLSource::createSource(void* mem, size_t size)
{
if (mem == nullptr)
return nullptr;
@@ -82,6 +82,7 @@ namespace audio
#define read(FMT) case FMT : source->load##FMT(mem, size); break
try
{
+ SourceType format = getType(mem, size);
switch (format)
{
read(OGG);