Skip to content

Commit 8a0afee

Browse files
committed
comb filter.
1 parent 700480c commit 8a0afee

4 files changed

Lines changed: 4 additions & 8 deletions

File tree

src/audio/effects.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,6 @@ s32 adsr_update(struct AdsrState *adsr) {
551551
* -32 to -1 (0xE0-0xFF): Sound is below camera (negative Y)
552552
* 0 to 127: Sound is above camera (positive Y)
553553
* Bit 0 is always set (odd number)
554-
*
555-
* Based on Majora's Mask AudioSfx_ComputeCombFilter.
556554
*/
557555
s8 audio_compute_comb_filter(f32 posY) {
558556
s8 combFilterGain;

src/audio/external.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ static void update_game_sound(void) {
12731273
// Set comb filter gain based on Y height for vertical positioning
12741274
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->combFilterGain =
12751275
audio_compute_comb_filter(*sSoundBanks[bank][soundIndex].y);
1276-
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->combFilterSize = 0x28;
1276+
gSequencePlayers[SEQ_PLAYER_SFX].channels[channelIndex]->combFilterSize = 16;
12771277
}
12781278

12791279
switch (bank) {

src/audio/internal.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,8 @@ struct SequenceChannel {
447447
#endif
448448
/*0x05, 0x06*/ u8 bankId;
449449
/* */ u8 surroundEffectIndex; // Surround depth: 0 = front, 0x7F = behind
450-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect (-32 to 127)
451450
/* */ u8 combFilterSize; // Comb filter size (delay in bytes, typically 0x28)
451+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
452452
#if defined(VERSION_EU) || defined(VERSION_SH)
453453
/* , 0x07*/ u8 reverbIndex;
454454
/* , 0x08, 0x09*/ u8 bookOffset;
@@ -647,8 +647,8 @@ struct Note {
647647
/* 0x32, 0x32*/ u8 sampleCountIndex;
648648
/* */ u8 surroundEffectIndex; // Index for surround effect pan position
649649
/* */ u8 pan; // Pan position: 0 = left, 128 = center, 255 = right
650-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect
651650
/* */ u8 combFilterSize; // Comb filter size (delay in bytes)
651+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
652652
#ifdef VERSION_SH
653653
/* 0x33*/ u8 bankId;
654654
/* 0x34*/ u8 unkSH34;
@@ -711,9 +711,9 @@ struct Note {
711711
/*0x40*/ u8 reverbVol; // Q1.7
712712
/*0x41*/ u8 surroundEffectIndex; // Index for surround effect pan position
713713
/*0x42*/ u8 pan; // Pan position: 0 = left, 128 = center, 255 = right
714-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect (-32 to 127)
715714
/* */ u8 combFilterSize; // Comb filter size (delay in bytes, typically 0x28)
716715
/* */ u8 combFilterNeedsInit; // TRUE if comb filter state needs to be cleared
716+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
717717
/*0x44*/ struct NoteAttributes attributes;
718718
/*0x54, 0x58*/ struct AdsrState adsr;
719719
/*0x74, 0x7C*/ struct Portamento portamento;

src/audio/synthesis.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,6 @@ u64 *synthesis_process_notes(s16 *aiBuf, s32 bufLen, u64 *cmd) {
10901090
}
10911091
#else
10921092
if (note->stereoHeadsetEffects && note->combFilterSize != 0 && note->combFilterGain != 0 && gSoundMode == SOUND_MODE_SURROUND) {
1093-
printf("combFilterSize: %d, combFilterGain: %d\n", note->combFilterSize, note->combFilterGain);
10941093
s16 *combFilterState = note->synthesisBuffers->combFilterState;
10951094
u16 combFilterDmem;
10961095
// Copy mono signal to comb temp buffer
@@ -1500,7 +1499,6 @@ u64 *note_apply_headset_pan_effects(u64 *cmd, struct Note *note, s32 bufLen, s32
15001499
* 0x40-0x7F: Sound behind (0x40 = at camera, 0x7F = far behind) - more rear effect
15011500
*
15021501
* This creates a rear channel effect by phase-inverting and mixing based on pan and depth.
1503-
* Based on Majora's Mask Audio_SetSequenceProperties surround calculation.
15041502
*/
15051503
u64 *note_apply_surround_effect(u64 *cmd, struct Note *note, s32 bufLen) {
15061504
s16 dryGain;

0 commit comments

Comments
 (0)