Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add panning to page switch sound effect #2396

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions romsel_dsimenutheme/arm9/source/fileBrowse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,7 @@ static bool previousPage(SwitchState scrn, vector<vector<DirEntry>> dirContents)
return false;
}

snd().playSwitch();
snd().playSwitch(55);
if (ms().theme != TWLSettings::EThemeSaturn && ms().theme != TWLSettings::EThemeHBL) {
fadeType = false; // Fade to white
for (int i = 0; i < 6; i++) {
Expand Down Expand Up @@ -2807,7 +2807,7 @@ static bool nextPage(SwitchState scrn, vector<vector<DirEntry>> dirContents) {
return false;
}

snd().playSwitch();
snd().playSwitch(200);
if (ms().theme != TWLSettings::EThemeSaturn && ms().theme != TWLSettings::EThemeHBL) {
fadeType = false; // Fade to white
for (int i = 0; i < 6; i++) {
Expand Down Expand Up @@ -3232,7 +3232,7 @@ std::string browseForFile(const std::vector<std::string_view> extensionList) {
break;
} else if (pressed & KEY_L) {
if (PAGENUM > 0) {
snd().playSwitch();
snd().playSwitch(55);
fadeType = false; // Fade to white
for (int i = 0; i < 6; i++) {
bgOperations(true);
Expand Down Expand Up @@ -3265,7 +3265,7 @@ std::string browseForFile(const std::vector<std::string_view> extensionList) {
}
} else if (pressed & KEY_R) {
if (file_count > 40 + PAGENUM * 40) {
snd().playSwitch();
snd().playSwitch(200);
fadeType = false; // Fade to white
for (int i = 0; i < 6; i++) {
bgOperations(true);
Expand Down
14 changes: 7 additions & 7 deletions romsel_dsimenutheme/arm9/source/sound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,13 @@ SoundControl::SoundControl()
}
}

mm_sfxhand SoundControl::playLaunch() { return mmEffectEx(&snd_launch); }
mm_sfxhand SoundControl::playSelect() { return mmEffectEx(&snd_select); }
mm_sfxhand SoundControl::playBack() { return mmEffectEx(&snd_back); }
mm_sfxhand SoundControl::playSwitch() { return mmEffectEx(&snd_switch); }
mm_sfxhand SoundControl::playStartup() { return mmEffectEx(&mus_startup); }
mm_sfxhand SoundControl::playStop() { return mmEffectEx(&snd_stop); }
mm_sfxhand SoundControl::playWrong() { return mmEffectEx(&snd_wrong); }
mm_sfxhand SoundControl::playLaunch(u8 panning) { snd_launch.panning = panning; return mmEffectEx(&snd_launch); }
mm_sfxhand SoundControl::playSelect(u8 panning) { snd_select.panning = panning; return mmEffectEx(&snd_select); }
mm_sfxhand SoundControl::playBack(u8 panning) { snd_back.panning = panning; return mmEffectEx(&snd_back); }
mm_sfxhand SoundControl::playSwitch(u8 panning) { snd_switch.panning = panning; return mmEffectEx(&snd_switch); }
mm_sfxhand SoundControl::playStartup(u8 panning) { mus_startup.panning = panning; return mmEffectEx(&mus_startup); }
mm_sfxhand SoundControl::playStop(u8 panning) { snd_stop.panning = panning; return mmEffectEx(&snd_stop); }
mm_sfxhand SoundControl::playWrong(u8 panning) { snd_wrong.panning = panning; return mmEffectEx(&snd_wrong); }

void SoundControl::beginStream() {
if (!stream_source) return;
Expand Down
14 changes: 7 additions & 7 deletions romsel_dsimenutheme/arm9/source/sound.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
class SoundControl {
public:
SoundControl();
mm_sfxhand playLaunch();
mm_sfxhand playSelect();
mm_sfxhand playBack();
mm_sfxhand playSwitch();
mm_sfxhand playStartup();
mm_sfxhand playStop();
mm_sfxhand playWrong();
mm_sfxhand playLaunch(u8 panning = 128);
mm_sfxhand playSelect(u8 panning = 128);
mm_sfxhand playBack(u8 panning = 128);
mm_sfxhand playSwitch(u8 panning = 128);
mm_sfxhand playStartup(u8 panning = 128);
mm_sfxhand playStop(u8 panning = 128);
mm_sfxhand playWrong(u8 panning = 128);

// Refill the stream buffers
volatile void updateStream();
Expand Down
10 changes: 8 additions & 2 deletions settings/arm9/source/settingsgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,19 @@ void SettingsGUI::processInputs(int pressed, touchPosition &touch)
}

if ((pressed & KEY_X || pressed & KEY_R) && !inSub()) {
mmEffectEx(currentTheme == 4 ? &snd().snd_saturn_launch : &snd().snd_switch);
mm_sound_effect pannedSound = currentTheme == 4 ? snd().snd_saturn_launch : snd().snd_switch;
pannedSound.panning = 178;

mmEffectEx(&pannedSound);
titleDisplayLength = 0;
rotatePage(1);
}

if ((pressed & KEY_Y || pressed & KEY_L) && !inSub()) {
mmEffectEx(currentTheme==4 ? &snd().snd_saturn_launch : &snd().snd_switch);
mm_sound_effect pannedSound = currentTheme == 4 ? snd().snd_saturn_launch : snd().snd_switch;
pannedSound.panning = 76;

mmEffectEx(&pannedSound);
titleDisplayLength = 0;
rotatePage(-1);
}
Expand Down