Paper Mario DX
Paper Mario (N64) modding
 
Loading...
Searching...
No Matches
public.h File Reference

Go to the source code of this file.

Functions

void func_80055050 (ALHeap *heap)
 
void func_80055068 (u32 arg0)
 
void func_8005513C (u32 arg0)
 
void snd_start_sound (s32 soundID, u8 volume, u8 pan)
 
void snd_start_sound_with_shift (s32 soundID, u8 volume, u8 pan, s16 pitchShift)
 
void snd_adjust_sound (s32 soundID, u8 volume, u8 pan)
 
void snd_adjust_sound_with_shift (s32 soundID, u8 volume, u8 pan, s16 pitchShift)
 
void snd_stop_sound (s32 soundID)
 
void snd_reset (void)
 
void snd_start_sound_raw (s32 soundID, s16 volume, s16 pitchShift, s32 pan)
 
AuResult snd_load_ambient (s32 arg0)
 
AuResult snd_ambient_play (s32 arg0, s32 arg1)
 
AuResult snd_ambient_stop_quick (s32 arg0)
 
AuResult snd_ambient_stop_slow (s32 arg0, s32 arg1)
 
AuResult snd_ambient_pause (s32 arg0, s32 arg1)
 
AuResult snd_ambient_resume (s32 arg0, s32 arg1)
 
AuResult snd_ambient_is_stopped (s32 arg0)
 
AuResult snd_ambient_mute (s32 arg0, s32 arg1)
 
AuResult snd_ambient_set_volume (s32 arg0, s32 arg1, s32 arg2)
 
AuResult snd_ambient_disable (s32 arg0)
 
AuResult snd_ambient_enable (s32 arg0)
 
void snd_ambient_80055760 (s32 arg0)
 
AuResult snd_ambient_stop_all (s32 arg0)
 
AuResult snd_ambient_play_only (s32 arg0)
 
AuResult au_song_load (s32 songID, s32 playerIndex)
 
AuResult au_song_start (s32 songName)
 
AuResult au_song_start_variation (s32 songName, s32 variation)
 
AuResult au_song_stop (s32 songName)
 
void au_stop_songs (void)
 
AuResult au_song_is_playing (s32 songName)
 
AuResult snd_set_song_variation_fade (s32 songName, s32 variation, s32 fadeInTime, s32 startVolume, s32 endVolume)
 
AuResult snd_set_song_fade (s32 songName, s32 fadeInTime, s32 startVolume, s32 endVolume)
 
AuResult snd_set_song_variation_fade_time (s32 songName, s32 fadeTime, s32 variation)
 
AuResult func_80055AF0 (s32 songName)
 
AuResult func_80055B28 (s32 songName)
 
AuResult func_80055B80 (s32 songName)
 
AuResult func_80055BB8 (s32 songName, s32 fadeTime)
 
AuResult func_80055BF0 (s32 songName)
 
AuResult func_80055C2C (s32 songName)
 
AuResult func_80055C64 (s32 songName)
 
AuResult func_80055C94 (s32 songName)
 
AuResult snd_set_song_variation (s32 songName, s32 variation)
 
AuResult snd_song_set_playback_rate (s32 songName, f32 arg1)
 
AuResult snd_song_set_detune (s32 songName, s32 arg1)
 
AuResult snd_song_set_track_volumes (s32 songName, MusicTrackVols arg1)
 
AuResult snd_song_clear_track_volumes (s32 songName, MusicTrackVols arg1)
 
AuResult snd_song_set_track_vol_mute (s32 arg0, s32 arg1)
 
AuResult snd_song_set_track_vol_quiet (s32 arg0, s32 arg1)
 
AuResult snd_song_set_track_vol_full (s32 arg0, s32 arg1)
 
void bgm_set_proximity_mix_far (s32 songName, s32 mix)
 
void bgm_set_proximity_mix_near (s32 songName, s32 mix)
 
void bgm_set_proximity_mix_full (s32 songName, s32 mix)
 
void bgm_poll_music_events (u32 **arg0, s32 *arg1)
 
void bgm_flush_music_events (void)
 
void bgm_trigger_music_event (s32 arg0, s32 arg1, s32 arg2)
 
void bgm_clear_music_events (void)
 
void audio_set_stereo (void)
 
void audio_set_mono (void)
 
void func_800561A4 (s32 arg0)
 
void func_800561C4 (s32 arg0)
 
void func_800561E4 (s32 arg0)
 
void enable_sounds (void)
 
void disable_sounds (void)
 
void sfx_reset_door_sounds (void)
 
void sfx_clear_sounds (void)
 
void sfx_clear_env_sounds (s16 playSounds)
 
void sfx_update_env_sound_params (void)
 
void sfx_set_reverb_mode (s32 arg0)
 
s32 sfx_get_reverb_mode (void)
 
void sfx_stop_env_sounds (void)
 
void sfx_play_sound_looping (s32 soundId, u8 volume, u8 pan, s16 pitchShift)
 
void sfx_register_looping_sound_at_position (s32 soundID, s32 flags, f32 x, f32 y, f32 z)
 
s32 sfx_adjust_env_sound_pos (s32 soundID, s32 sourceFlags, f32 x, f32 y, f32 z)
 
void snd_stop_tracking_env_sound_pos (s32 soundID, s32 keepPlaying)
 
void sfx_play_sound_with_params (s32 soundID, u8 volume, u8 pan, s16 pitchShift)
 
void sfx_adjust_env_sound_params (s32 soundID, u8 volume, u8 pan, s16 pitchShift)
 
void sfx_stop_sound (s32 soundID)
 
void sfx_play_sound (s32 soundID)
 
void sfx_play_sound_at_player (s32 soundID, s32 arg1)
 
void sfx_play_sound_at_npc (s32 soundID, s32 arg1, s32 npcID)
 
void sfx_play_sound_at_position (s32 soundID, s32 flags, f32 posX, f32 posY, f32 posZ)
 
void sfx_get_spatialized_sound_params (f32 x, f32 y, f32 z, s16 *volume, s16 *pan, s32 flags)
 
void sfx_compute_spatialized_sound_params_ignore_depth (f32 x, f32 y, f32 z, s16 *volume, s16 *pan)
 
void sfx_compute_spatialized_sound_params_with_depth (f32 x, f32 y, f32 z, s16 *volume, s16 *pan)
 
void sfx_compute_spatialized_sound_params_full (f32 x, f32 y, f32 z, s16 *volume, s16 *pan, s32 flags)
 

Function Documentation

◆ func_80055050()

void func_80055050 ( ALHeap * heap)

Definition at line 103 of file 30450.c.

103 {
104 D_80078DB4 = 1;
106}
s32 PreventBGMPlayerUpdate
Definition 30450.c:6
u16 D_80078DB4
Definition 30450.c:7

Referenced by au_engine_init().

◆ func_80055068()

void func_80055068 ( u32 arg0)

Definition at line 108 of file 30450.c.

108 {
109 u16 temp_a0 = D_80078DB4;
110 u32 temp_v1 = arg0 & 0xF;
111
112 if (temp_a0 == 1) {
113 switch (temp_v1) {
114 case 2:
115 case 3:
116 break;
117 case 4:
118 snd_start_sound_with_shift(arg0 >> 4, 0, 0, 0);
119 break;
120 case 1:
121 if (temp_v1 == 1) {
122 s32 filename = au_song_load((arg0 >> 4) & 0xFF, 0);
123
124 if (filename > ASCII_TO_U32('0', ' ', ' ', '\0')) {
125 au_song_start_variation(filename, (arg0 >> 0xC) & 3);
126 }
127 }
128 break;
129 }
130 }
131}
void snd_start_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition 30450.c:199
AuResult au_song_load(s32 songID, s32 playerIndex)
Definition 30450.c:436
AuResult au_song_start_variation(s32 songName, s32 variation)
Definition 30450.c:466
#define ASCII_TO_U32(a, b, c, d)
Definition macros.h:179

◆ func_8005513C()

void func_8005513C ( u32 arg0)

Definition at line 146 of file 30450.c.

146 {
147 BGMPlayer* player = NULL;
148 u32 playerSwitch = arg0 & 0xF;
149
150 if (playerSwitch != 0) {
151 if (playerSwitch == 1) {
152 player = gBGMPlayerA;
153 } else if (playerSwitch == 2) {
154 player = gBGMPlayerB;
155 }
156
157 if (player != NULL) {
158 u32 temp;
159
160 if (player->unk_258 < 8) {
161 temp = player->unk_25A;
162
163 player->unk_238[temp] = arg0 >> 4;
164
165 temp++;
166 if (temp >= 8) {
167 temp = 0;
168 }
169 player->unk_25A = temp;
170
171 player->unk_258++;
172 } else {
173 temp = player->unk_25B + 1;
174
175 if (temp > 99) {
176 temp = 99;
177 }
178 player->unk_25B = temp;
179 }
180 }
181 }
182}
BGMPlayer * gBGMPlayerB
u8 unk_25B
Definition audio.h:1080
u8 unk_25A
Definition audio.h:1079
u8 unk_258
Definition audio.h:1077
BGMPlayer * gBGMPlayerA
s32 unk_238[8]
Definition audio.h:1076

◆ snd_start_sound()

void snd_start_sound ( s32 soundID,
u8 volume,
u8 pan )

Definition at line 184 of file 30450.c.

184 {
185 SoundManager* soundManager = gSoundManager;
186 s16 vol = volume << 8;
187
188 if (vol != 0) {
189 vol |= 0xFF;
190 }
191
192 if (pan > 0x7F) {
193 pan = 0x7F;
194 }
195
196 au_sfx_enqueue_event(soundManager, soundID, vol, 0, pan);
197}
SoundManager * gSoundManager
void au_sfx_enqueue_event(SoundManager *manager, u32 soundID, s16 volume, s16 pitchShift, u8 pan)
Definition sfx_player.c:543

◆ snd_start_sound_with_shift()

void snd_start_sound_with_shift ( s32 soundID,
u8 volume,
u8 pan,
s16 pitchShift )

Definition at line 199 of file 30450.c.

199 {
200 SoundManager* soundManager = gSoundManager;
201 s16 vol = volume << 8;
202
203 if (vol != 0) {
204 vol |= 0xFF;
205 }
206
207 if (pan > 0x7F) {
208 pan = 0x7F;
209 }
210
211 if (pitchShift > 2400) {
212 pitchShift = 2400;
213 } else if (pitchShift < -2400) {
214 pitchShift = -2400;
215 }
216
217 au_sfx_enqueue_event(soundManager, soundID, vol, pitchShift, pan);
218}

Referenced by func_80055068(), sfx_clear_env_sounds(), sfx_play_sound_looping(), and sfx_play_sound_with_params().

◆ snd_adjust_sound()

void snd_adjust_sound ( s32 soundID,
u8 volume,
u8 pan )

Definition at line 220 of file 30450.c.

220 {
221 SoundManager* soundManager = gSoundManager;
222 s16 vol = volume << 8;
223
224 if (vol != 0) {
225 vol |= 0xFF;
226 }
227
228 if (pan > 0x7F) {
229 pan = 0x7F;
230 }
231
232 au_sfx_enqueue_event(soundManager, soundID | SOUND_ID_ADJUST, vol, 0, pan);
233}
@ SOUND_ID_ADJUST
Definition enums.h:529

◆ snd_adjust_sound_with_shift()

void snd_adjust_sound_with_shift ( s32 soundID,
u8 volume,
u8 pan,
s16 pitchShift )

Definition at line 235 of file 30450.c.

235 {
236 SoundManager* soundManager = gSoundManager;
237 s16 vol = volume << 8;
238
239 if (vol != 0) {
240 vol |= 0xFF;
241 }
242
243 if (pan > 0x7F) {
244 pan = 0x7F;
245 }
246
247 if (pitchShift > 2400) {
248 pitchShift = 2400;
249 } else if (pitchShift < -2400) {
250 pitchShift = -2400;
251 }
252
253 au_sfx_enqueue_event(soundManager, soundID | SOUND_ID_ADJUST, vol, pitchShift, pan);
254}

Referenced by sfx_adjust_env_sound_params(), and sfx_update_env_sound_params().

◆ snd_stop_sound()

void snd_stop_sound ( s32 soundID)

Definition at line 256 of file 30450.c.

256 {
257 SoundManager* soundManager = gSoundManager;
258
259 au_sfx_enqueue_event(soundManager, soundID | SOUND_ID_STOP, 0, 0, 0);
260}
@ SOUND_ID_STOP
Definition enums.h:526

Referenced by action_update_sliding(), sfx_stop_env_sounds(), sfx_stop_sound(), and snd_stop_tracking_env_sound_pos().

◆ snd_reset()

void snd_reset ( void )

Definition at line 262 of file 30450.c.

262 {
264}
s32 resetPending
Definition audio.h:692

◆ snd_start_sound_raw()

void snd_start_sound_raw ( s32 soundID,
s16 volume,
s16 pitchShift,
s32 pan )

Definition at line 266 of file 30450.c.

266 {
267 SoundManager* soundManager = gSoundManager;
268
269 au_sfx_enqueue_event(soundManager, soundID, volume, pitchShift, pan);
270}

◆ snd_load_ambient()

AuResult snd_load_ambient ( s32 arg0)

Definition at line 272 of file 30450.c.

272 {
273 return au_ambient_load(ambSoundID);
274}
AuResult au_ambient_load(u32 ambSoundID)

Referenced by update_ambient_sounds().

◆ snd_ambient_play()

AuResult snd_ambient_play ( s32 arg0,
s32 arg1 )

Definition at line 276 of file 30450.c.

276 {
277 AuResult status = au_amb_check_player_index(index);
278
279 if (status != AU_RESULT_OK) {
280 return status;
281 }
282 return au_amb_start(index, fadeInTime);
283}
AuResult au_amb_check_player_index(u32 index)
Definition 2BF90.c:60
AuResult au_amb_start(s32 index, s32 time)
Definition 2BF90.c:83
AuResult
Definition enums.h:1755
@ AU_RESULT_OK
Definition enums.h:1756

Referenced by snd_ambient_80055760(), and update_ambient_sounds().

◆ snd_ambient_stop_quick()

AuResult snd_ambient_stop_quick ( s32 arg0)

Definition at line 285 of file 30450.c.

285 {
286 AuResult status = au_amb_check_player_index(index);
287
288 if (status == AU_RESULT_OK) {
289 au_amb_stop_quick(index);
290 }
291
292 return status;
293}
void au_amb_stop_quick(s32 index)
Definition 2BF90.c:157

Referenced by play_ambient_sounds(), snd_ambient_stop_all(), and update_ambient_sounds().

◆ snd_ambient_stop_slow()

AuResult snd_ambient_stop_slow ( s32 arg0,
s32 arg1 )

Definition at line 295 of file 30450.c.

295 {
296 AuResult status = au_amb_check_player_index(index);
297
298 if (status == AU_RESULT_OK) {
299 au_amb_stop_slow(index, fadeOutTime);
300 }
301
302 return status;
303}
void au_amb_stop_slow(s32 index, s32 time)
Definition 2BF90.c:172

Referenced by snd_ambient_stop_all(), and update_ambient_sounds().

◆ snd_ambient_pause()

AuResult snd_ambient_pause ( s32 arg0,
s32 arg1 )

Definition at line 305 of file 30450.c.

305 {
306 AuResult status = au_amb_check_player_index(index);
307
308 if (status == AU_RESULT_OK) {
309 au_amb_pause(index, fadeOutTime);
310 }
311
312 return status;
313}
void au_amb_pause(s32 index, s32 time)
Definition 2BF90.c:126

Referenced by bgm_push_battle_song().

◆ snd_ambient_resume()

AuResult snd_ambient_resume ( s32 arg0,
s32 arg1 )

Definition at line 315 of file 30450.c.

315 {
316 AuResult status = au_amb_check_player_index(index);
317
318 if (status == AU_RESULT_OK) {
319 au_amb_resume(index, fadeInTime);
320 }
321
322 return status;
323}
void au_amb_resume(s32 index, s32 time)
Definition 2BF90.c:141

Referenced by bgm_pop_battle_song().

◆ snd_ambient_is_stopped()

AuResult snd_ambient_is_stopped ( s32 arg0)

Definition at line 325 of file 30450.c.

325 {
326 AuResult status = au_amb_check_player_index(index);
327
328 if (status != AU_RESULT_OK) {
329 return status;
330 }
331 return au_amb_is_stopped(index);
332}
AuResult au_amb_is_stopped(s32 index)
Definition 2BF90.c:206

Referenced by update_ambient_sounds().

◆ snd_ambient_mute()

AuResult snd_ambient_mute ( s32 arg0,
s32 arg1 )

Definition at line 335 of file 30450.c.

335 {
336 AuResult status = au_amb_check_player_index(index);
337
338 if (status == AU_RESULT_OK) {
339 au_amb_load_tracks_fade(index, arg1);
340 }
341
342 return status;
343}
void au_amb_load_tracks_fade(s32 arg0, s32 arg1)
Definition 2BF90.c:68

◆ snd_ambient_set_volume()

AuResult snd_ambient_set_volume ( s32 arg0,
s32 arg1,
s32 arg2 )

Definition at line 345 of file 30450.c.

345 {
346 AuResult status = au_amb_check_player_index(index);
347
348 if (status == AU_RESULT_OK) {
349 au_amb_set_volume(index, time, volume);
350 }
351
352 return status;
353}
void au_amb_set_volume(s32 index, s32 time, s32 volume)
Definition 2BF90.c:187

◆ snd_ambient_disable()

AuResult snd_ambient_disable ( s32 arg0)

Definition at line 355 of file 30450.c.

355 {
356 AuResult status = au_amb_check_player_index(index);
357
358 if (status == AU_RESULT_OK) {
359 au_amb_set_disabled(index, TRUE);
360 }
361
362 return status;
363}
void au_amb_set_disabled(s32 index, s32 disable)
Definition 2BF90.c:72

Referenced by snd_ambient_play_only().

◆ snd_ambient_enable()

AuResult snd_ambient_enable ( s32 arg0)

Definition at line 365 of file 30450.c.

365 {
366 AuResult status = au_amb_check_player_index(index);
367
368 if (status == AU_RESULT_OK) {
369 au_amb_set_disabled(index, FALSE);
370 }
371
372 return status;
373}

Referenced by snd_ambient_play_only().

◆ snd_ambient_80055760()

void snd_ambient_80055760 ( s32 arg0)

Definition at line 376 of file 30450.c.

376 {
377 u32 i;
378 s32 lim = 4;
379
381
382 for (i = 0; i < lim; i++) {
383 if (snd_ambient_play(i, 0) != AU_RESULT_OK) {
384 return;
385 }
386 }
387
389}
u16 AuAmbiencePlayOnlyIndex
Definition 30450.c:8
AuResult snd_ambient_play_only(s32 index)
Definition 30450.c:409
AuResult snd_ambient_play(s32 index, s32 fadeInTime)
Definition 30450.c:276

◆ snd_ambient_stop_all()

AuResult snd_ambient_stop_all ( s32 arg0)

Definition at line 391 of file 30450.c.

391 {
392 AuResult status = AU_RESULT_OK;
393 s32 lim = 4;
394 u32 i;
395
396 for (i = 0; i < lim; i++) {
397 if (i == AuAmbiencePlayOnlyIndex) {
398 status = snd_ambient_stop_slow(i, time);
399 } else {
400 status = snd_ambient_stop_quick(i);
401 }
402 if (status != AU_RESULT_OK) {
403 break;
404 }
405 }
406 return status;
407}
AuResult snd_ambient_stop_slow(s32 index, s32 fadeOutTime)
Definition 30450.c:295
AuResult snd_ambient_stop_quick(s32 index)
Definition 30450.c:285

◆ snd_ambient_play_only()

AuResult snd_ambient_play_only ( s32 arg0)

Definition at line 409 of file 30450.c.

409 {
410 AuResult status = AU_RESULT_OK;
411 s32 lim = 4;
412
413 if (index != AuAmbiencePlayOnlyIndex) {
414 u32 i;
415
416 for (i = 0; i < lim; i++) {
417 if (i == index) {
418 status = snd_ambient_enable(i);
419 } else {
420 status = snd_ambient_disable(i); // mute
421 }
422
423 if (status != AU_RESULT_OK) {
424 break;
425 }
426 }
427
428 if (status == AU_RESULT_OK) {
430 }
431 }
432
433 return status;
434}
AuResult snd_ambient_disable(s32 index)
Definition 30450.c:355
AuResult snd_ambient_enable(s32 index)
Definition 30450.c:365

Referenced by snd_ambient_80055760().

◆ au_song_load()

AuResult au_song_load ( s32 songID,
s32 playerIndex )

Definition at line 436 of file 30450.c.

436 {
437 BGMHeader* bgmFile;
438 BGMPlayer* player;
439
440 au_get_bgm_player_and_file(playerIndex, &bgmFile, &player);
441
442 if (bgmFile != NULL) {
443 return au_load_song_files(songID, bgmFile, player);
444 } else {
446 }
447}
void au_get_bgm_player_and_file(u32 playerIndex, BGMHeader **outFile, BGMPlayer **outPlayer)
AuResult au_load_song_files(u32 songID, BGMHeader *bgmFile, BGMPlayer *player)
@ AU_ERROR_NULL_SONG_NAME
Definition enums.h:1761

Referenced by bgm_update_music_settings(), and func_80055068().

◆ au_song_start()

AuResult au_song_start ( s32 songName)

Definition at line 449 of file 30450.c.

449 {
450 AuResult status;
452
454 s.songName = songName;
455 s.duration = 0;
456 s.startVolume = 127;
457 s.finalVolume = 127;
458 s.variation = 0;
459 s.unk14 = 0;
460 status = au_bgm_dispatch_player_event(&s);
462
463 return status;
464}
AuResult au_bgm_dispatch_player_event(SongUpdateEvent *event)

◆ au_song_start_variation()

AuResult au_song_start_variation ( s32 songName,
s32 variation )

Definition at line 466 of file 30450.c.

466 {
467 AuResult status;
469
471 s.songName = songName;
472 s.duration = 0;
473 s.startVolume = 127;
474 s.finalVolume = 127;
475 s.variation = variation;
476 s.unk14 = 0;
477 status = au_bgm_dispatch_player_event(&s);
479
480 return status;
481}

Referenced by bgm_update_music_settings(), and func_80055068().

◆ au_song_stop()

AuResult au_song_stop ( s32 songName)

Definition at line 483 of file 30450.c.

483 {
484 return au_bgm_stop_song(songName);
485}
AuResult au_bgm_stop_song(s32 songName)

Referenced by _bgm_set_song(), bgm_update_music_settings(), and func_8014A964().

◆ au_stop_songs()

void au_stop_songs ( void )

Definition at line 487 of file 30450.c.

487 {
489}
void au_bgm_stop_all(void)

◆ au_song_is_playing()

AuResult au_song_is_playing ( s32 songName)

Definition at line 491 of file 30450.c.

491 {
492 return au_bgm_is_song_playing(songName);
493}
AuResult au_bgm_is_song_playing(s32 songName)

Referenced by bgm_update_music_settings(), and func_8014AD40().

◆ snd_set_song_variation_fade()

AuResult snd_set_song_variation_fade ( s32 songName,
s32 variation,
s32 fadeInTime,
s32 startVolume,
s32 endVolume )

Definition at line 495 of file 30450.c.

495 {
496 AuResult status;
498
500 s.songName = songName;
501 s.duration = fadeInTime;
502 s.startVolume = startVolume;
503 s.finalVolume = endVolume;
504 s.variation = variation;
505 s.unk14 = 0;
506 status = au_bgm_dispatch_player_event(&s);
508
509 return status;
510}

Referenced by bgm_update_music_settings().

◆ snd_set_song_fade()

AuResult snd_set_song_fade ( s32 songName,
s32 fadeInTime,
s32 startVolume,
s32 endVolume )

Definition at line 512 of file 30450.c.

512 {
513 AuResult status;
515
517 s.songName = songName;
518 s.duration = fadeInTime;
519 s.startVolume = startVolume;
520 s.finalVolume = endVolume;
521 s.variation = 0;
522 s.unk14 = 0;
523 status = au_bgm_dispatch_player_event(&s);
525
526 return status;
527}

◆ snd_set_song_variation_fade_time()

AuResult snd_set_song_variation_fade_time ( s32 songName,
s32 fadeTime,
s32 variation )

Definition at line 529 of file 30450.c.

529 {
531 s.songName = songName;
532 s.duration = fadeTime;
533 s.startVolume = 0;
534 s.finalVolume = 0;
535 s.variation = variation;
536 s.unk14 = 0;
537 return func_8004DB4C(&s);
538}
AuResult func_8004DB4C(SongUpdateEvent *s)

Referenced by bgm_update_music_settings().

◆ func_80055AF0()

AuResult func_80055AF0 ( s32 songName)

Definition at line 540 of file 30450.c.

540 {
542 s.songName = songName;
543 s.duration = 0;
544 s.startVolume = 0;
545 s.finalVolume = 0;
546 s.variation = 0;
547 s.unk14 = 0;
548 return func_8004DCB8(&s, 0);
549}
AuResult func_8004DCB8(SongUpdateEvent *update, s32 clearChanged)

Referenced by bgm_update_music_settings().

◆ func_80055B28()

AuResult func_80055B28 ( s32 songName)

Definition at line 551 of file 30450.c.

551 {
552 AuResult status;
554
556 s.songName = songName;
557 s.duration = 2000;
558 s.startVolume = 1;
559 s.finalVolume = 127;
560 s.variation = 0;
561 s.unk14 = 0;
562 status = func_8004DE2C(&s);
564
565 return status;
566}
AuResult func_8004DE2C(SongUpdateEvent *update)

Referenced by bgm_update_music_settings().

◆ func_80055B80()

AuResult func_80055B80 ( s32 songName)

Definition at line 568 of file 30450.c.

568 {
570 s.songName = songName;
571 s.duration = 0;
572 s.startVolume = 0;
573 s.finalVolume = 0;
574 s.variation = 0;
575 s.unk14 = 0;
576 return func_8004DCB8(&s, 1);
577}

Referenced by _bgm_set_song().

◆ func_80055BB8()

AuResult func_80055BB8 ( s32 songName,
s32 fadeTime )

Definition at line 579 of file 30450.c.

579 {
581 s.songName = songName;
582 s.duration = fadeTime;
583 s.startVolume = 0;
584 s.finalVolume = 0;
585 s.variation = 0;
586 s.unk14 = 1;
587 return func_8004DB4C(&s);
588}

Referenced by bgm_update_music_settings().

◆ func_80055BF0()

AuResult func_80055BF0 ( s32 songName)

Definition at line 590 of file 30450.c.

590 {
592 s.songName = songName;
593 s.duration = 0;
594 s.startVolume = 0;
595 s.finalVolume = 0;
596 s.variation = 0;
597 s.unk14 = 1;
598 return func_8004DCB8(&s, 0);
599}

◆ func_80055C2C()

AuResult func_80055C2C ( s32 songName)

Definition at line 601 of file 30450.c.

601 {
603 s.songName = songName;
604 s.duration = 0;
605 s.startVolume = 0;
606 s.finalVolume = 0;
607 s.variation = 0;
608 s.unk14 = 1;
609 return func_8004DE2C(&s);
610}

◆ func_80055C64()

AuResult func_80055C64 ( s32 songName)

Definition at line 612 of file 30450.c.

612 {
614 s.songName = songName;
615 s.duration = 500;
616 s.finalVolume = 0x2000;
617 return func_8004E0F4(&s);
618}
AuResult func_8004E0F4(SongUpdateEvent *update)

◆ func_80055C94()

AuResult func_80055C94 ( s32 songName)

Definition at line 620 of file 30450.c.

620 {
622 s.songName = songName;
623 s.duration = 500;
624 s.finalVolume = 0x7FFF;
625 return func_8004E0F4(&s);
626}

◆ snd_set_song_variation()

AuResult snd_set_song_variation ( s32 songName,
s32 variation )

Definition at line 628 of file 30450.c.

628 {
630 s.songName = songName;
631 s.variation = variation;
632 return func_80050970(&s);
633}
AuResult func_80050970(SongUpdateEvent *update)

Referenced by bgm_set_variation().

◆ snd_song_set_playback_rate()

AuResult snd_song_set_playback_rate ( s32 songName,
f32 arg1 )

Definition at line 656 of file 30450.c.

656 {
657 BGMPlayer* bgmPlayer;
658 BGMHeader* bgmFile;
659 AuResult status;
660
661 status = snd_song_get_playing_info(songName, &bgmFile, &bgmPlayer);
662
663 if (status == AU_RESULT_OK) {
664 au_bgm_set_playback_rate(bgmPlayer, rate);
665 }
666
667 return status;
668}
void au_bgm_set_playback_rate(BGMPlayer *player, f32 rate)
AuResult snd_song_get_playing_info(s32 songName, BGMHeader **outFile, BGMPlayer **outPlayer)
Definition 30450.c:636

◆ snd_song_set_detune()

AuResult snd_song_set_detune ( s32 songName,
s32 arg1 )

Definition at line 670 of file 30450.c.

670 {
671 BGMPlayer* bgmPlayer;
672 BGMHeader* bgmFile;
673 AuResult status;
674
675 status = snd_song_get_playing_info(songName, &bgmFile, &bgmPlayer);
676
677 if (status == AU_RESULT_OK) {
678 au_bgm_player_set_detune(bgmPlayer, detune);
679 }
680
681 return status;
682}
void au_bgm_player_set_detune(BGMPlayer *player, s32 detune)

◆ snd_song_set_track_volumes()

AuResult snd_song_set_track_volumes ( s32 songName,
MusicTrackVols arg1 )

Definition at line 684 of file 30450.c.

684 {
685 BGMPlayer* bgmPlayer;
686 BGMHeader* bgmFile;
687 AuResult status;
688
689 status = snd_song_get_playing_info(songName, &bgmFile, &bgmPlayer);
690
691 if (status == AU_RESULT_OK) {
692 u8* trackVols = snd_song_get_track_volumes_set(trackVolSet);
693
694 if (trackVols != NULL) {
695 au_bgm_set_track_volumes(bgmPlayer, trackVols, TRUE);
696 } else {
697 status = AU_ERROR_11;
698 }
699 }
700
701 return status;
702}
void au_bgm_set_track_volumes(BGMPlayer *player, u8 *trackVols, s32 mode)
@ AU_ERROR_11
Definition enums.h:1766

Referenced by bgm_set_track_volumes().

◆ snd_song_clear_track_volumes()

AuResult snd_song_clear_track_volumes ( s32 songName,
MusicTrackVols arg1 )

Definition at line 704 of file 30450.c.

704 {
705 BGMPlayer* bgmPlayer;
706 BGMHeader* bgmFile;
707 AuResult status;
708
709 status = snd_song_get_playing_info(songName, &bgmFile, &bgmPlayer);
710
711 if (status == AU_RESULT_OK) {
712 u8* trackVols = snd_song_get_track_volumes_set(trackVolSet);
713
714 if (trackVols != NULL) {
715 au_bgm_set_track_volumes(bgmPlayer, trackVols, FALSE);
716 } else {
717 status = AU_ERROR_11;
718 }
719 }
720
721 return status;
722}

Referenced by bgm_clear_track_volumes().

◆ snd_song_set_track_vol_mute()

AuResult snd_song_set_track_vol_mute ( s32 arg0,
s32 arg1 )

Definition at line 777 of file 30450.c.

777 {
778 return snd_song_change_track_volume(songName, trackIdx, 0);
779}

◆ snd_song_set_track_vol_quiet()

AuResult snd_song_set_track_vol_quiet ( s32 arg0,
s32 arg1 )

Definition at line 781 of file 30450.c.

781 {
782 return snd_song_change_track_volume(songName, trackIdx, 0x3F);
783}

◆ snd_song_set_track_vol_full()

AuResult snd_song_set_track_vol_full ( s32 arg0,
s32 arg1 )

Definition at line 785 of file 30450.c.

785 {
786 return snd_song_change_track_volume(songName, trackIdx, 0x7F);
787}

◆ bgm_set_proximity_mix_far()

void bgm_set_proximity_mix_far ( s32 songName,
s32 mix )

Definition at line 789 of file 30450.c.

789 {
790 au_bgm_set_proximity_mix(songName, (u8)mix);
791}
void au_bgm_set_proximity_mix(s32 songName, u32 mix)

Referenced by bgm_adjust_proximity().

◆ bgm_set_proximity_mix_near()

void bgm_set_proximity_mix_near ( s32 songName,
s32 mix )

Definition at line 793 of file 30450.c.

793 {
794 au_bgm_set_proximity_mix(songName, (u8)mix | 0x57000000);
795}

Referenced by bgm_adjust_proximity().

◆ bgm_set_proximity_mix_full()

void bgm_set_proximity_mix_full ( s32 songName,
s32 mix )

Definition at line 797 of file 30450.c.

797 {
798 au_bgm_set_proximity_mix(songName, (u8)mix | 0x7F000000);
799}

Referenced by bgm_adjust_proximity().

◆ bgm_poll_music_events()

void bgm_poll_music_events ( u32 ** arg0,
s32 * arg1 )

Definition at line 801 of file 30450.c.

801 {
802 AuGlobals* globals = gSoundGlobals;
803
804 *musicEvents = globals->musicEventQueue;
805 *count = globals->musicEventQueueCount;
806}
MusicEventTrigger * musicEventQueue
Definition audio.h:921
AuGlobals * gSoundGlobals
u32 musicEventQueueCount
Definition audio.h:922

◆ bgm_flush_music_events()

void bgm_flush_music_events ( void )

Definition at line 808 of file 30450.c.

808 {
810}
s32 flushMusicEventQueue
Definition audio.h:923

◆ bgm_trigger_music_event()

void bgm_trigger_music_event ( s32 arg0,
s32 arg1,
s32 arg2 )

Definition at line 812 of file 30450.c.

812 {
813 AuGlobals* globals = gSoundGlobals;
814
815 if (globals->musicEventQueueCount < 16) {
816 *globals->musicEventQueuePos++ = ((playerID << 0x1C) + ((trackIndex & 0xF) << 0x18) + eventInfo);
817 globals->musicEventQueueCount++;
818 }
819}
MusicEventTrigger * musicEventQueuePos
Definition audio.h:920

Referenced by au_BGMCmd_FD_EventTrigger().

◆ bgm_clear_music_events()

void bgm_clear_music_events ( void )

Definition at line 821 of file 30450.c.

821 {
822 AuGlobals* globals = gSoundGlobals;
823 s32* buf = globals->musicEventQueue;
824 s32 i = 15;
825
826 do {
827 *buf++ = 0;
828 } while (i-- != 0);
829
830 globals->musicEventQueueCount = 0;
831 globals->flushMusicEventQueue = FALSE;
832 globals->musicEventQueuePos = globals->musicEventQueue;
833}

Referenced by au_engine_init(), and au_update_players_main().

◆ audio_set_stereo()

void audio_set_stereo ( void )

Definition at line 839 of file 30450.c.

839 {
840 func_80056D5C(1);
841 func_80054DA8(0);
842}
void func_80054DA8(u32 bMonoSound)
void func_80056D5C(u8 bStereoSound)
Definition 31650.c:262

Referenced by filemenu_main_handle_input(), and state_step_startup().

◆ audio_set_mono()

void audio_set_mono ( void )

Definition at line 844 of file 30450.c.

844 {
845 func_80056D5C(0);
846 func_80054DA8(1);
847}

Referenced by filemenu_main_handle_input(), and state_step_startup().

◆ func_800561A4()

void func_800561A4 ( s32 arg0)

Definition at line 849 of file 30450.c.

849 {
850 func_80054CE0(1, arg0);
851}
void func_80054CE0(s32 arg0, u32 idx)

Referenced by bgm_reset_sequence_players(), and bgm_update_volume().

◆ func_800561C4()

void func_800561C4 ( s32 arg0)

Definition at line 853 of file 30450.c.

853 {
854 func_80054CE0(0x10, arg0);
855}

◆ func_800561E4()

void func_800561E4 ( s32 arg0)

Definition at line 857 of file 30450.c.

857 {
858 func_80054D74(0x10, arg0);
859}
s32 func_80054D74(s32 arg0, s32 arg1)

Referenced by sfx_set_reverb_mode().

◆ enable_sounds()

void enable_sounds ( void )

Definition at line 861 of file 30450.c.

861 {
863}
@ SND_MANAGER_STATE_ENABLED
Definition audio.h:237
void au_sfx_set_state(SoundManager *manager, s32 arg1)
Definition sfx_player.c:684

Referenced by state_step_demo().

◆ disable_sounds()

void disable_sounds ( void )

Definition at line 865 of file 30450.c.

865 {
867}
@ SND_MANAGER_STATE_DISABLED
Definition audio.h:238

Referenced by state_init_demo().

◆ sfx_reset_door_sounds()

void sfx_reset_door_sounds ( void )

Definition at line 299 of file sfx.c.

299 {
302}
@ DOOR_SOUNDS_BASIC
Definition enums.h:2407
u16 gCurrentDoorSounds
Definition sfx.c:6
u16 gCurrentRoomDoorSounds
Definition sfx.c:7

Referenced by load_map_by_IDs(), and sfx_clear_sounds().

◆ sfx_clear_sounds()

void sfx_clear_sounds ( void )

Definition at line 304 of file sfx.c.

304 {
305 bzero(&wEnvSounds, sizeof(wEnvSounds));
306 bzero(&bEnvSounds, sizeof(bEnvSounds));
310}
void sfx_set_reverb_mode(s32 mode)
Definition sfx.c:352
void sfx_reset_door_sounds(void)
Definition sfx.c:299
BSS SoundInstance wEnvSounds[10]
Definition sfx.c:212
BSS SoundInstance bEnvSounds[10]
Definition sfx.c:213
BSS SoundInstance * gCurrentEnvSounds
Definition sfx.c:214

Referenced by load_engine_data(), and state_step_startup().

◆ sfx_clear_env_sounds()

void sfx_clear_env_sounds ( s16 playSounds)

Definition at line 313 of file sfx.c.

313 {
316 } else {
318 }
319
320 if (playSounds) {
322 s32 i;
323
324 for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) {
325 if (sound->flags & SOUND_INSTANCE_FLAG_ACTIVE) {
326 snd_start_sound_with_shift(sound->soundID, sound->volume, sound->pan, sound->pitchShift);
327 }
328 }
329 } else {
331 }
332}
s16 pitchShift
Definition audio.h:702
@ SOUND_INSTANCE_FLAG_ACTIVE
Definition audio.h:242
s32 soundID
Definition audio.h:698
@ CONTEXT_WORLD
Definition enums.h:3529
#define MAX_SOUND_INSTANCES
Definition sfx.c:4
GameStatus * gGameStatusPtr
Definition main_loop.c:32

Referenced by load_map_by_IDs(), state_step_battle(), state_step_end_battle(), state_step_pause(), and state_step_unpause().

◆ sfx_update_env_sound_params()

void sfx_update_env_sound_params ( void )

Definition at line 334 of file sfx.c.

334 {
336 u16 volume;
337 u16 pan;
338 s32 i;
339
340 for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) {
341 if (sound->flags & SOUND_INSTANCE_FLAG_ACTIVE) {
343 sfx_get_spatialized_sound_params(sound->pos.x, sound->pos.y, sound->pos.z, &volume, &pan, sound->sourceFlags);
344 sound->volume = volume;
345 sound->pan = pan;
346 }
347 snd_adjust_sound_with_shift(sound->soundID, sound->volume, sound->pan, sound->pitchShift);
348 }
349 }
350}
void snd_adjust_sound_with_shift(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition 30450.c:235
s32 sourceFlags
Definition audio.h:699
@ SOUND_INSTANCE_FLAG_POSITION_CHANGED
Definition audio.h:243
Vec3f pos
Definition audio.h:703
void sfx_get_spatialized_sound_params(f32 x, f32 y, f32 z, s16 *volume, s16 *pan, s32 flags)
Definition sfx.c:551

Referenced by step_game_loop().

◆ sfx_set_reverb_mode()

void sfx_set_reverb_mode ( s32 arg0)

Definition at line 352 of file sfx.c.

352 {
353 func_800561E4(mode);
354 SfxReverbMode = mode;
355}
void func_800561E4(s32 arg0)
Definition 30450.c:857
BSS s32 SfxReverbMode
Definition sfx.c:215

Referenced by load_map_by_IDs(), sfx_clear_sounds(), state_init_title_screen(), state_step_pause(), and state_step_unpause().

◆ sfx_get_reverb_mode()

s32 sfx_get_reverb_mode ( void )

Definition at line 357 of file sfx.c.

357 {
358 return SfxReverbMode;
359}

Referenced by state_step_pause().

◆ sfx_stop_env_sounds()

void sfx_stop_env_sounds ( void )

Definition at line 361 of file sfx.c.

361 {
362 SoundInstance* sound;
363 s32 i;
364
367 } else {
369 }
370
371 sound = gCurrentEnvSounds;
372 for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) {
373 if (sound->flags & SOUND_INSTANCE_FLAG_ACTIVE) {
374 snd_stop_sound(sound->soundID);
375 }
376 }
377}
void snd_stop_sound(s32 soundID)
Definition 30450.c:256

Referenced by load_map_by_IDs(), state_step_battle(), state_step_end_battle(), state_step_pause(), and step_game_loop().

◆ sfx_play_sound_looping()

void sfx_play_sound_looping ( s32 soundId,
u8 volume,
u8 pan,
s16 pitchShift )

Definition at line 392 of file sfx.c.

392 {
394 s32 i;
395
396 for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) {
397 if (!(sound->flags & SOUND_INSTANCE_FLAG_ACTIVE)) {
398 break;
399 }
400 }
401
402 sound->pan = pan;
403 sound->soundID = soundID;
404 sound->volume = volume;
405 sound->pitchShift = pitchShift;
407
408 snd_start_sound_with_shift(soundID, volume, pan, pitchShift);
409}

Referenced by sfx_play_sound_with_params().

◆ sfx_register_looping_sound_at_position()

void sfx_register_looping_sound_at_position ( s32 soundID,
s32 flags,
f32 x,
f32 y,
f32 z )

Definition at line 411 of file sfx.c.

411 {
413 s32 i;
414
415 for (i = 0; i < MAX_SOUND_INSTANCES; i++, sound++) {
416 if (!(sound->flags & SOUND_INSTANCE_FLAG_ACTIVE)) {
417 break;
418 }
419 }
420
421 sound->sourceFlags = flags;
422 sound->pos.x = x;
423 sound->pos.y = y;
424 sound->pos.z = z;
425 sound->soundID = soundID;
427
428 sfx_play_sound_at_position(soundID, flags, x, y, z);
429}
s8 flags
Definition demo_api.c:15
#define sfx_play_sound_at_position

Referenced by sfx_play_sound_at_position().

◆ sfx_adjust_env_sound_pos()

s32 sfx_adjust_env_sound_pos ( s32 soundID,
s32 sourceFlags,
f32 x,
f32 y,
f32 z )

Definition at line 431 of file sfx.c.

431 {
433
434 if (sound == NULL) {
435 return FALSE;
436 }
437
438 sound->sourceFlags = sourceFlags;
439 sound->pos.x = x;
440 sound->pos.y = y;
441 sound->pos.z = z;
442 sound->soundID = soundID;
444 return TRUE;
445}
SoundInstance * sfx_get_env_sound_instance(s32 soundID)
Definition sfx.c:379

Referenced by SentinelAI_Descend().

◆ snd_stop_tracking_env_sound_pos()

void snd_stop_tracking_env_sound_pos ( s32 soundID,
s32 keepPlaying )

Definition at line 447 of file sfx.c.

447 {
449
450 if (sound != NULL) {
452 if (!keepPlaying) {
453 snd_stop_sound(sound->soundID);
454 }
455 }
456}

Referenced by func_802BB34C_E2DC7C(), and sfx_stop_sound().

◆ sfx_play_sound_with_params()

void sfx_play_sound_with_params ( s32 soundID,
u8 volume,
u8 pan,
s16 pitchShift )

Definition at line 458 of file sfx.c.

458 {
459 AlternatingSoundSet* alternatingSet;
460
462 return;
463 }
464
465 if (soundID & SOUND_TYPE_SPECIAL) {
466 s32 soundIndex = soundID & 0xFF;
467 s32 soundType = (soundID & 0x70000000) >> 0x1C;
468 switch (soundType) {
470 // 0x8xxxxxxx
471 sfx_play_sound_looping(LoopingSounds[soundIndex], volume, pan, pitchShift);
472 return;
474 soundID = OpenCloseSounds[gCurrentDoorSounds][soundIndex];
475 break;
477 soundID = OpenCloseSounds[gCurrentRoomDoorSounds][soundIndex];
478 break;
480 // 0xBxxxxxxx
481 alternatingSet = &AlternatingSounds[soundIndex];
482 if (alternatingSet->curIndex >= alternatingSet->soundCount) {
483 alternatingSet->curIndex = 0;
484 }
485 soundID = alternatingSet->sounds[alternatingSet->curIndex++];
486 break;
487 }
488 }
489 snd_start_sound_with_shift(soundID, volume, pan, pitchShift);
490}
@ SOUND_TYPE_SPECIAL
Definition enums.h:539
@ SOUND_TYPE_ROOM_DOOR
Definition enums.h:542
@ SOUND_TYPE_LOOPING
Definition enums.h:540
@ SOUND_TYPE_EXIT_DOOR
Definition enums.h:541
@ SOUND_TYPE_ALTERNATING
Definition enums.h:543
s32 OpenCloseSounds[][2]
Definition sfx.c:202
AlternatingSoundSet AlternatingSounds[]
Definition sfx.c:165
s32 LoopingSounds[]
Definition sfx.c:12
void sfx_play_sound_looping(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition sfx.c:392

Referenced by _update_message(), msg_copy_to_print_buffer(), msg_play_speech_sound(), sfx_play_sound(), sfx_play_sound_at_position(), update(), and update_riding_physics().

◆ sfx_adjust_env_sound_params()

void sfx_adjust_env_sound_params ( s32 soundID,
u8 volume,
u8 pan,
s16 pitchShift )

Definition at line 492 of file sfx.c.

492 {
493 SoundInstance* sound;
494
495 if (soundID & SOUND_TYPE_SPECIAL) {
496 sound = sfx_get_env_sound_instance(LoopingSounds[soundID & 0xFFFF]);
497 if (sound != NULL) {
498 sound->volume = volume;
499 sound->pan = pan;
500 sound->pitchShift = pitchShift;
501 }
502 } else {
503 snd_adjust_sound_with_shift(soundID, volume, pan, pitchShift);
504 }
505}

Referenced by update().

◆ sfx_stop_sound()

void sfx_stop_sound ( s32 soundID)

Definition at line 507 of file sfx.c.

507 {
508 s32 sound = soundID;
509
510 if (sound & SOUND_TYPE_SPECIAL) {
511 snd_stop_tracking_env_sound_pos(LoopingSounds[sound & 0xFFFF], FALSE);
512 } else {
513 snd_stop_sound(sound);
514 }
515}
void snd_stop_tracking_env_sound_pos(s32 soundID, s32 keepPlaying)
Definition sfx.c:447

Referenced by action_update_spin(), free(), phys_update_action_state(), pre_battle(), pre_battle(), SentinelAI_LosePlayerInit(), set_action_state(), update(), and update_encounters_pre_battle().

◆ sfx_play_sound()

void sfx_play_sound ( s32 soundID)

Definition at line 517 of file sfx.c.

517 {
518 sfx_play_sound_with_params(soundID, 0, 0, 0);
519}
void sfx_play_sound_with_params(s32 soundID, u8 volume, u8 pan, s16 pitchShift)
Definition sfx.c:458

Referenced by _use_partner_ability(), btl_main_menu_update(), btl_state_update_begin_player_turn(), btl_state_update_celebration(), btl_state_update_defeat(), btl_state_update_partner_menu(), btl_state_update_partner_move(), btl_state_update_player_menu(), btl_state_update_player_move(), btl_state_update_run_away(), btl_state_update_select_target(), btl_submenu_moves_update(), btl_update_ko_status(), btl_update_strats_menu(), calc_player_damage_enemy(), can_open_world_menu(), check_input_open_menus(), check_input_status_bar(), coin_counter_draw_content(), entity_BlueWarpPipe_enter_pipe_init(), entity_Chest_begin_opening(), entity_CymbalPlant_idle(), entity_HeartBlockContent__anim_heal(), entity_HiddenPanel_flip_over(), entity_Padlock_idle(), entity_SaveBlock_show_result_message(), entity_StarBoxLauncher_launch(), entity_WoodenCrate_idle(), filemenu_choose_name_handle_input(), filemenu_main_handle_input(), filemenu_yesno_handle_input(), func_800F16CC(), func_802BB34C_E2DC7C(), func_802BC3E4_E2ED14(), hud_element_update(), inflict_partner_ko(), partner_use_ability(), pause_badges_handle_input(), pause_handle_input(), pause_init(), pause_items_handle_input(), pause_map_handle_input(), pause_partners_handle_input(), pause_spirits_handle_input(), pause_stats_handle_input(), pause_tabs_handle_input(), pause_tutorial_input(), popup_menu_update(), remove_player_buffs(), should_cancel_open_world_menu(), state_step_title_screen(), step_entity_commandlist(), update(), update_encounters_neutral(), update_item_entity_pickup(), and update_status_bar().

◆ sfx_play_sound_at_player()

◆ sfx_play_sound_at_npc()

void sfx_play_sound_at_npc ( s32 soundID,
s32 arg1,
s32 npcID )

Definition at line 527 of file sfx.c.

527 {
528 Npc* npc = get_npc_safe(npcID);
529
530 if (npc != NULL) {
531 sfx_play_sound_at_position(soundID, flags, npc->pos.x, npc->pos.y, npc->pos.z);
532 }
533}
Npc * get_npc_safe(s32 npcID)
Definition npc.c:1010
Vec3f pos

Referenced by update_riding_physics().

◆ sfx_play_sound_at_position()

void sfx_play_sound_at_position ( s32 soundID,
s32 flags,
f32 posX,
f32 posY,
f32 posZ )

Definition at line 535 of file sfx.c.

535 {
536 if ((soundID & 0xF0000000) == SOUND_TYPE_SPECIAL) {
537 s32 id = LoopingSounds[soundID & 0xFFFF];
538
539 sfx_register_looping_sound_at_position(id, flags, posX, posY, posZ);
540 } else {
541 s16 volume;
542 s16 pan;
543
544 sfx_get_spatialized_sound_params(posX, posY, posZ, &volume, &pan, flags);
545 if (volume >= 0) {
546 sfx_play_sound_with_params(soundID, volume, pan, 0);
547 }
548 }
549}
void sfx_register_looping_sound_at_position(s32 soundID, s32 flags, f32 x, f32 y, f32 z)
Definition sfx.c:411

◆ sfx_get_spatialized_sound_params()

void sfx_get_spatialized_sound_params ( f32 x,
f32 y,
f32 z,
s16 * volume,
s16 * pan,
s32 flags )

Definition at line 551 of file sfx.c.

551 {
552 u32 paramFlags;
553 u32 spaceMode;
554
555 paramFlags = flags & SOUND_SPACE_PARAMS_MASK;
556 spaceMode = flags & SOUND_SPACE_MODE_MASK;
557
558 switch (spaceMode) {
561 break;
564 break;
565 case SOUND_SPACE_FULL:
566 sfx_compute_spatialized_sound_params_full(x, y, z, volume, pan, paramFlags);
567 break;
568 }
569
570 if (paramFlags & SOUND_PARAM_MUTE) {
571 *volume = 0;
572 } else if (paramFlags & SOUND_PARAM_QUIET) {
573 if (*volume < 80) {
574 *volume = 80;
575 }
576 } else if (paramFlags & SOUND_PARAM_MORE_QUIET) {
577 if (*volume < 60) {
578 *volume = 60;
579 }
580 } else if (paramFlags & SOUND_PARAM_MOST_QUIET) {
581 if (*volume < 40) {
582 *volume = 40;
583 }
584 }
585
586 if (*pan < 1) {
587 *pan = 1;
588 }
589 if (*pan > 127) {
590 *pan = 127;
591 }
592}
@ SOUND_SPACE_PARAMS_MASK
Definition enums.h:1740
@ SOUND_SPACE_MODE_MASK
Definition enums.h:1736
@ SOUND_SPACE_DEFAULT
Definition enums.h:1737
@ SOUND_SPACE_FULL
Definition enums.h:1739
@ SOUND_PARAM_QUIET
Definition enums.h:1747
@ SOUND_SPACE_WITH_DEPTH
Definition enums.h:1738
@ SOUND_PARAM_MUTE
Definition enums.h:1741
@ SOUND_PARAM_MORE_QUIET
Definition enums.h:1746
@ SOUND_PARAM_MOST_QUIET
Definition enums.h:1745
void sfx_compute_spatialized_sound_params_with_depth(f32 x, f32 y, f32 z, s16 *volume, s16 *pan)
Definition sfx.c:628
void sfx_compute_spatialized_sound_params_ignore_depth(f32 x, f32 y, f32 z, s16 *volume, s16 *pan)
Definition sfx.c:594
void sfx_compute_spatialized_sound_params_full(f32 x, f32 y, f32 z, s16 *volume, s16 *pan, s32 flags)
Definition sfx.c:217

Referenced by sfx_play_sound_at_position(), and sfx_update_env_sound_params().

◆ sfx_compute_spatialized_sound_params_ignore_depth()

void sfx_compute_spatialized_sound_params_ignore_depth ( f32 x,
f32 y,
f32 z,
s16 * volume,
s16 * pan )

Definition at line 594 of file sfx.c.

594 {
595 s32 screenX, screenY, screenZ;
596
597 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
598
599 if (screenX > 3000 || screenX < -3000 || screenY > 3000 || screenY < -3000) {
600 *volume = 1;
601 *pan = 0;
602 return;
603 }
604
605 *volume = 127;
606 if (screenX < 0) {
607 *volume = (screenX * 0.3f) + 127.0f;
608 screenX = 0;
609 }
610 if (screenX > SCREEN_WIDTH) {
611 *volume = 127.0f - ((screenX - SCREEN_WIDTH) * 0.3f);
612 screenX = SCREEN_WIDTH;
613 }
614
615 if (*volume < 1) {
616 *volume = 1;
617 }
618
620 // 25/75 at screen edge
621 *pan = (screenX * 0.2f) + 32.0f;
622 } else {
623 f32 temp_f20 = ((screenX * 127.0) / SCREEN_WIDTH) - 64.0;
624 *pan = (s32) (temp_f20 * sin_rad(DEG_TO_RAD(fabs(temp_f20) * 90.0 / 64.0))) + 64;
625 }
626}
void get_screen_coords(s32 camID, f32 x, f32 y, f32 z, s32 *screenX, s32 *screenY, s32 *screenZ)
Definition cam_main.c:410
f64 fabs(f64 f)
f32 sin_rad(f32 x)
Definition 43F0.c:713
#define SCREEN_WIDTH
Definition macros.h:105
#define DEG_TO_RAD(deg)
Definition macros.h:134
s32 gCurrentCameraID
Definition cam_math.c:4

Referenced by sfx_get_spatialized_sound_params().

◆ sfx_compute_spatialized_sound_params_with_depth()

void sfx_compute_spatialized_sound_params_with_depth ( f32 x,
f32 y,
f32 z,
s16 * volume,
s16 * pan )

Definition at line 628 of file sfx.c.

628 {
629 Camera* camera = &gCameras[gCurrentCameraID];
630 s32 screenX, screenY, screenZ;
631 f32 depth;
632
633 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
634
635 if (screenX > 3000 || screenX < -3000 || screenY > 3000 || screenY < -3000) {
636 *volume = 1;
637 *pan = 0;
638 return;
639 }
640
641 *volume = 127;
642 if (screenX < 0) {
643 *volume = (screenX * 0.3f) + 127.0f;
644 screenX = 0;
645 }
646 if (camera->viewportW < screenX) {
647 *volume = 127.0f - ((screenX - camera->viewportW) * 0.3f);
648 screenX = camera->viewportW;
649 }
650
651 depth = fabsf(5000 - screenZ);
652 if (depth > 1000.0f) {
653 depth = 1000.0f;
654 }
655
656 *volume = *volume * (1500.0f - depth) * 0.001f;
657 if (*volume > 127) {
658 *volume = 127;
659 }
660 if (*volume < 1) {
661 *volume = 1;
662 }
663
664 *pan = ((screenX * 64.0f) / camera->viewportW) + 32.0f;
665}
f32 fabsf(f32 f)
Camera gCameras[4]
Definition cam_main.c:17

Referenced by sfx_get_spatialized_sound_params().

◆ sfx_compute_spatialized_sound_params_full()

void sfx_compute_spatialized_sound_params_full ( f32 x,
f32 y,
f32 z,
s16 * volume,
s16 * pan,
s32 flags )

Definition at line 217 of file sfx.c.

217 {
218 s32 screenX, screenY, screenZ;
219 f32 volAmtOffsetX, volAmtDeltaY, volAmtDepth;
220 f32 offsetX, offsetY, depth;
221 f32 volTemp, panTemp;
222 s32 phi_v0;
223
224 get_screen_coords(gCurrentCameraID, x, y, z, &screenX, &screenY, &screenZ);
225
226 if (screenX > 5000 || screenX < -5000 || screenY > 5000 || screenY < -5000) {
227 *volume = -1;
228 *pan = 0;
229 return;
230 }
231
233 if (screenX < -30 || screenX > SCREEN_WIDTH + 30 || screenY < -30 || screenY > SCREEN_HEIGHT + 30) {
234 *volume = -1;
235 *pan = 0;
236 return;
237 }
238 } else if (flags & SOUND_PARAM_CLIP_OFFSCREEN_X) {
239 if (screenX < -30 || screenX > SCREEN_WIDTH + 30) {
240 *volume = -1;
241 *pan = 0;
242 return;
243 }
244 } else if (flags & SOUND_PARAM_CLIP_OFFSCREEN_Y) {
245 if (screenY < -30 || screenY > SCREEN_HEIGHT + 30) {
246 *volume = -1;
247 *pan = 0;
248 return;
249 }
250 }
251
252 offsetX = abs((SCREEN_WIDTH / 2) - screenX) - 145;
253 if (offsetX < 0.0) {
254 offsetX = 0.0f;
255 }
256
257 volAmtOffsetX = update_lerp(EASING_LINEAR, 1.0f, 0.0f, offsetX, 200);
258 if (volAmtOffsetX < 0.0) {
259 volAmtOffsetX = 0.0f;
260 }
261
262 offsetY = abs((SCREEN_HEIGHT / 2) - screenY) - 105;
263 if (offsetY < 0.0) {
264 offsetY = 0.0f;
265 }
266
267 volAmtDeltaY = update_lerp(EASING_LINEAR, 1.0f, 0.0f, offsetY, 130);
268 if (volAmtDeltaY < 0.0) {
269 volAmtDeltaY = 0.0f;
270 }
271
272 depth = screenZ - 5550.0;
273 if (depth < 0.0) {
274 depth = 0.0f;
275 }
276
277 volAmtDepth = update_lerp(EASING_LINEAR, 1.0f, 0.0f, depth, 250);
278 if (volAmtDepth < 0.0) {
279 volAmtDepth = 0.0f;
280 }
281
282 volTemp = (volAmtOffsetX * volAmtDeltaY * volAmtDepth) * 127.0;
283 if (volTemp < 15.0) {
284 volTemp = 15.0f;
285 } else if (volTemp > 127.0) {
286 volTemp = 127.0f;
287 }
288 *volume = volTemp;
289
290 panTemp = (((f32) screenX - (SCREEN_WIDTH / 2.0)) / 3.6) + 64.0;
291 if (panTemp < 1.0) {
292 panTemp = 1.0f;
293 } else if (panTemp > 127.0) {
294 panTemp = 127.0f;
295 }
296 *pan = panTemp;
297}
@ EASING_LINEAR
Definition enums.h:510
@ SOUND_PARAM_CLIP_OFFSCREEN_X
Definition enums.h:1743
@ SOUND_PARAM_CLIP_OFFSCREEN_ANY
Definition enums.h:1742
@ SOUND_PARAM_CLIP_OFFSCREEN_Y
Definition enums.h:1744
f32 update_lerp(s32 easing, f32 start, f32 end, s32 elapsed, s32 duration)
Definition 43F0.c:735
#define SCREEN_HEIGHT
Definition macros.h:106

Referenced by sfx_get_spatialized_sound_params().