mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-20 12:39:13 +12:00
Make DSP backends properly configurable
This commit is contained in:
parent
33eb096ef8
commit
7a5bb2859e
8 changed files with 58 additions and 7 deletions
|
@ -3,6 +3,10 @@
|
|||
#include "audio/null_core.hpp"
|
||||
#include "audio/teakra_core.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
#include <unordered_map>
|
||||
|
||||
std::unique_ptr<Audio::DSPCore> Audio::makeDSPCore(DSPCore::Type type, Memory& mem, Scheduler& scheduler, DSPService& dspService) {
|
||||
std::unique_ptr<DSPCore> core;
|
||||
|
||||
|
@ -19,3 +23,30 @@ std::unique_ptr<Audio::DSPCore> Audio::makeDSPCore(DSPCore::Type type, Memory& m
|
|||
mem.setDSPMem(core->getDspMemory());
|
||||
return core;
|
||||
}
|
||||
|
||||
Audio::DSPCore::Type Audio::DSPCore::typeFromString(std::string inString) {
|
||||
// Transform to lower-case to make the setting case-insensitive
|
||||
std::transform(inString.begin(), inString.end(), inString.begin(), [](unsigned char c) { return std::tolower(c); });
|
||||
|
||||
static const std::unordered_map<std::string, Audio::DSPCore::Type> map = {
|
||||
{"null", Audio::DSPCore::Type::Null},
|
||||
{"none", Audio::DSPCore::Type::Null},
|
||||
{"lle", Audio::DSPCore::Type::Teakra},
|
||||
{"teakra", Audio::DSPCore::Type::Teakra},
|
||||
};
|
||||
|
||||
if (auto search = map.find(inString); search != map.end()) {
|
||||
return search->second;
|
||||
}
|
||||
|
||||
printf("Invalid DSP type. Defaulting to null\n");
|
||||
return Audio::DSPCore::Type::Null;
|
||||
}
|
||||
|
||||
const char* Audio::DSPCore::typeToString(Audio::DSPCore::Type type) {
|
||||
switch (type) {
|
||||
case Audio::DSPCore::Type::Null: return "null";
|
||||
case Audio::DSPCore::Type::Teakra: return "teakra";
|
||||
default: return "invalid";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue