Skip to content

Commit

Permalink
FF8: Add missing support for audio effects to be stopped in time
Browse files Browse the repository at this point in the history
  • Loading branch information
julianxhokaxhiu committed May 21, 2024
1 parent aaae318 commit e6f514a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Rendering: Avoid texture reupload in case of palette swap ( https://github.com/julianxhokaxhiu/FFNx/pull/687 )
- Rendering: Fix texture unload when multiple palettes are written ( https://github.com/julianxhokaxhiu/FFNx/pull/687 )
- Rendering: Prevent the game from sending textures with half-alpha colors ( https://github.com/julianxhokaxhiu/FFNx/pull/687 )
- SFX: Add missing support for audio effects to be stopped in time


# 1.19.1
Expand Down
10 changes: 5 additions & 5 deletions src/sfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ void ff7_sfx_stop_channel(int channel, double time = 0)
sfx_state[channel-1].is_looped = false;
}

void ff8_sfx_stop_channel(int channel)
void ff8_sfx_stop_channel(int channel, double time = 0)
{
if (trace_all || trace_sfx) ffnx_trace("%s: channel=%d\n", __func__, channel);

if (channel <= FF8_MAX_CHANNEL_NUMBER)
{
nxAudioEngine.stopSFX(channel);
nxAudioEngine.stopSFX(channel, time);
}
}

Expand Down Expand Up @@ -115,10 +115,10 @@ void ff8_sfx_set_volume(uint32_t channel, uint32_t volume, int32_t time)
{
if (trace_all || trace_sfx) ffnx_trace("%s: channel=%d, volume=%d, time=%d\n", __func__, channel, volume, time);

if (channel <= FF8_MAX_CHANNEL_NUMBER && volume <= 127)
{
if (volume == 0)
ff8_sfx_stop_channel(channel, time / 60.0f);
else if (channel <= FF8_MAX_CHANNEL_NUMBER && volume <= 127)
nxAudioEngine.setSFXVolume(channel, volume / 127.0f, time / 60.0f);
}
}

void ff7_sfx_set_volume_trans_on_channel(byte volume, int channel, int time)
Expand Down

0 comments on commit e6f514a

Please sign in to comment.