Skip to content

Commit

Permalink
Enable -Wint-conversion warning (#1266)
Browse files Browse the repository at this point in the history
* fixing some warnings

* more pointer fixing

* Use `-Wno-int-conversion` on audio files

* more progress

* fix

* more pointer fixes

* kinda progress

* Fix remaining casts

* Format

* fix merge

* fix warnings

* fix parameter

* use SEGMENT_ROM_START_OFFSET a bit more

* format

* fix audio warnings

* some more fixes

* fix en_go

* review

* review

* whoops, missing cast

* review

* review

* ->data

* format

* review

* fix

* asPtr

* fix

* Update src/code/sched.c

Co-authored-by: Derek Hensley <[email protected]>

* review

* fix in EnDnh

* improve format

* engo

* format

* fix

* format

* Update include/z64.h

Co-authored-by: Derek Hensley <[email protected]>

* TexturePtr

* fix warnings

* fix warnings

* format

* fix

* review

---------

Co-authored-by: Derek Hensley <[email protected]>
  • Loading branch information
AngheloAlf and hensldm authored Nov 1, 2023
1 parent 42e1c43 commit f276d2b
Show file tree
Hide file tree
Showing 53 changed files with 1,753 additions and 1,350 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ endif

# Check code syntax with host compiler
ifneq ($(RUN_CC_CHECK),0)
CHECK_WARNINGS := -Wall -Wextra -Wno-format-security -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-int-conversion -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
CHECK_WARNINGS := -Wall -Wextra -Wno-unknown-pragmas -Wno-unused-parameter -Wno-unused-variable -Wno-missing-braces -Wno-unused-but-set-variable -Wno-unused-label -Wno-sign-compare -Wno-tautological-compare
CC_CHECK := gcc -fno-builtin -fsyntax-only -funsigned-char -fdiagnostics-color -std=gnu89 -D _LANGUAGE_C -D NON_MATCHING $(IINC) -nostdinc $(CHECK_WARNINGS)
ifneq ($(WERROR), 0)
CC_CHECK += -Werror
Expand Down
6 changes: 3 additions & 3 deletions include/audiothread_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ typedef enum {
* @param sfxState
*/
#define AUDIOCMD_CHANNEL_SET_SFX_STATE(seqPlayerIndex, channelIndex, sfxState) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), sfxState)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_CHANNEL_SET_SFX_STATE, seqPlayerIndex, channelIndex, 0), (s32)sfxState)

/**
* Set the reverb index.
Expand Down Expand Up @@ -493,7 +493,7 @@ typedef enum {
* @param functionPtr
*/
#define AUDIOCMD_GLOBAL_SET_CUSTOM_FUNCTION(functionType, functionPtr) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), functionPtr)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_CUSTOM_FUNCTION, 0, 0, functionType), (s32)functionPtr)

/**
* Do something related to the unloaded-type audio data in the heap.
Expand All @@ -514,7 +514,7 @@ typedef enum {
* @param data
*/
#define AUDIOCMD_GLOBAL_SET_REVERB_DATA(reverbIndex, dataType, data) \
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), data)
AudioThread_QueueCmdS32(AUDIO_MK_CMD(AUDIOCMD_OP_GLOBAL_SET_REVERB_DATA, dataType, reverbIndex, 0), (s32)data)

/**
* Change the sound mode of audio
Expand Down
4 changes: 2 additions & 2 deletions include/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -541,8 +541,8 @@ void Color_RGB8_Lerp(Color_RGB8* from, Color_RGB8* to, f32 lerp, Color_RGB8* dst
void Lib_Nop801004FC(void);
void* Lib_SegmentedToVirtual(void* ptr);
void* Lib_SegmentedToVirtualNull(void* ptr);
void* Lib_VirtualToPhysical(void* ptr);
void* Lib_PhysicalToVirtual(void* ptr);
uintptr_t Lib_VirtualToPhysical(void* ptr);
void* Lib_PhysicalToVirtual(uintptr_t ptr);
void LifeMeter_Init(PlayState* play);
void LifeMeter_UpdateColors(PlayState* play);
s32 LifeMeter_SaveInterfaceHealth(PlayState* play);
Expand Down
4 changes: 2 additions & 2 deletions include/loadfragment.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ typedef struct OverlayRelocationSection {
} OverlayRelocationSection; // size >= 0x18

// Fragment overlay load functions
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd, void* allocatedRamAddr);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, uintptr_t vramStart, uintptr_t vramEnd);
size_t Overlay_Load(uintptr_t vromStart, uintptr_t vromEnd, void* ramStart, void* ramEnd, void* allocatedRamAddr);
void* Overlay_AllocateAndLoad(uintptr_t vromStart, uintptr_t vromEnd, void* vramStart, void* vramEnd);

#endif
2 changes: 1 addition & 1 deletion include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ extern s32 gScreenWidth;
extern s32 gScreenHeight;
extern size_t gSystemHeapSize;

extern u32 gSegments[NUM_SEGMENTS];
extern uintptr_t gSegments[NUM_SEGMENTS];
extern SchedContext gSchedContext;
extern OSThread gGraphThread;
extern PadMgr gPadMgr;
Expand Down
8 changes: 5 additions & 3 deletions include/segment_symbols.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
#define SEGMENT_END(segment) (_ ## segment ## SegmentEnd)
#define SEGMENT_SIZE(segment) ((uintptr_t)SEGMENT_END(segment) - (uintptr_t)SEGMENT_START(segment))

#define SEGMENT_ROM_START(segment) (_ ## segment ## SegmentRomStart)
#define SEGMENT_ROM_END(segment) (_ ## segment ## SegmentRomEnd)
#define SEGMENT_ROM_SIZE(segment) ((uintptr_t)SEGMENT_ROM_END(segment) - (uintptr_t)SEGMENT_ROM_START(segment))
#define SEGMENT_ROM_START(segment) ((uintptr_t) _ ## segment ## SegmentRomStart)
#define SEGMENT_ROM_START_OFFSET(segment, offset) ((uintptr_t) (( _ ## segment ## SegmentRomStart ) + (offset)))
#define SEGMENT_ROM_END(segment) ((uintptr_t) _ ## segment ## SegmentRomEnd)
#define SEGMENT_ROM_SIZE(segment) (SEGMENT_ROM_END(segment) - SEGMENT_ROM_START(segment))
#define SEGMENT_ROM_SIZE_ALT(segment) ((size_t)( _ ## segment ## SegmentRomEnd - _ ## segment ## SegmentRomStart ))

#define SEGMENT_BSS_START(segment) (_ ## segment ## SegmentBssStart)
#define SEGMENT_BSS_END(segment) (_ ## segment ## SegmentBssEnd)
Expand Down
2 changes: 1 addition & 1 deletion include/sys_flashrom.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

typedef struct {
/* 0x00 */ s32 requestType;
/* 0x04 */ OSMesg response;
/* 0x04 */ s32 response;
/* 0x08 */ void* addr;
/* 0x0C */ s32 pageNum;
/* 0x10 */ s32 pageCount;
Expand Down
3 changes: 2 additions & 1 deletion include/tha.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "ultra64.h"
#include "libc/stdint.h"
#include "libc/stddef.h"

typedef struct TwoHeadArena {
/* 0x0 */ size_t size;
Expand All @@ -19,7 +20,7 @@ void* THA_AllocHeadByte(TwoHeadArena* tha);
void* THA_AllocTail(TwoHeadArena* tha, size_t size);
void* THA_AllocTailAlign16(TwoHeadArena* tha, size_t size);
void* THA_AllocTailAlign(TwoHeadArena* tha, size_t size, uintptr_t mask);
s32 THA_GetRemaining(TwoHeadArena* tha);
ptrdiff_t THA_GetRemaining(TwoHeadArena* tha);
u32 THA_IsCrash(TwoHeadArena* tha);
void THA_Reset(TwoHeadArena* tha);
void THA_Init(TwoHeadArena* tha, void* start, size_t size);
Expand Down
3 changes: 2 additions & 1 deletion include/z64audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,7 @@ typedef struct {
/* 0x4 */ s8 asSbyte;
/* 0x4 */ u8 asUbyte;
/* 0x4 */ u32 asUInt;
/* 0x4 */ void* asPtr;
};
} AudioCmd; // size = 0x8

Expand Down Expand Up @@ -931,7 +932,7 @@ typedef struct {

typedef void (*AudioCustomUpdateFunction)(void);
typedef u32 (*AudioCustomSeqFunction)(s8 value, SequenceChannel* channel);
typedef s32 (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
typedef void* (*AudioCustomReverbFunction)(Sample*, s32, s8, s32);
typedef Acmd* (*AudioCustomSynthFunction)(Acmd*, s32, s32);

extern OSVoiceHandle gVoiceHandle;
Expand Down
4 changes: 2 additions & 2 deletions include/z64message.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ typedef struct {
u16 wchar[640]; // msgBufWide
u64 force_structure_alignment_msg;
} msgBuf;
/* 0x11D80 */ u32 messageStart;
/* 0x11D84 */ u32 messageEnd;
/* 0x11D80 */ uintptr_t messageStart;
/* 0x11D84 */ uintptr_t messageEnd;
/* 0x11D88 */ u8 unk_11D88; // current Char Buffer ?
} Font; // size = 0x11D90

Expand Down
2 changes: 1 addition & 1 deletion src/audio/lib/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ void AudioHeap_ApplySampleBankCacheInternal(s32 apply, s32 sampleBankId) {

sampleBankTable = gAudioCtx.sampleBankTable;
numFonts = gAudioCtx.soundFontTable->numEntries;
change.oldAddr = AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
change.oldAddr = (uintptr_t)AudioHeap_SearchCaches(SAMPLE_TABLE, CACHE_EITHER, sampleBankId);
if (change.oldAddr == 0) {
return;
}
Expand Down
44 changes: 22 additions & 22 deletions src/audio/lib/load.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef struct {
void AudioLoad_DiscardFont(s32 fontId);
s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIndex, s32 seqId, s32 arg2);
u8* AudioLoad_SyncLoadSeq(s32 seqId);
u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad);
SoundFontData* AudioLoad_SyncLoadFont(u32 fontId);
void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate);
u32 AudioLoad_GetRealTableIndex(s32 tableType, u32 id);
Expand Down Expand Up @@ -414,7 +414,7 @@ void AudioLoad_SyncLoadSeqParts(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue* arg3
AudioLoad_SyncLoadSeq(seqId);
}
if (arg2 != 0) {
osSendMesg(arg3, arg2 << 0x18, OS_MESG_NOBLOCK);
osSendMesg(arg3, (OSMesg)(arg2 << 0x18), OS_MESG_NOBLOCK);
}
}
}
Expand All @@ -431,10 +431,10 @@ s32 AudioLoad_SyncLoadSample(Sample* sample, s32 fontId) {
}

if (sample->medium == MEDIUM_UNK) {
AudioLoad_SyncDmaUnkMedium(sample->sampleAddr, sampleAddr, sample->size,
AudioLoad_SyncDmaUnkMedium((uintptr_t)sample->sampleAddr, sampleAddr, sample->size,
gAudioCtx.sampleBankTable->unkMediumParam);
} else {
AudioLoad_SyncDma(sample->sampleAddr, sampleAddr, sample->size, sample->medium);
AudioLoad_SyncDma((uintptr_t)sample->sampleAddr, sampleAddr, sample->size, sample->medium);
}
sample->medium = MEDIUM_RAM;
sample->sampleAddr = sampleAddr;
Expand Down Expand Up @@ -471,7 +471,7 @@ s32 AudioLoad_SyncLoadInstrument(s32 fontId, s32 instId, s32 drumId) {

void AudioLoad_AsyncLoad(s32 tableType, s32 id, s32 nChunks, s32 retData, OSMesgQueue* retQueue) {
if (AudioLoad_AsyncLoadInner(tableType, id, nChunks, retData, retQueue) == NULL) {
osSendMesg(retQueue, 0xFFFFFFFF, OS_MESG_NOBLOCK);
osSendMesg(retQueue, (OSMesg)0xFFFFFFFF, OS_MESG_NOBLOCK);
}
}

Expand Down Expand Up @@ -632,11 +632,11 @@ u8* AudioLoad_SyncLoadSeq(s32 seqId) {
return AudioLoad_SyncLoad(SEQUENCE_TABLE, seqId, &didAllocate);
}

u32 AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
uintptr_t AudioLoad_GetSampleBank(u32 sampleBankId, u32* outMedium) {
return AudioLoad_TrySyncLoadSampleBank(sampleBankId, outMedium, true);
}

u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
uintptr_t AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad) {
void* addr;
AudioTable* sampleBankTable;
u32 realTableId = AudioLoad_GetRealTableIndex(SAMPLE_TABLE, sampleBankId);
Expand All @@ -651,7 +651,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
}

*outMedium = MEDIUM_RAM;
return addr;
return (uintptr_t)addr;
}

cachePolicy = sampleBankTable->entries[sampleBankId].cachePolicy;
Expand All @@ -664,7 +664,7 @@ u32 AudioLoad_TrySyncLoadSampleBank(u32 sampleBankId, u32* outMedium, s32 noLoad
addr = AudioLoad_SyncLoad(SAMPLE_TABLE, sampleBankId, &noLoad);
if (addr != NULL) {
*outMedium = MEDIUM_RAM;
return addr;
return (uintptr_t)addr;
}

*outMedium = sampleBankTable->entries[sampleBankId].medium;
Expand Down Expand Up @@ -785,7 +785,7 @@ void* AudioLoad_SyncLoad(s32 tableType, u32 id, s32* didAllocate) {
size -= 0x10;
}

bcopy(romAddr, ramAddr, size);
bcopy((void*)romAddr, ramAddr, size);
} else if (medium2 == mediumUnk) {
AudioLoad_SyncDmaUnkMedium(romAddr, ramAddr, size, (s16)table->unkMediumParam);
} else {
Expand Down Expand Up @@ -867,7 +867,7 @@ AudioTable* AudioLoad_GetLoadTable(s32 tableType) {
* @param sampleBankReloc information on the sampleBank containing raw audio samples
*/
void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, SampleBankRelocInfo* sampleBankReloc) {
uintptr_t soundOffset;
void* soundOffset;
uintptr_t soundListOffset;
Instrument* inst;
Drum* drum;
Expand All @@ -876,7 +876,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
s32 numDrums = gAudioCtx.soundFontList[fontId].numDrums;
s32 numInstruments = gAudioCtx.soundFontList[fontId].numInstruments;
s32 numSfx = gAudioCtx.soundFontList[fontId].numSfx;
u32* fontData = (u32*)fontDataStartAddr;
uintptr_t* fontData = (uintptr_t*)fontDataStartAddr;

// Relocate an offset (relative to the start of the font data) to a pointer (a ram address)
#define RELOC_TO_RAM(x) (void*)((uintptr_t)(x) + (uintptr_t)(fontDataStartAddr))
Expand All @@ -889,15 +889,15 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// If the soundFont has drums
if ((soundListOffset != 0) && (numDrums != 0)) {

fontData[0] = RELOC_TO_RAM(soundListOffset);
fontData[0] = (uintptr_t)RELOC_TO_RAM(soundListOffset);

// Loop through the drum offsets
for (i = 0; i < numDrums; i++) {
// Get the i'th drum offset
soundOffset = ((Drum**)fontData[0])[i];

// Some drum data entries are empty, represented by an offset of 0 in the list of drum offsets
if (soundOffset == 0) {
if (soundOffset == NULL) {
continue;
}
soundOffset = RELOC_TO_RAM(soundOffset);
Expand Down Expand Up @@ -925,7 +925,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
// If the soundFont has sound effects
if ((soundListOffset != 0) && (numSfx != 0)) {

fontData[1] = RELOC_TO_RAM(soundListOffset);
fontData[1] = (uintptr_t)RELOC_TO_RAM(soundListOffset);

// Loop through the sound effects
for (i = 0; i < numSfx; i++) {
Expand Down Expand Up @@ -955,7 +955,7 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* fontDataStartAddr, Sample
for (i = 2; i <= 2 + numInstruments - 1; i++) {
// Some instrument data entries are empty, represented by an offset of 0 in the list of instrument offsets
if (fontData[i] != 0) {
fontData[i] = RELOC_TO_RAM(fontData[i]);
fontData[i] = (uintptr_t)RELOC_TO_RAM(fontData[i]);
inst = (Instrument*)fontData[i];

// The instrument may be in the list multiple times and already relocated
Expand Down Expand Up @@ -1097,7 +1097,7 @@ void* AudioLoad_AsyncLoadInner(s32 tableType, s32 id, s32 nChunks, s32 retData,
ramAddr = AudioLoad_SearchCaches(tableType, realId);
if (ramAddr != NULL) {
loadStatus = LOAD_STATUS_COMPLETE;
osSendMesg(retQueue, MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
osSendMesg(retQueue, (OSMesg)MK_ASYNC_MSG(retData, 0, 0, LOAD_STATUS_NOT_LOADED), OS_MESG_NOBLOCK);
} else {
table = AudioLoad_GetLoadTable(tableType);
size = table->entries[realId].size;
Expand Down Expand Up @@ -1376,7 +1376,7 @@ s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) {
slowLoad->status = LOAD_STATUS_START;
slowLoad->bytesRemaining = ALIGN16(sample->size);
slowLoad->ramAddr = slowLoad->curRamAddr;
slowLoad->curDevAddr = sample->sampleAddr;
slowLoad->curDevAddr = (uintptr_t)sample->sampleAddr;
slowLoad->medium = sample->medium;
slowLoad->seqOrFontId = fontId;
slowLoad->instId = instId;
Expand Down Expand Up @@ -1464,15 +1464,15 @@ void AudioLoad_ProcessSlowLoads(s32 resetStatus) {
if (slowLoad->medium == MEDIUM_UNK) {
size_t size = slowLoad->bytesRemaining;

AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, size,
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, size,
slowLoad->unkMediumParam);
} else {
AudioLoad_DmaSlowCopy(slowLoad, slowLoad->bytesRemaining);
}
slowLoad->bytesRemaining = 0;
} else {
if (slowLoad->medium == MEDIUM_UNK) {
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, slowLoad->curRamAddr, 0x400,
AudioLoad_DmaSlowCopyUnkMedium(slowLoad->curDevAddr, (uintptr_t)slowLoad->curRamAddr, 0x400,
slowLoad->unkMediumParam);
} else {
AudioLoad_DmaSlowCopy(slowLoad, 0x400);
Expand Down Expand Up @@ -1671,7 +1671,7 @@ void AudioLoad_FinishAsyncLoad(AudioAsyncLoad* asyncLoad) {
break;
}

doneMsg = asyncLoad->retMsg;
doneMsg = (OSMesg)asyncLoad->retMsg;
if (1) {}
asyncLoad->status = LOAD_STATUS_WAITING;
osSendMesg(asyncLoad->retQueue, doneMsg, OS_MESG_NOBLOCK);
Expand Down Expand Up @@ -1743,7 +1743,7 @@ void AudioLoad_AsyncDmaRamUnloaded(AudioAsyncLoad* asyncLoad, size_t size) {
size = ALIGN16(size);
Audio_InvalDCache(asyncLoad->curRamAddr, size);
osCreateMesgQueue(&asyncLoad->msgQueue, &asyncLoad->msg, 1);
bcopy(asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
bcopy((void*)asyncLoad->curDevAddr, asyncLoad->curRamAddr, size);
osSendMesg(&asyncLoad->msgQueue, NULL, OS_MESG_NOBLOCK);
}

Expand Down
18 changes: 9 additions & 9 deletions src/audio/lib/synthesis.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,12 +500,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->leftSaveResampleBuf);

cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
&reverb->leftReverbBuf[entry->startPos]);
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);

if (entry->wrappedSize != 0) {
// Ring buffer wrapped
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
reverb->leftReverbBuf);
(uintptr_t)reverb->leftReverbBuf);
}

// Right Resample
Expand All @@ -514,12 +514,12 @@ Acmd* AudioSynth_SaveResampledReverbSamples(Acmd* cmd, SynthesisReverb* reverb,
aResample(cmd++, reverb->resampleFlags, entry->saveResamplePitch, reverb->rightSaveResampleBuf);

cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_SCRATCH, entry->size,
&reverb->rightReverbBuf[entry->startPos]);
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);

if (entry->wrappedSize != 0) {
// Ring buffer wrapped
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_SCRATCH, entry->wrappedSize,
reverb->rightReverbBuf);
(uintptr_t)reverb->rightReverbBuf);
}

return cmd;
Expand Down Expand Up @@ -716,16 +716,16 @@ Acmd* AudioSynth_SaveReverbSamples(Acmd* cmd, SynthesisReverb* reverb, s16 updat

if (entry->size != 0) {
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_LEFT_CH, entry->size,
&reverb->leftReverbBuf[entry->startPos]);
(uintptr_t)&reverb->leftReverbBuf[entry->startPos]);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, DMEM_WET_RIGHT_CH, entry->size,
&reverb->rightReverbBuf[entry->startPos]);
(uintptr_t)&reverb->rightReverbBuf[entry->startPos]);
}

if (entry->wrappedSize != 0) {
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_LEFT_CH, entry->wrappedSize,
reverb->leftReverbBuf);
(uintptr_t)reverb->leftReverbBuf);
cmd = AudioSynth_SaveResampledReverbSamplesImpl(cmd, entry->size + DMEM_WET_RIGHT_CH, entry->wrappedSize,
reverb->rightReverbBuf);
(uintptr_t)reverb->rightReverbBuf);
}
}

Expand Down Expand Up @@ -1170,7 +1170,7 @@ Acmd* AudioSynth_ProcessSample(s32 noteIndex, NoteSampleState* sampleState, Note
} else {
// This medium is not in ram, so dma the requested sample into ram
samplesToLoadAddr =
AudioLoad_DmaSampleData(sampleAddr + (zeroOffset + sampleAddrOffset),
AudioLoad_DmaSampleData((uintptr_t)(sampleAddr + (zeroOffset + sampleAddrOffset)),
ALIGN16((numFramesToDecode * frameSize) + SAMPLES_PER_FRAME), flags,
&synthState->sampleDmaIndex, sample->medium);
}
Expand Down
Loading

0 comments on commit f276d2b

Please sign in to comment.