You've already forked ultrasm64-2
mirror of
https://github.com/HackerN64/ultrasm64-2.git
synced 2026-01-21 10:38:08 -08:00
Refresh 14
This commit is contained in:
@@ -877,12 +877,6 @@ u16 unk_sh_data_4[] = {
|
||||
0x5FFF, 0x9001,
|
||||
0x7FFF, 0x8001
|
||||
};
|
||||
|
||||
char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
|
||||
char shindouDebugPrint2[] = "S->W\n";
|
||||
char shindouDebugPrint3[] = "W->S\n";
|
||||
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
|
||||
// These debug prints are continued in shindou_debug_prints_1.c.
|
||||
#endif
|
||||
|
||||
#ifndef VERSION_SH
|
||||
|
||||
@@ -485,15 +485,9 @@ void unused_8031E4F0(void) {
|
||||
stubbed_printf("\n");
|
||||
|
||||
stubbed_printf("BNK ");
|
||||
#ifdef VERSION_SH
|
||||
#define count 1
|
||||
#else
|
||||
#define count 4
|
||||
#endif
|
||||
for (i = 0; i < 40; i += count) {
|
||||
for (i = 0; i < 40; i += 4) {
|
||||
stubbed_printf("%1x", 0);
|
||||
}
|
||||
#undef count
|
||||
stubbed_printf("\n");
|
||||
|
||||
stubbed_printf("FIXHEAP ");
|
||||
@@ -1157,8 +1151,8 @@ static void select_current_sounds(u8 bank) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Given an x and z coordinates, return the pan. This is a value between 0 and
|
||||
* 1 that represents the audio direction.
|
||||
* Given x and z coordinates, return the pan. This is a value nominally between
|
||||
* 0 and 1 that represents the audio direction.
|
||||
*
|
||||
* Pan:
|
||||
* 0.0 - fully left
|
||||
@@ -1192,12 +1186,17 @@ static f32 get_sound_pan(f32 x, f32 z) {
|
||||
pan = US_FLOAT(0.5);
|
||||
} else if (x >= US_FLOAT(0.0) && absX >= absZ) {
|
||||
// far right pan
|
||||
pan = US_FLOAT(1.0) - (US_FLOAT(44000.0) - absX) / (US_FLOAT(3.0) * (US_FLOAT(44000.0) - absZ));
|
||||
pan = US_FLOAT(1.0) - (2 * AUDIO_MAX_DISTANCE - absX) / (US_FLOAT(3.0) * (2 * AUDIO_MAX_DISTANCE - absZ));
|
||||
} else if (x < 0 && absX > absZ) {
|
||||
// far left pan
|
||||
pan = (US_FLOAT(44000.0) - absX) / (US_FLOAT(3.0) * (US_FLOAT(44000.0) - absZ));
|
||||
pan = (2 * AUDIO_MAX_DISTANCE - absX) / (US_FLOAT(3.0) * (2 * AUDIO_MAX_DISTANCE - absZ));
|
||||
} else {
|
||||
// center pan
|
||||
//! @bug (JP PU sound glitch) If |x|, |z| > AUDIO_MAX_DISTANCE, we'll
|
||||
// end up in this case, and pan may be set to something outside of [0,1]
|
||||
// since x is not clamped. On JP, this can lead to an out-of-bounds
|
||||
// float read in note_set_vel_pan_reverb when x is highly negative,
|
||||
// causing console crashes when that float is a nan or denormal.
|
||||
pan = 0.5 + x / (US_FLOAT(6.0) * absZ);
|
||||
}
|
||||
|
||||
@@ -1243,6 +1242,8 @@ static f32 get_sound_volume(u8 bank, u8 soundIndex, f32 volumeRange) {
|
||||
|
||||
if (sSoundBanks[bank][soundIndex].soundBits & SOUND_VIBRATO) {
|
||||
#ifdef VERSION_JP
|
||||
//! @bug Intensity is 0 when the sound is far away. Due to the subtraction below, it is possible to end up with a negative intensity.
|
||||
// When it is, objects with a volumeRange of 1 can still occasionally be lightly heard.
|
||||
if (intensity != 0.0)
|
||||
#else
|
||||
if (intensity >= 0.08f)
|
||||
@@ -1444,7 +1445,7 @@ static void update_game_sound(void) {
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
|
||||
@@ -1485,7 +1486,7 @@ static void update_game_sound(void) {
|
||||
*sSoundBanks[bank][soundIndex].z);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
|
||||
get_sound_freq_scale(bank, soundIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
break;
|
||||
@@ -1508,7 +1509,7 @@ static void update_game_sound(void) {
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2);
|
||||
@@ -1524,6 +1525,13 @@ static void update_game_sound(void) {
|
||||
#ifdef VERSION_JP
|
||||
// If the sound was marked for deletion (bits set to NO_SOUND), then stop playing it
|
||||
// and delete it
|
||||
// @bug (JP double red coin sound) If the sound finished within the same frame as
|
||||
// being marked for deletion, the signal to stop playing will be interpreted as a
|
||||
// signal to *start* playing, as .main_loop_023589 in 00_sound_player does not check
|
||||
// for soundScriptIO[0] being zero. This happens most commonly for red coin sounds
|
||||
// whose sound spawners deactivate 30 frames after the sound starts to play, while
|
||||
// the sound itself runs for 1.20 seconds. With enough lag these may coincide.
|
||||
// Fixed on US by checking that layer0->finished is FALSE.
|
||||
else if (soundStatus == SOUND_STATUS_STOPPED) {
|
||||
update_background_music_after_sound(bank, soundIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
|
||||
@@ -1535,17 +1543,19 @@ static void update_game_sound(void) {
|
||||
sSoundBanks[bank][soundIndex].soundStatus = SOUND_STATUS_STOPPED;
|
||||
delete_sound_from_bank(bank, soundIndex);
|
||||
} else if (soundStatus == SOUND_STATUS_STOPPED
|
||||
&& gSequencePlayers[SEQ_PLAYER_SFX]
|
||||
.channels[channelIndex]
|
||||
->layers[0]
|
||||
->finished
|
||||
== FALSE) {
|
||||
&& gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]
|
||||
->layers[0]->finished == FALSE) {
|
||||
update_background_music_after_sound(bank, soundIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->soundScriptIO[0] = 0;
|
||||
delete_sound_from_bank(bank, soundIndex);
|
||||
}
|
||||
#endif
|
||||
// If sound has finished playing, then delete it
|
||||
// @bug (JP sound glitch) On JP, ...->layers[0] has not been checked for null,
|
||||
// so this access can crash if an earlier layer allocation failed due to too
|
||||
// many sounds playing at once. This crash is comparatively common; RTA
|
||||
// speedrunners even have a setup for avoiding it within the SSL pyramid:
|
||||
// https://www.youtube.com/watch?v=QetyTgbQxcw
|
||||
else if (gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->layers[0]->enabled
|
||||
== FALSE) {
|
||||
update_background_music_after_sound(bank, soundIndex);
|
||||
@@ -1619,7 +1629,7 @@ static void update_game_sound(void) {
|
||||
func_802ad770(0x05020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_reverb(bank, soundIndex, channelIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
|
||||
@@ -1660,7 +1670,7 @@ static void update_game_sound(void) {
|
||||
*sSoundBanks[bank][soundIndex].z);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->freqScale =
|
||||
get_sound_freq_scale(bank, soundIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
#endif
|
||||
break;
|
||||
@@ -1683,7 +1693,7 @@ static void update_game_sound(void) {
|
||||
func_802ad728(0x04020000 | ((channelIndex & 0xff) << 8),
|
||||
get_sound_freq_scale(bank, soundIndex));
|
||||
#else
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverb =
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->reverbVol =
|
||||
get_sound_reverb(bank, soundIndex, channelIndex);
|
||||
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->volume =
|
||||
get_sound_volume(bank, soundIndex, VOLUME_RANGE_UNK2);
|
||||
|
||||
@@ -27,9 +27,6 @@ extern u32 gAudioRandom;
|
||||
extern u8 gAudioSPTaskYieldBuffer[]; // ucode yield data ptr; only used in JP
|
||||
|
||||
struct SPTask *create_next_audio_frame_task(void);
|
||||
#ifdef VERSION_SH
|
||||
struct SPTask *func_sh_802f5a80(void);
|
||||
#endif
|
||||
void play_sound(s32 soundBits, f32 *pos);
|
||||
void audio_signal_game_loop_tick(void);
|
||||
void seq_player_fade_out(u8 player, u16 fadeDuration);
|
||||
|
||||
@@ -206,8 +206,6 @@ void discard_bank(s32 bankId) {
|
||||
|
||||
#if defined(VERSION_EU)
|
||||
if (note->noteSubEu.bankId == bankId) {
|
||||
#elif defined(VERSION_SH)
|
||||
if (note->unkSH33 == bankId) {
|
||||
#else
|
||||
if (note->bankId == bankId) {
|
||||
#endif
|
||||
@@ -384,7 +382,7 @@ void temporary_pools_init(struct PoolSplit *a) {
|
||||
#undef SOUND_ALLOC_FUNC
|
||||
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
static void unused_803163D4(void) {
|
||||
UNUSED static void unused_803163D4(void) {
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -512,7 +510,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
if (poolIdx == 1) {
|
||||
if (firstVal == SOUND_LOAD_STATUS_4) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
|
||||
if (gNotes[i].bankId == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -525,7 +523,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
}
|
||||
if (secondVal == SOUND_LOAD_STATUS_4) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
|
||||
if (gNotes[i].bankId == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -591,7 +589,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
} else if (poolIdx == 1) {
|
||||
if (firstVal == SOUND_LOAD_STATUS_COMPLETE) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].unkSH33 == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
|
||||
if (gNotes[i].bankId == tp->entries[0].id && gNotes[i].noteSubEu.enabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -602,7 +600,7 @@ void *alloc_bank_or_seq(struct SoundMultiPool *arg0, s32 arg1, s32 size, s32 arg
|
||||
}
|
||||
if (secondVal == SOUND_LOAD_STATUS_COMPLETE) {
|
||||
for (i = 0; i < gMaxSimultaneousNotes; i++) {
|
||||
if (gNotes[i].unkSH33 == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
|
||||
if (gNotes[i].bankId == tp->entries[1].id && gNotes[i].noteSubEu.enabled) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1681,7 +1679,7 @@ void func_sh_802f23ec(void) {
|
||||
s32 i;
|
||||
s32 idx;
|
||||
s32 seqCount;
|
||||
u32 bankId1; // non symmetric fake match? can also change 0xff to 0xffU for same effect
|
||||
s32 bankId1;
|
||||
s32 bankId2;
|
||||
s32 instId;
|
||||
s32 drumId;
|
||||
@@ -1694,7 +1692,7 @@ void func_sh_802f23ec(void) {
|
||||
for (idx = 0; idx < seqCount; idx++) {
|
||||
bankId1 = gCtlEntries[idx].bankId1;
|
||||
bankId2 = gCtlEntries[idx].bankId2;
|
||||
if ((bankId1 != 0xff && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) {
|
||||
if ((bankId1 != 0xffu && entry->bankId == bankId1) || (bankId2 != 0xff && entry->bankId == bankId2) || entry->bankId == 0) {
|
||||
if (get_bank_or_seq(1, 3, idx) != NULL) {
|
||||
if (IS_BANK_LOAD_COMPLETE(idx) != FALSE) {
|
||||
for (i = 0; i < gUnkPool2.numEntries; i++) {
|
||||
|
||||
@@ -131,12 +131,14 @@ void audio_reset_session(void);
|
||||
#else
|
||||
void audio_reset_session(struct AudioSessionSettings *preset);
|
||||
#endif
|
||||
void discard_bank(s32 bankId);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
void fill_filter(s16 filter[8], s32 arg1, s32 arg2);
|
||||
u8 *func_sh_802f1d40(u32 size, s32 bank, u8 *arg2, s8 medium);
|
||||
u8 *func_sh_802f1d90(u32 size, s32 bank, u8 *arg2, s8 medium);
|
||||
void *unk_pool1_lookup(s32 poolIdx, s32 id);
|
||||
void *unk_pool1_alloc(s32 poolIndex, s32 arg1, u32 size);
|
||||
#endif
|
||||
|
||||
#endif // AUDIO_HEAP_H
|
||||
|
||||
@@ -41,6 +41,11 @@
|
||||
|
||||
#define TATUMS_PER_BEAT 48
|
||||
|
||||
// abi.h contains more details about the ADPCM and S8 codecs, "skip" skips codec processing
|
||||
#define CODEC_ADPCM 0
|
||||
#define CODEC_S8 1
|
||||
#define CODEC_SKIP 2
|
||||
|
||||
#ifdef VERSION_JP
|
||||
#define TEMPO_SCALE 1
|
||||
#else
|
||||
@@ -373,8 +378,8 @@ union ReverbBits {
|
||||
/* 0x00 */ u8 asByte;
|
||||
};
|
||||
struct ReverbInfo {
|
||||
u8 reverb;
|
||||
u8 bankId;
|
||||
u8 reverbVol;
|
||||
u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
|
||||
u8 pan;
|
||||
union ReverbBits reverbBits;
|
||||
f32 freqScale;
|
||||
@@ -385,9 +390,9 @@ struct ReverbInfo {
|
||||
|
||||
struct NoteAttributes
|
||||
{
|
||||
u8 reverb;
|
||||
u8 reverbVol;
|
||||
#ifdef VERSION_SH
|
||||
u8 unk1;
|
||||
u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
|
||||
#endif
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
u8 pan;
|
||||
@@ -430,7 +435,7 @@ struct SequenceChannel
|
||||
#endif
|
||||
/*0x01, 0x02*/ u8 noteAllocPolicy;
|
||||
/*0x02, 0x03, 0x03*/ u8 muteBehavior;
|
||||
/*0x03, 0x04, 0x04*/ u8 reverb; // or dry/wet mix
|
||||
/*0x03, 0x04, 0x04*/ u8 reverbVol; // until EU: Q1.7, after EU: UQ0.8
|
||||
/*0x04, ????*/ u8 notePriority; // 0-3
|
||||
#ifdef VERSION_SH
|
||||
u8 unkSH06; // some priority
|
||||
@@ -445,7 +450,7 @@ struct SequenceChannel
|
||||
/*0x06, */ u8 updatesPerFrameUnused;
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
/* 0x0C*/ u8 unkSH0C; // bankId
|
||||
/* 0x0C*/ u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
|
||||
#endif
|
||||
/*0x08, 0x0C, 0x0E*/ u16 vibratoRateStart; // initially 0x800
|
||||
/*0x0A, 0x0E, 0x10*/ u16 vibratoExtentStart;
|
||||
@@ -521,7 +526,7 @@ struct SequenceChannelLayer
|
||||
// 0..0x3f; this makes 0x40..0x7f accessible as well)
|
||||
/*0x20, 0x24, 0x24*/ f32 freqScale;
|
||||
#ifdef VERSION_SH
|
||||
/* 0x28*/ f32 unkSH28;
|
||||
/* 0x28*/ f32 freqScaleMultiplier;
|
||||
#endif
|
||||
/*0x24, 0x28, 0x2C*/ f32 velocitySquare;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
@@ -562,8 +567,8 @@ struct NoteSynthesisState
|
||||
/*0x04, 0x06*/ u16 samplePosFrac;
|
||||
/*0x08*/ s32 samplePosInt;
|
||||
/*0x0C*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x10*/ s16 curVolLeft;
|
||||
/*0x12*/ s16 curVolRight;
|
||||
/*0x10*/ s16 curVolLeft; // UQ0.16 (EU Q1.15)
|
||||
/*0x12*/ s16 curVolRight; // UQ0.16 (EU Q1.15)
|
||||
};
|
||||
struct NotePlaybackState
|
||||
{
|
||||
@@ -572,7 +577,7 @@ struct NotePlaybackState
|
||||
/* 0x01, 0x01*/ u8 waveId;
|
||||
/* 0x02, 0x02*/ u8 sampleCountIndex;
|
||||
#ifdef VERSION_SH
|
||||
/* 0x03*/ u8 unkSH33; // bankId?
|
||||
/* 0x03*/ u8 bankId;
|
||||
/* 0x04*/ u8 unkSH34;
|
||||
#endif
|
||||
/*0x08, 0x04, 0x06*/ s16 adsrVolScale;
|
||||
@@ -600,12 +605,16 @@ struct NoteSubEu
|
||||
/*0x01*/ u8 bookOffset : 3;
|
||||
/*0x01*/ u8 isSyntheticWave : 1;
|
||||
/*0x01*/ u8 hasTwoAdpcmParts : 1;
|
||||
#ifdef VERSION_EU
|
||||
/*0x02*/ u8 bankId;
|
||||
#else
|
||||
/*0x02*/ u8 synthesisVolume; // UQ4.4, although 0 <= x < 1 is rounded up to 1
|
||||
#endif
|
||||
/*0x03*/ u8 headsetPanRight;
|
||||
/*0x04*/ u8 headsetPanLeft;
|
||||
/*0x05*/ u8 reverbVol;
|
||||
/*0x06*/ u16 targetVolLeft;
|
||||
/*0x08*/ u16 targetVolRight;
|
||||
/*0x05*/ u8 reverbVol; // UQ0.7 (EU Q1.7)
|
||||
/*0x06*/ u16 targetVolLeft; // UQ0.12 (EU UQ0.10)
|
||||
/*0x08*/ u16 targetVolRight; // UQ0.12 (EU UQ0.10)
|
||||
/*0x0A*/ u16 resamplingRateFixedPoint; // stored as signed but loaded as u16
|
||||
/*0x0C*/ union {
|
||||
s16 *samples;
|
||||
@@ -633,7 +642,7 @@ struct Note
|
||||
/* 0x31, 0x31*/ u8 waveId;
|
||||
/* 0x32, 0x32*/ u8 sampleCountIndex;
|
||||
#ifdef VERSION_SH
|
||||
/* 0x33*/ u8 unkSH33; // bankId?
|
||||
/* 0x33*/ u8 bankId;
|
||||
/* 0x34*/ u8 unkSH34;
|
||||
#endif
|
||||
/*0x08, 0x34, 0x36*/ s16 adsrVolScale;
|
||||
@@ -691,17 +700,17 @@ struct Note
|
||||
/*0x30, 0x48*/ struct SequenceChannelLayer *wantedParentLayer;
|
||||
/*0x34*/ struct NoteSynthesisBuffers *synthesisBuffers;
|
||||
/*0x38*/ f32 frequency;
|
||||
/*0x3C*/ u16 targetVolLeft;
|
||||
/*0x3E*/ u16 targetVolRight;
|
||||
/*0x40*/ u8 reverb;
|
||||
/*0x3C*/ u16 targetVolLeft; // Q1.15, but will always be non-negative
|
||||
/*0x3E*/ u16 targetVolRight; // Q1.15, but will always be non-negative
|
||||
/*0x40*/ u8 reverbVol; // Q1.7
|
||||
/*0x41*/ u8 unused1; // never read, set to 0x3f
|
||||
/*0x44*/ struct NoteAttributes attributes;
|
||||
/*0x54, 0x58*/ struct AdsrState adsr;
|
||||
/*0x74, 0x7C*/ struct Portamento portamento;
|
||||
/*0x84, 0x8C*/ struct VibratoState vibratoState;
|
||||
/*0x9C*/ s16 curVolLeft;
|
||||
/*0x9E*/ s16 curVolRight;
|
||||
/*0xA0*/ s16 reverbVol;
|
||||
/*0x9C*/ s16 curVolLeft; // Q1.15, but will always be non-negative
|
||||
/*0x9E*/ s16 curVolRight; // Q1.15, but will always be non-negative
|
||||
/*0xA0*/ s16 reverbVolShifted; // Q1.15
|
||||
/*0xA2*/ s16 unused2; // never read, set to 0
|
||||
/*0xA4, 0x00*/ struct AudioListItem listItem;
|
||||
/* */ u8 pad2[0xc];
|
||||
|
||||
1526
src/audio/load.c
1526
src/audio/load.c
File diff suppressed because it is too large
Load Diff
@@ -89,18 +89,25 @@ void patch_audio_bank(s32 bankId, struct AudioBank *mem, struct PatchStruct *pat
|
||||
#else
|
||||
void patch_audio_bank(struct AudioBank *mem, u8 *offset, u32 numInstruments, u32 numDrums);
|
||||
#endif
|
||||
#ifndef VERSION_SH
|
||||
#ifdef VERSION_SH
|
||||
void preload_sequence(u32 seqId, s32 preloadMask);
|
||||
#else
|
||||
void preload_sequence(u32 seqId, u8 preloadMask);
|
||||
#endif
|
||||
void load_sequence(u32 player, u32 seqId, s32 loadAsync);
|
||||
|
||||
#ifdef VERSION_SH
|
||||
void func_sh_802f3158(s32 index, s32 arg1, s32 arg2, OSMesgQueue *retQueue);
|
||||
u8 *func_sh_802f3220(u32 index, u32 *a1);
|
||||
void func_sh_802f3158(s32 seqId, s32 arg1, s32 arg2, OSMesgQueue *retQueue);
|
||||
u8 *func_sh_802f3220(u32 seqId, u32 *a1);
|
||||
struct AudioBankSample *func_sh_802f4978(s32 bankId, s32 idx);
|
||||
void *func_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue);
|
||||
s32 func_sh_802f3368(s32 arg0);
|
||||
s32 func_sh_802f47c8(s32 bankId, u8 idx, s8 *io);
|
||||
void *func_sh_802f3f08(s32 poolIdx, s32 arg1, s32 arg2, s32 arg3, OSMesgQueue *retQueue);
|
||||
void func_sh_802f41e4(s32 audioResetStatus);
|
||||
BAD_RETURN(s32) func_sh_802f3368(s32 bankId);
|
||||
void *func_sh_802f3764(s32 arg0, s32 idx, s32 *arg2);
|
||||
s32 func_sh_802f3024(s32 bankId, s32 instId, s32 arg2);
|
||||
void func_sh_802f30f4(s32 arg0, s32 arg1, s32 arg2, OSMesgQueue *arg3);
|
||||
void func_sh_802f3288(s32 idx);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
1640
src/audio/load_sh.c
Normal file
1640
src/audio/load_sh.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@ void note_set_resampling_rate(struct Note *note, f32 resamplingRateInput);
|
||||
#ifdef VERSION_SH
|
||||
void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo)
|
||||
#else
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverbVol)
|
||||
#endif
|
||||
{
|
||||
struct NoteSubEu *sub = ¬e->noteSubEu;
|
||||
@@ -30,7 +30,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
|
||||
UNUSED u32 pad1;
|
||||
f32 velocity;
|
||||
u8 pan;
|
||||
u8 reverb;
|
||||
u8 reverbVol;
|
||||
struct ReverbBitsData reverbBits;
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
|
||||
note_set_resampling_rate(note, reverbInfo->freqScale);
|
||||
velocity = reverbInfo->velocity;
|
||||
pan = reverbInfo->pan;
|
||||
reverb = reverbInfo->reverb;
|
||||
reverbVol = reverbInfo->reverbVol;
|
||||
reverbBits = reverbInfo->reverbBits.s;
|
||||
pan &= 0x7f;
|
||||
#else
|
||||
@@ -119,7 +119,7 @@ void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb)
|
||||
}
|
||||
|
||||
#ifdef VERSION_SH
|
||||
if (velocity < 0.0f) {
|
||||
if (velocity < 0.0f) {
|
||||
velocity = 0.0f;
|
||||
}
|
||||
if (velocity > 1.0f) {
|
||||
@@ -128,7 +128,7 @@ if (velocity < 0.0f) {
|
||||
|
||||
sub->targetVolLeft = ((s32) (velocity * volLeft * 4095.999f));
|
||||
sub->targetVolRight = ((s32) (velocity * volRight * 4095.999f));
|
||||
sub->bankId = reverbInfo->bankId;
|
||||
sub->synthesisVolume = reverbInfo->synthesisVolume;
|
||||
sub->filter = reverbInfo->filter;
|
||||
#else
|
||||
if (velocity < 0.0f) {
|
||||
@@ -144,11 +144,12 @@ if (velocity < 0.0f) {
|
||||
sub->targetVolRight = ((s32) (velocity * volRight) & 0xffff) >> 5;
|
||||
#endif
|
||||
|
||||
if (sub->reverbVol != reverb) {
|
||||
//! @bug for the change to UQ0.7, the if statement should also have been changed accordingly
|
||||
if (sub->reverbVol != reverbVol) {
|
||||
#ifdef VERSION_SH
|
||||
sub->reverbVol = reverb >> 1;
|
||||
sub->reverbVol = reverbVol >> 1;
|
||||
#else
|
||||
sub->reverbVol = reverb;
|
||||
sub->reverbVol = reverbVol;
|
||||
#endif
|
||||
sub->envMixerNeedsInit = TRUE;
|
||||
return;
|
||||
@@ -345,7 +346,7 @@ void process_notes(void) {
|
||||
#ifndef VERSION_SH
|
||||
f32 frequency;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
u8 reverb;
|
||||
u8 reverbVol;
|
||||
#endif
|
||||
f32 velocity;
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
@@ -359,11 +360,11 @@ void process_notes(void) {
|
||||
struct NoteSubEu *noteSubEu;
|
||||
#ifndef VERSION_SH
|
||||
UNUSED u8 pad[12];
|
||||
u8 reverb;
|
||||
u8 reverbVol;
|
||||
UNUSED u8 pad3;
|
||||
u8 pan;
|
||||
#else
|
||||
u8 pad[8];
|
||||
UNUSED u8 pad[8];
|
||||
struct ReverbInfo reverbInfo;
|
||||
#endif
|
||||
u8 bookOffset;
|
||||
@@ -508,9 +509,9 @@ void process_notes(void) {
|
||||
reverbInfo.freqScale = attributes->freqScale;
|
||||
reverbInfo.velocity = attributes->velocity;
|
||||
reverbInfo.pan = attributes->pan;
|
||||
reverbInfo.reverb = attributes->reverb;
|
||||
reverbInfo.reverbVol = attributes->reverbVol;
|
||||
reverbInfo.reverbBits = attributes->reverbBits;
|
||||
reverbInfo.bankId = attributes->unk1;
|
||||
reverbInfo.synthesisVolume = attributes->synthesisVolume;
|
||||
reverbInfo.filter = attributes->filter;
|
||||
bookOffset = noteSubEu->bookOffset;
|
||||
} else {
|
||||
@@ -518,8 +519,8 @@ void process_notes(void) {
|
||||
reverbInfo.velocity = playbackState->parentLayer->noteVelocity;
|
||||
reverbInfo.pan = playbackState->parentLayer->notePan;
|
||||
reverbInfo.reverbBits = playbackState->parentLayer->reverbBits;
|
||||
reverbInfo.reverb = playbackState->parentLayer->seqChannel->reverb;
|
||||
reverbInfo.bankId = playbackState->parentLayer->seqChannel->unkSH0C;
|
||||
reverbInfo.reverbVol = playbackState->parentLayer->seqChannel->reverbVol;
|
||||
reverbInfo.synthesisVolume = playbackState->parentLayer->seqChannel->synthesisVolume;
|
||||
reverbInfo.filter = playbackState->parentLayer->seqChannel->filter;
|
||||
bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7;
|
||||
if (playbackState->parentLayer->seqChannel->seqPlayer->muted
|
||||
@@ -538,7 +539,7 @@ void process_notes(void) {
|
||||
frequency = attributes->freqScale;
|
||||
velocity = attributes->velocity;
|
||||
pan = attributes->pan;
|
||||
reverb = attributes->reverb;
|
||||
reverbVol = attributes->reverbVol;
|
||||
if (1) {
|
||||
}
|
||||
bookOffset = noteSubEu->bookOffset;
|
||||
@@ -546,7 +547,7 @@ void process_notes(void) {
|
||||
frequency = playbackState->parentLayer->noteFreqScale;
|
||||
velocity = playbackState->parentLayer->noteVelocity;
|
||||
pan = playbackState->parentLayer->notePan;
|
||||
reverb = playbackState->parentLayer->seqChannel->reverb;
|
||||
reverbVol = playbackState->parentLayer->seqChannel->reverbVol;
|
||||
bookOffset = playbackState->parentLayer->seqChannel->bookOffset & 0x7;
|
||||
}
|
||||
|
||||
@@ -554,7 +555,7 @@ void process_notes(void) {
|
||||
frequency *= gAudioBufferParameters.resampleRate;
|
||||
velocity = velocity * scale * scale;
|
||||
note_set_resampling_rate(note, frequency);
|
||||
note_set_vel_pan_reverb(note, velocity, pan, reverb);
|
||||
note_set_vel_pan_reverb(note, velocity, pan, reverbVol);
|
||||
#endif
|
||||
noteSubEu->bookOffset = bookOffset;
|
||||
skip:;
|
||||
@@ -603,12 +604,12 @@ void process_notes(void) {
|
||||
frequency = attributes->freqScale;
|
||||
velocity = attributes->velocity;
|
||||
pan = attributes->pan;
|
||||
reverb = attributes->reverb;
|
||||
reverbVol = attributes->reverbVol;
|
||||
} else {
|
||||
frequency = note->parentLayer->noteFreqScale;
|
||||
velocity = note->parentLayer->noteVelocity;
|
||||
pan = note->parentLayer->notePan;
|
||||
reverb = note->parentLayer->seqChannel->reverb;
|
||||
reverbVol = note->parentLayer->seqChannel->reverbVol;
|
||||
}
|
||||
|
||||
scale = note->adsrVolScale;
|
||||
@@ -621,7 +622,7 @@ void process_notes(void) {
|
||||
scale *= 4.3498e-5f; // ~1 / 23000
|
||||
velocity = velocity * scale * scale;
|
||||
note_set_frequency(note, frequency);
|
||||
note_set_vel_pan_reverb(note, velocity, pan, reverb);
|
||||
note_set_vel_pan_reverb(note, velocity, pan, reverbVol);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
@@ -746,9 +747,9 @@ void seq_channel_layer_decay_release_internal(struct SequenceChannelLayer *seqLa
|
||||
attributes->reverbBits = seqLayer->reverbBits;
|
||||
#endif
|
||||
if (seqLayer->seqChannel != NULL) {
|
||||
attributes->reverb = seqLayer->seqChannel->reverb;
|
||||
attributes->reverbVol = seqLayer->seqChannel->reverbVol;
|
||||
#ifdef VERSION_SH
|
||||
attributes->unk1 = seqLayer->seqChannel->unkSH0C;
|
||||
attributes->synthesisVolume = seqLayer->seqChannel->synthesisVolume;
|
||||
attributes->filter = seqLayer->seqChannel->filter;
|
||||
if (seqLayer->seqChannel->seqPlayer->muted && (seqLayer->seqChannel->muteBehavior & 8) != 0) {
|
||||
note->noteSubEu.finished = TRUE;
|
||||
@@ -1159,7 +1160,7 @@ void note_init_for_layer(struct Note *note, struct SequenceChannelLayer *seqLaye
|
||||
build_synthetic_wave(note, seqLayer, instId);
|
||||
}
|
||||
#ifdef VERSION_SH
|
||||
note->unkSH33 = seqLayer->seqChannel->bankId;
|
||||
note->bankId = seqLayer->seqChannel->bankId;
|
||||
#else
|
||||
sub->bankId = seqLayer->seqChannel->bankId;
|
||||
#endif
|
||||
@@ -1444,7 +1445,7 @@ void note_init_all(void) {
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
note->waveId = 0;
|
||||
#else
|
||||
note->reverb = 0;
|
||||
note->reverbVol = 0;
|
||||
note->usesHeadsetPanEffects = FALSE;
|
||||
note->sampleCount = 0;
|
||||
note->instOrWave = 0;
|
||||
|
||||
@@ -33,7 +33,7 @@ void note_init_all(void);
|
||||
#if defined(VERSION_SH)
|
||||
void note_set_vel_pan_reverb(struct Note *note, struct ReverbInfo *reverbInfo);
|
||||
#elif defined(VERSION_EU)
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverb);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, u8 pan, u8 reverbVol);
|
||||
#endif
|
||||
|
||||
#if defined(VERSION_EU) || defined(VERSION_SH)
|
||||
|
||||
@@ -29,7 +29,6 @@ extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
|
||||
void func_8031D690(s32 player, FadeT fadeInTime);
|
||||
void seq_player_fade_to_zero_volume(s32 player, FadeT fadeOutTime);
|
||||
void port_eu_init_queues(void);
|
||||
void decrease_sample_dma_ttls(void);
|
||||
s32 audio_shut_down_and_reset_step(void);
|
||||
void func_802ad7ec(u32);
|
||||
@@ -300,7 +299,7 @@ void func_802ad7ec(u32 arg0) {
|
||||
chan->changes.as_bitfields.freqScale = TRUE;
|
||||
break;
|
||||
case 5:
|
||||
chan->reverb = cmd->u2.as_s8;
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
break;
|
||||
case 6:
|
||||
if (cmd->u.s.arg3 < 8) {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#ifdef VERSION_SH
|
||||
// TODO: merge this with port_eu.c?
|
||||
|
||||
#include <ultra64.h>
|
||||
|
||||
@@ -7,6 +8,7 @@
|
||||
#include "load.h"
|
||||
#include "synthesis.h"
|
||||
#include "internal.h"
|
||||
#include "seqplayer.h"
|
||||
|
||||
#define EXTRA_BUFFERED_AI_SAMPLES_TARGET 0x80
|
||||
#define SAMPLES_TO_OVERPRODUCE 0x10
|
||||
@@ -15,12 +17,13 @@ extern s32 D_SH_80314FC8;
|
||||
extern struct SPTask *D_SH_80314FCC;
|
||||
extern u8 D_SH_80315098;
|
||||
extern u8 D_SH_8031509C;
|
||||
extern OSMesgQueue *D_SH_80350F68;
|
||||
|
||||
void func_sh_802f62e0(s32 playerIndex, s32 numFrames);
|
||||
void func_sh_802f6288(s32 arg0, s32 numFrames);
|
||||
void func_sh_802f6554(u32 arg0);
|
||||
void func_8031D690(s32 playerIndex, s32 numFrames);
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 numFrames);
|
||||
void func_802ad7ec(u32 arg0);
|
||||
|
||||
struct SPTask *func_sh_802f5a80(void) {
|
||||
struct SPTask *create_next_audio_frame_task(void) {
|
||||
u32 samplesRemainingInAI;
|
||||
s32 writtenCmds;
|
||||
s32 index;
|
||||
@@ -59,7 +62,7 @@ struct SPTask *func_sh_802f5a80(void) {
|
||||
gCurrAudioFrameDmaCount = 0;
|
||||
|
||||
decrease_sample_dma_ttls();
|
||||
func_802f41e4(gAudioResetStatus);
|
||||
func_sh_802f41e4(gAudioResetStatus);
|
||||
if (osRecvMesg(D_SH_80350F88, (OSMesg *) &sp38, OS_MESG_NOBLOCK) != -1) {
|
||||
if (gAudioResetStatus == 0) {
|
||||
gAudioResetStatus = 5;
|
||||
@@ -99,7 +102,7 @@ struct SPTask *func_sh_802f5a80(void) {
|
||||
|
||||
if (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1) {
|
||||
do {
|
||||
func_sh_802f6554(sp34);
|
||||
func_802ad7ec(sp34);
|
||||
} while (osRecvMesg(D_SH_80350F68, (OSMesg *) &sp34, 0) != -1);
|
||||
}
|
||||
|
||||
@@ -143,7 +146,7 @@ struct SPTask *func_sh_802f5a80(void) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
|
||||
void eu_process_audio_cmd(struct EuAudioCmd *cmd) {
|
||||
s32 i;
|
||||
struct Note *note;
|
||||
struct NoteSubEu *sub;
|
||||
@@ -155,8 +158,8 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
|
||||
|
||||
case 0x82:
|
||||
case 0x88:
|
||||
func_sh_802F3410(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_sh_802f62e0(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
load_sequence(cmd->u.s.arg1, cmd->u.s.arg2, cmd->u.s.arg3);
|
||||
func_8031D690(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
break;
|
||||
|
||||
case 0x83:
|
||||
@@ -165,7 +168,7 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
|
||||
sequence_player_disable(&gSequencePlayers[cmd->u.s.arg1]);
|
||||
}
|
||||
else {
|
||||
func_sh_802f6288(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
seq_player_fade_to_zero_volume(cmd->u.s.arg1, cmd->u2.as_s32);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -220,32 +223,32 @@ void func_sh_802f5fb8(struct EuAudioCmd *cmd) {
|
||||
}
|
||||
}
|
||||
|
||||
void func_sh_802f6288(s32 arg0, s32 numFrames) {
|
||||
void seq_player_fade_to_zero_volume(s32 arg0, s32 fadeOutTime) {
|
||||
struct SequencePlayer *player;
|
||||
|
||||
if (numFrames == 0) {
|
||||
numFrames = 1;
|
||||
if (fadeOutTime == 0) {
|
||||
fadeOutTime = 1;
|
||||
}
|
||||
player = &gSequencePlayers[arg0];
|
||||
player->state = 2;
|
||||
player->fadeRemainingFrames = numFrames;
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32) numFrames);
|
||||
player->fadeRemainingFrames = fadeOutTime;
|
||||
player->fadeVelocity = -(player->fadeVolume / (f32) fadeOutTime);
|
||||
}
|
||||
|
||||
void func_sh_802f62e0(s32 playerIndex, s32 numFrames) {
|
||||
void func_8031D690(s32 playerIndex, s32 fadeInTime) {
|
||||
struct SequencePlayer *player;
|
||||
|
||||
if (numFrames != 0) {
|
||||
if (fadeInTime != 0) {
|
||||
player = &gSequencePlayers[playerIndex];
|
||||
player->state = 1;
|
||||
player->fadeTimerUnkEu = numFrames;
|
||||
player->fadeRemainingFrames = numFrames;
|
||||
player->fadeTimerUnkEu = fadeInTime;
|
||||
player->fadeRemainingFrames = fadeInTime;
|
||||
player->fadeVolume = 0.0f;
|
||||
player->fadeVelocity = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void func_sh_802f6330(void) {
|
||||
void port_eu_init_queues(void) {
|
||||
D_SH_80350F18 = 0;
|
||||
D_SH_80350F19 = 0;
|
||||
D_SH_80350F38 = &D_SH_80350F20;
|
||||
@@ -258,8 +261,8 @@ void func_sh_802f6330(void) {
|
||||
osCreateMesgQueue(D_SH_80350FA8, D_SH_80350F8C, 1);
|
||||
}
|
||||
|
||||
extern struct EuAudioCmd sAudioCmd[0x100]; // sAudioCmd, maybe?
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
|
||||
extern struct EuAudioCmd sAudioCmd[0x100];
|
||||
void func_802ad6f0(s32 arg0, s32 *arg1) {
|
||||
struct EuAudioCmd *cmd = &sAudioCmd[D_SH_80350F18 & 0xff];
|
||||
cmd->u.first = arg0;
|
||||
cmd->u2.as_u32 = *arg1;
|
||||
@@ -269,34 +272,30 @@ void func_802ad6f0(s32 arg0, s32 *arg1) { // func_sh_802f63f8
|
||||
}
|
||||
}
|
||||
|
||||
void func_802ad728(u32 arg0, f32 arg1) { // func_sh_802f6450
|
||||
void func_802ad728(u32 arg0, f32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad74c(u32 arg0, u32 arg1) { // func_sh_802f6474
|
||||
void func_802ad74c(u32 arg0, u32 arg1) {
|
||||
func_802ad6f0(arg0, (s32 *) &arg1);
|
||||
}
|
||||
|
||||
void func_802ad770(u32 arg0, s8 arg1) { // func_sh_802f6498
|
||||
void func_802ad770(u32 arg0, s8 arg1) {
|
||||
s32 sp1C = arg1 << 24;
|
||||
func_802ad6f0(arg0, &sp1C);
|
||||
}
|
||||
|
||||
char shindouDebugPrint133[] = "AudioSend: %d -> %d (%d)\n";
|
||||
|
||||
extern OSMesgQueue *D_SH_80350F68;
|
||||
void func_sh_802F64C8(void) {
|
||||
static s32 D_SH_8031503C = 0;
|
||||
s32 a0 = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
|
||||
s32 a1;
|
||||
s32 mesg;
|
||||
|
||||
if (D_SH_8031503C < a0) {
|
||||
D_SH_8031503C = a0;
|
||||
if (((D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff) > D_SH_8031503C) {
|
||||
D_SH_8031503C = (D_SH_80350F18 - D_SH_80350F19 + 0x100) & 0xff;
|
||||
}
|
||||
a0 = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xFF);
|
||||
a1 = a0;
|
||||
a0 = D_SH_80350F68;
|
||||
osSendMesg(a0, a1, 0);
|
||||
mesg = ((D_SH_80350F19 & 0xff) << 8) | (D_SH_80350F18 & 0xff);
|
||||
osSendMesg(D_SH_80350F68, (OSMesg)mesg, OS_MESG_NOBLOCK);
|
||||
D_SH_80350F19 = D_SH_80350F18;
|
||||
}
|
||||
|
||||
@@ -304,16 +303,16 @@ void func_sh_802f6540(void) {
|
||||
D_SH_80350F19 = D_SH_80350F18;
|
||||
}
|
||||
|
||||
void func_sh_802f6554(u32 arg0) {
|
||||
void func_802ad7ec(u32 arg0) {
|
||||
struct EuAudioCmd *cmd;
|
||||
struct SequencePlayer *seqPlayer;
|
||||
struct SequenceChannel *chan;
|
||||
u8 a0;
|
||||
u8 end;
|
||||
|
||||
static char shindouDebugPrint134[] = "Continue Port\n";
|
||||
static char shindouDebugPrint135[] = "%d -> %d\n";
|
||||
static char shindouDebugPrint136[] = "Sync-Frame Break. (Remain %d)\n";
|
||||
static char shindouDebugPrint137[] = "Undefined Port Command %d\n";
|
||||
UNUSED static char shindouDebugPrint134[] = "Continue Port\n";
|
||||
UNUSED static char shindouDebugPrint135[] = "%d -> %d\n";
|
||||
UNUSED static char shindouDebugPrint136[] = "Sync-Frame Break. (Remain %d)\n";
|
||||
UNUSED static char shindouDebugPrint137[] = "Undefined Port Command %d\n";
|
||||
|
||||
static u8 D_SH_80315098 = 0;
|
||||
static u8 D_SH_8031509C = 0;
|
||||
@@ -322,10 +321,10 @@ void func_sh_802f6554(u32 arg0) {
|
||||
D_SH_80315098 = (arg0 >> 8) & 0xff;
|
||||
}
|
||||
|
||||
a0 = arg0 & 0xff;
|
||||
end = arg0 & 0xff;
|
||||
|
||||
for (;;) {
|
||||
if (D_SH_80315098 == a0) {
|
||||
if (D_SH_80315098 == end) {
|
||||
D_SH_8031509C = 0;
|
||||
break;
|
||||
}
|
||||
@@ -336,12 +335,12 @@ void func_sh_802f6554(u32 arg0) {
|
||||
break;
|
||||
}
|
||||
else if ((cmd->u.s.op & 0xf0) == 0xf0) {
|
||||
func_sh_802f5fb8(cmd);
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if (cmd->u.s.arg1 < SEQUENCE_PLAYERS) {
|
||||
seqPlayer = &gSequencePlayers[cmd->u.s.arg1];
|
||||
if ((cmd->u.s.op & 0x80) != 0) {
|
||||
func_sh_802f5fb8(cmd);
|
||||
eu_process_audio_cmd(cmd);
|
||||
}
|
||||
else if ((cmd->u.s.op & 0x40) != 0) {
|
||||
switch (cmd->u.s.op) {
|
||||
@@ -399,8 +398,9 @@ void func_sh_802f6554(u32 arg0) {
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if (chan->reverb != cmd->u2.as_s8) {
|
||||
chan->reverb = cmd->u2.as_s8;
|
||||
//! @bug u8 s8 comparison (but harmless)
|
||||
if (chan->reverbVol != cmd->u2.as_s8) {
|
||||
chan->reverbVol = cmd->u2.as_s8;
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@@ -489,9 +489,8 @@ s8 func_sh_802f6a6c(s32 playerIndex, s32 index) {
|
||||
return gSequencePlayers[playerIndex].seqVariationEu[index];
|
||||
}
|
||||
|
||||
void func_sh_802f6a9c(void) {
|
||||
// creates a bunch of os message queues
|
||||
func_sh_802f6330();
|
||||
void port_eu_init(void) {
|
||||
port_eu_init_queues();
|
||||
}
|
||||
|
||||
char shindouDebugPrint138[] = "specchg conjunction error (Msg:%d Cur:%d)\n";
|
||||
@@ -525,9 +524,13 @@ char shindouDebugPrint164[] = "Audio: C-Alloc : lowerPrio is NULL\n";
|
||||
char shindouDebugPrint165[] = "Intterupt UseStop %d (Kill %d)\n";
|
||||
char shindouDebugPrint166[] = "Intterupt RelWait %d (Kill %d)\n";
|
||||
char shindouDebugPrint167[] = "Drop Voice (Prio %x)\n";
|
||||
s32 D_SH_803154CC = 0; // Either an unused variable or a file boundary.
|
||||
s32 D_SH_803154CC = 0; // file boundary
|
||||
|
||||
// effects.c
|
||||
char shindouDebugPrint168[] = "Audio:Envp: overflow %f\n";
|
||||
s32 D_SH_803154EC = 0; // Either an unused variable or a file boundary.
|
||||
s32 D_SH_803154EC = 0; // file boundary
|
||||
|
||||
// seqplayer.c
|
||||
char shindouDebugPrint169[] = "Audio:Track:Warning: No Free Notetrack\n";
|
||||
char shindouDebugPrint170[] = "SUBTRACK DIM\n";
|
||||
char shindouDebugPrint171[] = "Audio:Track: Warning :SUBTRACK had been stolen by other Group.\n";
|
||||
@@ -55,9 +55,9 @@ void sequence_channel_init(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->panChannelWeight = 1.0f;
|
||||
seqChannel->noteUnused = NULL;
|
||||
#endif
|
||||
seqChannel->reverb = 0;
|
||||
seqChannel->reverbVol = 0;
|
||||
#ifdef VERSION_SH
|
||||
seqChannel->unkSH0C = 0;
|
||||
seqChannel->synthesisVolume = 0;
|
||||
#endif
|
||||
seqChannel->notePriority = NOTE_PRIORITY_DEFAULT;
|
||||
#ifdef VERSION_SH
|
||||
@@ -142,7 +142,7 @@ s32 seq_channel_set_layer(struct SequenceChannel *seqChannel, s32 layerIndex) {
|
||||
layer->freqScale = 1.0f;
|
||||
layer->velocitySquare = 0.0f;
|
||||
#ifdef VERSION_SH
|
||||
layer->unkSH28 = 1.0f;
|
||||
layer->freqScaleMultiplier = 1.0f;
|
||||
#endif
|
||||
layer->instOrWave = 0xff;
|
||||
#else
|
||||
@@ -989,7 +989,7 @@ void seq_channel_layer_process_script_part1(struct SequenceChannelLayer *layer)
|
||||
}
|
||||
|
||||
s32 seq_channel_layer_process_script_part5(struct SequenceChannelLayer *layer, s32 cmd) {
|
||||
if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->codec == 2 &&
|
||||
if (!layer->stopSomething && layer->sound != NULL && layer->sound->sample->codec == CODEC_SKIP &&
|
||||
layer->sound->sample->medium != 0) {
|
||||
layer->stopSomething = TRUE;
|
||||
return -1;
|
||||
@@ -1176,7 +1176,7 @@ s32 seq_channel_layer_process_script_part2(struct SequenceChannelLayer *layer) {
|
||||
|
||||
case 0xce:
|
||||
cmd = m64_read_u8(state) + 0x80;
|
||||
layer->unkSH28 = unk_sh_data_1[cmd];
|
||||
layer->freqScaleMultiplier = unk_sh_data_1[cmd];
|
||||
// missing break :)
|
||||
|
||||
default:
|
||||
@@ -1320,7 +1320,7 @@ s32 seq_channel_layer_process_script_part4(struct SequenceChannelLayer *layer, s
|
||||
}
|
||||
}
|
||||
layer->delayUnused = layer->delay;
|
||||
layer->freqScale *= layer->unkSH28;
|
||||
layer->freqScale *= layer->freqScaleMultiplier;
|
||||
return sameSound;
|
||||
}
|
||||
|
||||
@@ -1828,7 +1828,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
#endif
|
||||
|
||||
case 0xd4: // chan_setreverb
|
||||
seqChannel->reverb = m64_read_u8(state);
|
||||
seqChannel->reverbVol = m64_read_u8(state);
|
||||
break;
|
||||
|
||||
case 0xc6: // chan_setbank; switch bank within set
|
||||
@@ -1972,8 +1972,8 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->transposition = (s8) *seqData++;
|
||||
seqChannel->newPan = *seqData++;
|
||||
seqChannel->panChannelWeight = *seqData++;
|
||||
seqChannel->reverb = *seqData++;
|
||||
seqChannel->reverbIndex = *seqData++; // reverb index?
|
||||
seqChannel->reverbVol = *seqData++;
|
||||
seqChannel->reverbIndex = *seqData++;
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
|
||||
@@ -1984,7 +1984,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
seqChannel->transposition = (s8) m64_read_u8(state);
|
||||
seqChannel->newPan = m64_read_u8(state);
|
||||
seqChannel->panChannelWeight = m64_read_u8(state);
|
||||
seqChannel->reverb = m64_read_u8(state);
|
||||
seqChannel->reverbVol = m64_read_u8(state);
|
||||
seqChannel->reverbIndex = m64_read_u8(state);
|
||||
seqChannel->changes.as_bitfields.pan = TRUE;
|
||||
break;
|
||||
@@ -2016,7 +2016,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
#endif
|
||||
#ifdef VERSION_SH
|
||||
case 0xed:
|
||||
seqChannel->unkSH0C = m64_read_u8(state);
|
||||
seqChannel->synthesisVolume = m64_read_u8(state);
|
||||
break;
|
||||
|
||||
case 0xef:
|
||||
@@ -2112,7 +2112,7 @@ void sequence_channel_process_script(struct SequenceChannel *seqChannel) {
|
||||
|
||||
case 0x10:
|
||||
seqChannel->soundScriptIO[loBits] = -1;
|
||||
if (func_802f47c8(seqChannel->bankId, (u8)value, &seqChannel->soundScriptIO[loBits]) == -1) {
|
||||
if (func_sh_802f47c8(seqChannel->bankId, (u8)value, &seqChannel->soundScriptIO[loBits]) == -1) {
|
||||
}
|
||||
break;
|
||||
#else
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#ifdef VERSION_SH
|
||||
// The first four debug prints are in data.c.
|
||||
// synthesis.c
|
||||
char shindouDebugPrint1[] = "Terminate-Canceled Channel %d,Phase %d\n";
|
||||
char shindouDebugPrint2[] = "S->W\n";
|
||||
char shindouDebugPrint3[] = "W->S\n";
|
||||
char shindouDebugPrint4[] = "S-Resample Pitch %x (old %d -> delay %d)\n";
|
||||
s32 shindouDebugPrintPadding1[] = {0,0,0};
|
||||
|
||||
// heap.c
|
||||
char shindouDebugPrint5[] = "Warning:Kill Note %x \n";
|
||||
char shindouDebugPrint6[] = "Kill Voice %d (ID %d) %d\n";
|
||||
char shindouDebugPrint7[] = "Warning: Running Sequence's data disappear!\n";
|
||||
@@ -58,8 +65,9 @@ char shindouDebugPrint57[] = "Request--------Single-Stay, %d\n";
|
||||
char shindouDebugPrint58[] = "Try Kill %d \n";
|
||||
char shindouDebugPrint59[] = "Try Kill %x %x\n";
|
||||
char shindouDebugPrint60[] = "Try Kill %x %x %x\n";
|
||||
// Zero padding here. These aren't used variables, so they could be either unused variables or a file boundary.
|
||||
s32 shindouDebugPrintPadding[] = {0, 0, 0};
|
||||
|
||||
// load.c
|
||||
char shindouDebugPrint61[] = "CAUTION:WAVE CACHE FULL %d";
|
||||
char shindouDebugPrint62[] = "SUPERDMA";
|
||||
char shindouDebugPrint63[] = "Bank Change... top %d lba %d\n";
|
||||
@@ -124,6 +132,8 @@ char shindouDebugPrint121[] = "N start %d\n";
|
||||
char shindouDebugPrint122[] = "============Error: Magic is Broken: %x\n";
|
||||
char shindouDebugPrint123[] = "Error: No Handle.\n";
|
||||
char shindouDebugPrint124[] = "Success: %x\n";
|
||||
|
||||
// port_eu.c
|
||||
char shindouDebugPrint125[] = "DAC:Lost 1 Frame.\n";
|
||||
char shindouDebugPrint126[] = "DMA: Request queue over.( %d )\n";
|
||||
char shindouDebugPrint127[] = "Spec Change Override. %d -> %d\n";
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -90,7 +90,7 @@ extern s16 D_SH_803479B4;
|
||||
u64 *synthesis_execute(u64 *cmdBuf, s32 *writtenCmds, s16 *aiBuf, s32 bufLen);
|
||||
#if defined(VERSION_JP) || defined(VERSION_US)
|
||||
void note_init_volume(struct Note *note);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverb);
|
||||
void note_set_vel_pan_reverb(struct Note *note, f32 velocity, f32 pan, u8 reverbVol);
|
||||
void note_set_frequency(struct Note *note, f32 frequency);
|
||||
void note_enable(struct Note *note);
|
||||
void note_disable(struct Note *note);
|
||||
|
||||
910
src/audio/synthesis_sh.c
Normal file
910
src/audio/synthesis_sh.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
#include <ultra64.h>
|
||||
|
||||
#include "buffers.h"
|
||||
#include "config.h"
|
||||
|
||||
ALIGNED8 u8 gDecompressionHeap[0xD000];
|
||||
#if defined(VERSION_EU)
|
||||
@@ -15,7 +16,7 @@ ALIGNED8 u8 gIdleThreadStack[0x800];
|
||||
ALIGNED8 u8 gThread3Stack[0x2000];
|
||||
ALIGNED8 u8 gThread4Stack[0x2000];
|
||||
ALIGNED8 u8 gThread5Stack[0x2000];
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
ALIGNED8 u8 gThread6Stack[0x2000];
|
||||
#endif
|
||||
// 0x400 bytes
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "game/save_file.h"
|
||||
#include "game/game_init.h"
|
||||
#include "config.h"
|
||||
|
||||
extern u8 gDecompressionHeap[];
|
||||
|
||||
@@ -18,7 +19,7 @@ extern u8 gIdleThreadStack[];
|
||||
extern u8 gThread3Stack[];
|
||||
extern u8 gThread4Stack[];
|
||||
extern u8 gThread5Stack[];
|
||||
#ifdef VERSION_SH
|
||||
#if ENABLE_RUMBLE
|
||||
extern u8 gThread6Stack[];
|
||||
#endif
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user