Problem with FamiTone2 SFX

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Problem with FamiTone2 SFX
by on (#185587)
Wondering if someone can help me with SFX.

I'm using FamiTone2 to play SFX in my game. SFX work fine when played in the first channel but when trying to play it in any other channel, I get a 'ting' sound (attached).

Here's the code I'm using to play the Hit SFX in the second channel:
Code:
    LDA #SFX_HIT_1
    LDX #$01
    JSR FamiToneSfxPlay

And settings for FamiTone2:
Code:
 FT_BASE_ADR      = $0300   ;page in the RAM used for FT2 variables, should be $xx00
 FT_TEMP         = $00   ;3 bytes in zeropage used by the library as a scratchpad
 FT_DPCM_OFF      = $C000   ;$c000..$ffc0, 64-byte steps
 FT_SFX_STREAMS   = 4      ;number of sound effects played at once, 1..4

 FT_DPCM_ENABLE         ;undefine to exclude all DMC code
 FT_SFX_ENABLE         ;undefine to exclude all sound effects code
 FT_THREAD            ;undefine if you are calling sound effects from the same thread as the sound update call

 FT_PAL_SUPPORT         ;undefine to exclude PAL support
 FT_NTSC_SUPPORT         ;undefine to exclude NTSC support

Any help is appreciated. Thanks!
Re: Problem with FamiTone2 SFX
by on (#185606)
To select the sfx channel stream, you need to use FT_SFX_CHx vars like this :

Code:
    LDA #SFX_HIT_1
    LDX #FT_SFX_CH0
    JSR FamiToneSfxPlay

    LDA #SFX_JUMP
    LDX #FT_SFX_CH1
    JSR FamiToneSfxPlay

Re: Problem with FamiTone2 SFX
by on (#185607)
glutock wrote:
To select the sfx channel stream, you need to use FT_SFX_CHx vars like this :

Code:
    LDA #SFX_HIT_1
    LDX #FT_SFX_CH0
    JSR FamiToneSfxPlay

    LDA #SFX_JUMP
    LDX #FT_SFX_CH1
    JSR FamiToneSfxPlay



Thanks, that was it!