mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-02 09:39:48 -04:00
54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
|
|
|
#include "JSystem/JAudio2/JASBasicBank.h"
|
|
#include "JSystem/JAudio2/JASCalc.h"
|
|
|
|
JASBasicBank::JASBasicBank() {
|
|
mInstTable = NULL;
|
|
mInstNumMax = 0;
|
|
}
|
|
|
|
void JASBasicBank::newInstTable(u8 num, JKRHeap* heap) {
|
|
if (num != 0) {
|
|
JUT_ASSERT(31, num <= JASBank::PRG_OSC);
|
|
mInstNumMax = num;
|
|
mInstTable = JKR_NEW_ARRAY_ARGS(JASInst*, mInstNumMax, heap, 0);
|
|
#if TARGET_ANDROID
|
|
JASCalc::_bzero(mInstTable, mInstNumMax * 4);
|
|
#else
|
|
JASCalc::bzero(mInstTable, mInstNumMax * 4);
|
|
#endif
|
|
}
|
|
}
|
|
|
|
bool JASBasicBank::getInstParam(int prg_no, int param_1, int param_2,
|
|
JASInstParam* o_param) const {
|
|
JASInst* inst = getInst(prg_no);
|
|
if (inst == NULL) {
|
|
return false;
|
|
}
|
|
return inst->getParam(param_1, param_2, o_param);
|
|
}
|
|
|
|
void JASBasicBank::setInst(int prg_no, JASInst* inst) {
|
|
if (mInstTable != NULL) {
|
|
JUT_ASSERT(50, prg_no < mInstNumMax);
|
|
JUT_ASSERT(54, prg_no >= 0);
|
|
JUT_ASSERT(56, mInstTable[prg_no] == 0);
|
|
mInstTable[prg_no] = inst;
|
|
}
|
|
}
|
|
|
|
JASInst* JASBasicBank::getInst(int prg_no) const {
|
|
if (prg_no < 0) {
|
|
return NULL;
|
|
}
|
|
if (prg_no >= mInstNumMax) {
|
|
return NULL;
|
|
}
|
|
if (mInstTable == NULL) {
|
|
return NULL;
|
|
}
|
|
return mInstTable[prg_no];
|
|
}
|