Add spatial audio, spacecraft entity, and level intro sequence
Distance-based sound effects with stereo panning for explosions, impacts, and pickups. Spacecraft entity with full state machine (fly-in, land, take off, fly-out), engine/synth sound loops, thruster particles, and PNG spritesheet. Moon level intro defers player spawn until ship lands. Also untrack build/ objects that were committed by mistake.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define JNR_AUDIO_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include "util/vec2.h"
|
||||
|
||||
typedef struct Sound {
|
||||
void *chunk; /* Mix_Chunk* */
|
||||
@@ -21,4 +22,23 @@ void audio_free_music(Music *m);
|
||||
void audio_set_music_volume(int volume); /* 0-128 */
|
||||
void audio_shutdown(void);
|
||||
|
||||
/* ── Looping sounds ────────────────────────────── */
|
||||
|
||||
/* Play a sound on loop, returns the channel number (or -1 on failure).
|
||||
* Use audio_stop_channel() to stop it later. */
|
||||
int audio_play_sound_loop(Sound s, int volume);
|
||||
|
||||
/* Stop a specific channel (from audio_play_sound_loop). No-op if ch < 0. */
|
||||
void audio_stop_channel(int ch);
|
||||
|
||||
/* ── Positional / spatial audio ────────────────── */
|
||||
|
||||
/* Set the listener position (call once per frame, typically from camera center) */
|
||||
void audio_set_listener(Vec2 pos);
|
||||
|
||||
/* Play a sound at a world position. Volume is attenuated by distance from the
|
||||
* listener and stereo-panned based on horizontal offset. Sounds beyond
|
||||
* max_dist are inaudible. Pass max_dist <= 0 for a sensible default. */
|
||||
void audio_play_sound_at(Sound s, int base_volume, Vec2 world_pos, float max_dist);
|
||||
|
||||
#endif /* JNR_AUDIO_H */
|
||||
|
||||
Reference in New Issue
Block a user