#ifndef AUDIO_H
#define AUDIO_H

/*
 * audio.h — background music player for wii_wm
 *
 * Uses ffplay (from ffmpeg) as the audio backend — no extra libraries
 * required beyond what's already on most Linux systems.
 *
 * Usage:
 *   audio_init();                      // call once at startup
 *   audio_play("wii_menu.mp3");        // start looping a file
 *   audio_pause();                     // pause (SIGSTOP to ffplay)
 *   audio_resume();                    // resume (SIGCONT to ffplay)
 *   audio_stop();                      // kill the player process
 *   audio_set_volume(80);              // 0-100, best-effort (restarts player)
 *   audio_free();                      // stop + cleanup at shutdown
 *
 * The file path can be absolute or relative.  Supported formats: anything
 * ffplay accepts (MP3, OGG, WAV, FLAC, AAC, …).
 *
 * Intended music: the Wii Menu theme (Wii Menu - Main Theme.mp3 or .ogg).
 * You can rip it yourself or find it freely online.  Place it next to the
 * binary or pass a full path to audio_play().
 */

/* One-time setup (currently a no-op, reserved for future use) */
void audio_init(void);

/* Start playing a file on loop.  Stops any currently playing track first.
   Returns 1 on success, 0 if ffplay could not be launched. */
int  audio_play(const char *filepath);

/* Pause playback without killing the process (SIGSTOP) */
void audio_pause(void);

/* Resume a paused player (SIGCONT) */
void audio_resume(void);

/* Kill the player process immediately */
void audio_stop(void);

/* Set volume 0-100.  Because ffplay has no runtime volume control,
   this stops and restarts the player at the new volume.  Call before
   audio_play() to set the initial volume (default: 80). */
void audio_set_volume(int vol);

/* Returns 1 if audio is currently playing (process alive), 0 otherwise */
int  audio_is_playing(void);

/* Stop + free everything.  Safe to call even if nothing is playing. */
void audio_free(void);

#endif /* AUDIO_H */