mirror of https://github.com/jorio/Pomme.git
Fix MP3 support for older compilers
This commit is contained in:
parent
5d3fcb6ec6
commit
3fdd6f80f8
|
@ -3,6 +3,7 @@
|
||||||
#include "PommeSound.h"
|
#include "PommeSound.h"
|
||||||
#include "Utilities/memstream.h"
|
#include "Utilities/memstream.h"
|
||||||
#include "Utilities/bigendianstreams.h"
|
#include "Utilities/bigendianstreams.h"
|
||||||
|
#include <Utilities/StringUtils.h>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
using namespace Pomme::Sound;
|
using namespace Pomme::Sound;
|
||||||
|
@ -267,17 +268,17 @@ SndListHandle Pomme_SndLoadFileAsResource(short fRefNum)
|
||||||
auto& spec = Pomme::Files::GetSpec(fRefNum);
|
auto& spec = Pomme::Files::GetSpec(fRefNum);
|
||||||
auto& stream = Pomme::Files::GetStream(fRefNum);
|
auto& stream = Pomme::Files::GetStream(fRefNum);
|
||||||
|
|
||||||
std::string fileName(spec.cName);
|
std::string fileName = UppercaseCopy(spec.cName);
|
||||||
std::transform(fileName.begin(), fileName.end(), fileName.begin(), tolower);
|
fs::path extension = fs::path(AsU8(fileName)).extension();
|
||||||
|
|
||||||
// Guess media container from extension
|
// Guess media container from extension
|
||||||
if (fileName.ends_with(".aiff")
|
if (extension == ".AIFF"
|
||||||
|| fileName.ends_with(".aifc")
|
|| extension == ".AIFC"
|
||||||
|| fileName.ends_with(".aif"))
|
|| extension == ".AIF")
|
||||||
{
|
{
|
||||||
return LoadAIFFAsResource(stream);
|
return LoadAIFFAsResource(stream);
|
||||||
}
|
}
|
||||||
else if (fileName.ends_with(".mp3"))
|
else if (extension == ".MP3")
|
||||||
{
|
{
|
||||||
#ifndef POMME_NO_MP3
|
#ifndef POMME_NO_MP3
|
||||||
return LoadMP3AsResource(stream);
|
return LoadMP3AsResource(stream);
|
||||||
|
|
|
@ -16,7 +16,7 @@ SndListHandle Pomme::Sound::LoadMP3AsResource(std::istream& stream)
|
||||||
mp3dec_t context = {};
|
mp3dec_t context = {};
|
||||||
mp3dec_init(&context);
|
mp3dec_init(&context);
|
||||||
|
|
||||||
mp3dec_frame_info_t frameInfo;
|
mp3dec_frame_info_t frameInfo = {};
|
||||||
|
|
||||||
std::vector<uint8_t> fileBuf;
|
std::vector<uint8_t> fileBuf;
|
||||||
std::vector<mp3d_sample_t> songPCM;
|
std::vector<mp3d_sample_t> songPCM;
|
||||||
|
|
Loading…
Reference in New Issue