From e024e5a23c4f5c8e8fb02e7b03c8e9265ac6c1ef Mon Sep 17 00:00:00 2001 From: chai Date: Tue, 29 May 2018 12:39:52 +0800 Subject: =?UTF-8?q?Image=E6=94=B9=E4=B8=BA=E5=B7=A5=E5=8E=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/audio/sdl/source.cpp | 7 ++++--- src/libjin/audio/sdl/source.h | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src/libjin/audio/sdl') 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 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); diff --git a/src/libjin/audio/sdl/source.h b/src/libjin/audio/sdl/source.h index 900568f..743d4f0 100644 --- a/src/libjin/audio/sdl/source.h +++ b/src/libjin/audio/sdl/source.h @@ -22,8 +22,8 @@ namespace audio ~SDLSource(); - static SDLSource* createSource(SourceType format, const char* file); - static SDLSource* createSource(SourceType format, void* mem, size_t size); + static SDLSource* createSource(const char* file); + static SDLSource* createSource(void* mem, size_t size); /* ISource interface */ void play() override; -- cgit v1.1-26-g67d0