mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-01-23 21:45:00 +03:00
reverbs are causing distortion
This commit is contained in:
parent
d589fc4606
commit
b47b01409d
@ -720,6 +720,8 @@ void AudioHeap_Init(void) {
|
|||||||
gSynthReverbs[i].useReverb = 0;
|
gSynthReverbs[i].useReverb = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LTODO: Reverbs are causing distortion.
|
||||||
|
/*
|
||||||
gNumSynthReverbs = spec->numReverbs;
|
gNumSynthReverbs = spec->numReverbs;
|
||||||
for (i = 0; i < gNumSynthReverbs; i++) {
|
for (i = 0; i < gNumSynthReverbs; i++) {
|
||||||
settings = &spec->reverbSettings[i];
|
settings = &spec->reverbSettings[i];
|
||||||
@ -756,6 +758,7 @@ void AudioHeap_Init(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
AudioLoad_InitSampleDmaBuffers(gNumNotes);
|
AudioLoad_InitSampleDmaBuffers(gNumNotes);
|
||||||
gPreloadSampleStackTop = 0;
|
gPreloadSampleStackTop = 0;
|
||||||
D_8014C1B4 = 0x1000;
|
D_8014C1B4 = 0x1000;
|
||||||
|
@ -786,8 +786,8 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* aList, s32 upd
|
|||||||
u8 sp84[0x3C];
|
u8 sp84[0x3C];
|
||||||
NoteSubEu* temp_v0;
|
NoteSubEu* temp_v0;
|
||||||
s16 count;
|
s16 count;
|
||||||
s16 i;
|
s16 i = 0;
|
||||||
s32 j;
|
s32 j = 0;
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
if (gNumSynthReverbs == 0) {
|
if (gNumSynthReverbs == 0) {
|
||||||
|
@ -358,6 +358,10 @@ extern u8 gAudioSpecId;
|
|||||||
extern int audBuffer;
|
extern int audBuffer;
|
||||||
extern AudioBufferParameters gAudioBufferParams;
|
extern AudioBufferParameters gAudioBufferParams;
|
||||||
extern int countermin;
|
extern int countermin;
|
||||||
|
|
||||||
|
extern unsigned short samples_high;
|
||||||
|
extern unsigned short samples_low;
|
||||||
|
|
||||||
void Game_Update(void) {
|
void Game_Update(void) {
|
||||||
s32 i;
|
s32 i;
|
||||||
u8 partialFill;
|
u8 partialFill;
|
||||||
@ -626,8 +630,10 @@ void Game_Update(void) {
|
|||||||
}
|
}
|
||||||
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
RCP_SetupDL(&gMasterDisp, SETUPDL_83);
|
||||||
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
|
gDPSetPrimColor(gMasterDisp++, 0, 0, 255, 255, 0, 255);
|
||||||
Graphics_DisplaySmallText(10, 190, 1.0f, 1.0f, "SEC:");
|
Graphics_DisplaySmallText(10, 180, 1.0f, 1.0f, "SAM_HIGH:");
|
||||||
Graphics_DisplaySmallNumber(90, 190, countermin);
|
Graphics_DisplaySmallNumber(90, 180, samples_high + audBuffer);
|
||||||
|
Graphics_DisplaySmallText(10, 190, 1.0f, 1.0f, "SAM_LOW:");
|
||||||
|
Graphics_DisplaySmallNumber(90, 190, samples_low + audBuffer);
|
||||||
Graphics_DisplaySmallText(10, 200, 1.0f, 1.0f, "AUDIOBUF:");
|
Graphics_DisplaySmallText(10, 200, 1.0f, 1.0f, "AUDIOBUF:");
|
||||||
Graphics_DisplaySmallNumber(90, 200, audBuffer);
|
Graphics_DisplaySmallNumber(90, 200, audBuffer);
|
||||||
Graphics_DisplaySmallText(10, 210, 1.0f, 1.0f, "AUDIOSPEC:");
|
Graphics_DisplaySmallText(10, 210, 1.0f, 1.0f, "AUDIOSPEC:");
|
||||||
@ -635,9 +641,9 @@ void Game_Update(void) {
|
|||||||
Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "TICKS:");
|
Graphics_DisplaySmallText(10, 220, 1.0f, 1.0f, "TICKS:");
|
||||||
Graphics_DisplaySmallNumber(90, 220, gAudioBufferParams.ticksPerUpdate);
|
Graphics_DisplaySmallNumber(90, 220, gAudioBufferParams.ticksPerUpdate);
|
||||||
if (gControllerPress[0].button & L_JPAD) {
|
if (gControllerPress[0].button & L_JPAD) {
|
||||||
//audBuffer-=10;
|
// audBuffer-=1;
|
||||||
} else if (gControllerPress[0].button & R_JPAD) {
|
} else if (gControllerPress[0].button & R_JPAD) {
|
||||||
// audBuffer+=10;
|
// audBuffer+=1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,11 @@ void Lib_Texture_Scroll(u16* texture, s32 width, s32 height, u8 mode) {
|
|||||||
u16 tempPxl;
|
u16 tempPxl;
|
||||||
s32 u;
|
s32 u;
|
||||||
s32 v;
|
s32 v;
|
||||||
|
|
||||||
|
// LTODO: figure out why this function crashes in other levels
|
||||||
|
if ((gCurrentLevel != LEVEL_SOLAR)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
// LTodo: [HD-Textures] This is broken
|
// LTodo: [HD-Textures] This is broken
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
@ -83,7 +87,12 @@ void Lib_Texture_Mottle(u16* dst, u16* src, u8 mode) {
|
|||||||
u8* dst8;
|
u8* dst8;
|
||||||
u8* src8;
|
u8* src8;
|
||||||
s32 offset;
|
s32 offset;
|
||||||
|
|
||||||
|
// LTODO: figure out why this function crashes in other levels
|
||||||
|
// CAUSES CORRUPTION!!!!
|
||||||
|
if ((gCurrentLevel != LEVEL_SOLAR) || (gGameState == GSTATE_MAP)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// LTodo: [HD-Textures] This is broken
|
// LTodo: [HD-Textures] This is broken
|
||||||
dst = LOAD_ASSET(dst);
|
dst = LOAD_ASSET(dst);
|
||||||
|
@ -72,7 +72,7 @@ GameEngine::GameEngine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this->context =
|
this->context =
|
||||||
Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024, 2480 });
|
Ship::Context::CreateInstance("Starship", "ship", "starship.cfg.json", OTRFiles, {}, 3, { 44100, 1024*2, 2480*2 });
|
||||||
|
|
||||||
auto loader = context->GetResourceManager()->GetResourceLoader();
|
auto loader = context->GetResourceManager()->GetResourceLoader();
|
||||||
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY,
|
loader->RegisterResourceFactory(std::make_shared<SF64::ResourceFactoryBinaryAnimV0>(), RESOURCE_FORMAT_BINARY,
|
||||||
@ -158,12 +158,16 @@ void GameEngine::StartFrame() const {
|
|||||||
#define SAMPLES_LOW 720
|
#define SAMPLES_LOW 720
|
||||||
#define NUM_AUDIO_CHANNELS 2
|
#define NUM_AUDIO_CHANNELS 2
|
||||||
|
|
||||||
extern "C" s32 audBuffer = 0;
|
extern "C" u16 audBuffer = 0;
|
||||||
#include <sf64audio_provisional.h>
|
#include <sf64audio_provisional.h>
|
||||||
|
|
||||||
extern "C" volatile s32 gAudioTaskCountQ;
|
extern "C" volatile s32 gAudioTaskCountQ;
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
extern "C" int countermin = 0;
|
extern "C" int countermin = 0;
|
||||||
|
|
||||||
|
extern "C" unsigned short samples_high = SAMPLES_HIGH;
|
||||||
|
extern "C" unsigned short samples_low = SAMPLES_LOW;
|
||||||
|
|
||||||
void GameEngine::HandleAudioThread() {
|
void GameEngine::HandleAudioThread() {
|
||||||
#ifdef PIPE_DEBUG
|
#ifdef PIPE_DEBUG
|
||||||
std::ofstream outfile("audio.bin", std::ios::binary | std::ios::app);
|
std::ofstream outfile("audio.bin", std::ios::binary | std::ios::app);
|
||||||
@ -185,7 +189,9 @@ void GameEngine::HandleAudioThread() {
|
|||||||
|
|
||||||
std::unique_lock<std::mutex> Lock(audio.mutex);
|
std::unique_lock<std::mutex> Lock(audio.mutex);
|
||||||
int samples_left = AudioPlayerBuffered();
|
int samples_left = AudioPlayerBuffered();
|
||||||
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered() ? SAMPLES_HIGH : SAMPLES_LOW;
|
u32 num_audio_samples = samples_left < AudioPlayerGetDesiredBuffered()
|
||||||
|
? (((samples_high ) ) )
|
||||||
|
: (((samples_low)) );
|
||||||
|
|
||||||
frames++;
|
frames++;
|
||||||
|
|
||||||
@ -200,7 +206,8 @@ void GameEngine::HandleAudioThread() {
|
|||||||
}
|
}
|
||||||
#ifdef PIPE_DEBUG
|
#ifdef PIPE_DEBUG
|
||||||
if (outfile.is_open()) {
|
if (outfile.is_open()) {
|
||||||
outfile.write(reinterpret_cast<char*>(audio_buffer), num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
outfile.write(reinterpret_cast<char*>(audio_buffer),
|
||||||
|
num_audio_samples * (sizeof(int16_t) * NUM_AUDIO_CHANNELS * AUDIO_FRAMES_PER_UPDATE));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
AudioPlayerPlayFrame((u8*) audio_buffer,
|
AudioPlayerPlayFrame((u8*) audio_buffer,
|
||||||
|
Loading…
Reference in New Issue
Block a user