|
@@ -3,6 +3,9 @@
|
|
|
#include "BsOAImporter.h"
|
|
#include "BsOAImporter.h"
|
|
|
#include "BsDataStream.h"
|
|
#include "BsDataStream.h"
|
|
|
#include "BsFileSystem.h"
|
|
#include "BsFileSystem.h"
|
|
|
|
|
+#include "BsOAWaveReader.h"
|
|
|
|
|
+#include "BsOAFLACReader.h"
|
|
|
|
|
+#include "BsOAOggVorbisReader.h"
|
|
|
|
|
|
|
|
namespace BansheeEngine
|
|
namespace BansheeEngine
|
|
|
{
|
|
{
|
|
@@ -22,20 +25,46 @@ namespace BansheeEngine
|
|
|
WString lowerCaseExt = ext;
|
|
WString lowerCaseExt = ext;
|
|
|
StringUtil::toLowerCase(lowerCaseExt);
|
|
StringUtil::toLowerCase(lowerCaseExt);
|
|
|
|
|
|
|
|
- // TODO
|
|
|
|
|
- return false;
|
|
|
|
|
|
|
+ return lowerCaseExt == L"wav" || lowerCaseExt == L"flac" || lowerCaseExt == L"ogg";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
bool OAImporter::isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const
|
|
bool OAImporter::isMagicNumberSupported(const UINT8* magicNumPtr, UINT32 numBytes) const
|
|
|
{
|
|
{
|
|
|
- // TODO
|
|
|
|
|
- return true; // Plain-text so I don't even check for magic number
|
|
|
|
|
|
|
+ // Don't check for magic number, rely on extension
|
|
|
|
|
+ return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
SPtr<Resource> OAImporter::import(const Path& filePath, SPtr<const ImportOptions> importOptions)
|
|
SPtr<Resource> OAImporter::import(const Path& filePath, SPtr<const ImportOptions> importOptions)
|
|
|
{
|
|
{
|
|
|
SPtr<DataStream> stream = FileSystem::openFile(filePath);
|
|
SPtr<DataStream> stream = FileSystem::openFile(filePath);
|
|
|
|
|
|
|
|
|
|
+ WString extension = filePath.getWExtension();
|
|
|
|
|
+ StringUtil::toLowerCase(extension);
|
|
|
|
|
+
|
|
|
|
|
+ // TODO - Respect import options and read mode
|
|
|
|
|
+ AudioFileInfo info;
|
|
|
|
|
+ UINT8* samples = nullptr;
|
|
|
|
|
+ if(extension == L"wav")
|
|
|
|
|
+ {
|
|
|
|
|
+ OAWaveReader reader;
|
|
|
|
|
+ if (!reader.isValid(stream))
|
|
|
|
|
+ return nullptr;
|
|
|
|
|
+
|
|
|
|
|
+ if (!reader.open(stream, info))
|
|
|
|
|
+ return nullptr;
|
|
|
|
|
+
|
|
|
|
|
+ //samples = bs_alloc(info.)
|
|
|
|
|
+ //reader.read()
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(extension == L"flac")
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(extension == L"ogg")
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return nullptr;
|
|
return nullptr;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|