Skip to content

Commit b96ccb1

Browse files
committed
comb filter.
1 parent 918f5ce commit b96ccb1

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

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
@@ -440,8 +440,8 @@ struct SequenceChannel {
440440
#endif
441441
/*0x05, 0x06*/ u8 bankId;
442442
/* */ u8 surroundEffectIndex; // Surround depth: 0 = front, 0x7F = behind
443-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect (-32 to 127)
444443
/* */ u8 combFilterSize; // Comb filter size (delay in bytes, typically 0x28)
444+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
445445
#if defined(VERSION_EU) || defined(VERSION_SH)
446446
/* , 0x07*/ u8 reverbIndex;
447447
/* , 0x08, 0x09*/ u8 bookOffset;
@@ -637,8 +637,8 @@ struct Note {
637637
/* 0x32, 0x32*/ u8 sampleCountIndex;
638638
/* */ u8 surroundEffectIndex; // Index for surround effect pan position
639639
/* */ u8 pan; // Pan position: 0 = left, 128 = center, 255 = right
640-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect
641640
/* */ u8 combFilterSize; // Comb filter size (delay in bytes)
641+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
642642
#ifdef VERSION_SH
643643
/* 0x33*/ u8 bankId;
644644
/* 0x34*/ u8 unkSH34;
@@ -701,9 +701,9 @@ struct Note {
701701
/*0x40*/ u8 reverbVol; // Q1.7
702702
/*0x41*/ u8 surroundEffectIndex; // Index for surround effect pan position
703703
/*0x42*/ u8 pan; // Pan position: 0 = left, 128 = center, 255 = right
704-
/* */ s8 combFilterGain; // Comb filter gain for surround height effect (-32 to 127)
705704
/* */ u8 combFilterSize; // Comb filter size (delay in bytes, typically 0x28)
706705
/* */ u8 combFilterNeedsInit; // TRUE if comb filter state needs to be cleared
706+
/* */ u16 combFilterGain; // Comb filter gain for surround height effect
707707
/*0x44*/ struct NoteAttributes attributes;
708708
/*0x54, 0x58*/ struct AdsrState adsr;
709709
/*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)