Skip to content

Commit

Permalink
Removed legacy audio mode and fixed ganon sound bug (HarbourMasters#657)
Browse files Browse the repository at this point in the history
  • Loading branch information
NEstelami authored Jul 12, 2022
1 parent eab3b5b commit 3aa93b9
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 2,140 deletions.
4 changes: 0 additions & 4 deletions soh/include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ extern "C"
#define gTatumsPerBeat (D_8014A6C0[1])
extern const AudioContextInitSizes D_8014A6C4;
extern s16 gOcarinaSongItemMap[];
extern u8 gSoundFontTable[];
extern u8 gSequenceFontTable[];
extern u8 gSequenceTable[];
extern u8 gSampleBankTable[];
extern u8 D_80155F50[];
extern u8 D_80157580[];
extern u8 D_801579A0[];
Expand Down
1 change: 0 additions & 1 deletion soh/include/z64audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#define CALC_RESAMPLE_FREQ(sampleRate) ((float)sampleRate / (s32)gAudioContext.audioBufferParameters.frequency)

extern bool gUseLegacySD;
extern char* fontMap[256];

typedef enum {
Expand Down
51 changes: 0 additions & 51 deletions soh/soh/OTRGlobals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1351,57 +1351,6 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
return ((int)ceilf(OTRGetDimensionFromRightEdge(v)));
}

extern "C" void bswapSoundFontSound(SoundFontSound* swappable) {
swappable->sample = (SoundFontSample*)BOMSWAP32((u32)(uintptr_t(swappable->sample)));
swappable->tuningAsU32 = BOMSWAP32((u32)(swappable->tuningAsU32 & 0xFFFFFFFF));
}

extern "C" void bswapDrum(Drum* swappable) {
bswapSoundFontSound(&swappable->sound);
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)uintptr_t(swappable->envelope));
}

extern "C" void bswapInstrument(Instrument* swappable) {
swappable->envelope = (AdsrEnvelope*)BOMSWAP32((u32)uintptr_t(swappable->envelope));
bswapSoundFontSound(&swappable->lowNotesSound);
bswapSoundFontSound(&swappable->normalNotesSound);
bswapSoundFontSound(&swappable->highNotesSound);
}

extern "C" void bswapSoundFontSample(SoundFontSample* swappable) {
u32 origBitfield = BOMSWAP32(swappable->asU32);

swappable->codec = (origBitfield >> 28) & 0x0F;
swappable->medium = (origBitfield >> 24) & 0x03;
swappable->unk_bit26 = (origBitfield >> 22) & 0x01;
swappable->unk_bit25 = (origBitfield >> 21) & 0x01;
swappable->size = (origBitfield) & 0x00FFFFFF;

swappable->sampleAddr = (u8*)BOMSWAP32((u32)uintptr_t(swappable->sampleAddr));
swappable->loop = (AdpcmLoop*)BOMSWAP32((u32)uintptr_t(swappable->loop));
swappable->book = (AdpcmBook*)BOMSWAP32((u32)uintptr_t(swappable->book));
}

extern "C" void bswapAdpcmLoop(AdpcmLoop* swappable) {
swappable->start = (u32)BOMSWAP32((u32)swappable->start);
swappable->end = (u32)BOMSWAP32((u32)swappable->end);
swappable->count = (u32)BOMSWAP32((u32)swappable->count);

if (swappable->count != 0) {
for (int i = 0; i < 16; i++) {
swappable->state[i] = (s16)BOMSWAP16(swappable->state[i]);
}
}
}

extern "C" void bswapAdpcmBook(AdpcmBook* swappable) {
swappable->order = (u32)BOMSWAP32((u32)swappable->order);
swappable->npredictors = (u32)BOMSWAP32((u32)swappable->npredictors);

for (int i = 0; i < swappable->npredictors * swappable->order * sizeof(s16) * 4; i++)
swappable->book[i] = (s16)BOMSWAP16(swappable->book[i]);
}

extern "C" bool AudioPlayer_Init(void) {
if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) {
return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Init();
Expand Down
6 changes: 0 additions & 6 deletions soh/soh/OTRGlobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,6 @@ float OTRGetDimensionFromLeftEdge(float v);
float OTRGetDimensionFromRightEdge(float v);
int16_t OTRGetRectDimensionFromLeftEdge(float v);
int16_t OTRGetRectDimensionFromRightEdge(float v);
void bswapDrum(Drum* swappable);
void bswapInstrument(Instrument* swappable);
bool bswapSoundFontSound(SoundFontSound* swappable);
void bswapSoundFontSample(SoundFontSample* swappable);
void bswapAdpcmLoop(AdpcmLoop* swappable);
void bswapAdpcmBook(AdpcmBook* swappable);
char* ResourceMgr_LoadFileRaw(const char* resName);
bool AudioPlayer_Init(void);
int AudioPlayer_Buffered(void);
Expand Down
Loading

0 comments on commit 3aa93b9

Please sign in to comment.