I believe we discussed this before some time... but the code was never posted.
The issue = if sound effects are quiter than the music, they won't play...and if they have a volume envelope that fades out, they will cut off as soon their envelope is quieter than the music.
Here's the fix...
Although you will get the opposite problem... the music might cut out abruptly to play a sound effect.
The issue = if sound effects are quiter than the music, they won't play...and if they have a volume envelope that fades out, they will cut off as soon their envelope is quieter than the music.
Here's the fix...
Code:
_FT2SfxUpdate:
...
@update_buf:
lda FT_OUT_BUF
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+0,x
and #$0f
beq @no_pulse1 ; edit
lda FT_SFX_BUF+0,x
sta FT_OUT_BUF+0
lda FT_SFX_BUF+1,x
sta FT_OUT_BUF+1
lda FT_SFX_BUF+2,x
sta FT_OUT_BUF+2
@no_pulse1:
lda FT_OUT_BUF+3
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+3,x
and #$0f
beq @no_pulse2 ; edit
lda FT_SFX_BUF+3,x
sta FT_OUT_BUF+3
lda FT_SFX_BUF+4,x
sta FT_OUT_BUF+4
lda FT_SFX_BUF+5,x
sta FT_OUT_BUF+5
@no_pulse2:
lda FT_SFX_BUF+6,x
beq @no_triangle
sta FT_OUT_BUF+6
lda FT_SFX_BUF+7,x
sta FT_OUT_BUF+7
lda FT_SFX_BUF+8,x
sta FT_OUT_BUF+8
@no_triangle:
lda FT_OUT_BUF+9
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+9,x
and #$0f
beq @no_noise ; edit
lda FT_SFX_BUF+9,x
sta FT_OUT_BUF+9
lda FT_SFX_BUF+10,x
sta FT_OUT_BUF+10
@no_noise:
rts
...
@update_buf:
lda FT_OUT_BUF
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+0,x
and #$0f
beq @no_pulse1 ; edit
lda FT_SFX_BUF+0,x
sta FT_OUT_BUF+0
lda FT_SFX_BUF+1,x
sta FT_OUT_BUF+1
lda FT_SFX_BUF+2,x
sta FT_OUT_BUF+2
@no_pulse1:
lda FT_OUT_BUF+3
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+3,x
and #$0f
beq @no_pulse2 ; edit
lda FT_SFX_BUF+3,x
sta FT_OUT_BUF+3
lda FT_SFX_BUF+4,x
sta FT_OUT_BUF+4
lda FT_SFX_BUF+5,x
sta FT_OUT_BUF+5
@no_pulse2:
lda FT_SFX_BUF+6,x
beq @no_triangle
sta FT_OUT_BUF+6
lda FT_SFX_BUF+7,x
sta FT_OUT_BUF+7
lda FT_SFX_BUF+8,x
sta FT_OUT_BUF+8
@no_triangle:
lda FT_OUT_BUF+9
and #$0f
sta <FT_TEMP_VAR1
lda FT_SFX_BUF+9,x
and #$0f
beq @no_noise ; edit
lda FT_SFX_BUF+9,x
sta FT_OUT_BUF+9
lda FT_SFX_BUF+10,x
sta FT_OUT_BUF+10
@no_noise:
rts
Although you will get the opposite problem... the music might cut out abruptly to play a sound effect.