Login
1 branch 0 tags
Ben (Desktop/Arch) Audio stuff! a833fb5 1 month ago 18 Commits
moon / firmware / src / audio_player.h
#pragma once
#include <stdbool.h>
#include <stdint.h>

typedef enum {
    AUDIO_STATE_STOPPED,
    AUDIO_STATE_PLAYING,
    AUDIO_STATE_PAUSED,
    AUDIO_STATE_ERROR,
} audio_state_t;

// Initialize the audio player subsystem
// Must be called before any other audio_player functions
bool audio_player_init(void);

// Start playing an audio file
// path: Path to the audio file (relative to storage root)
// Returns true on success, false on failure
bool audio_player_play(const char *path);

// Stop playback completely
void audio_player_stop(void);

// Pause playback (can be resumed)
void audio_player_pause(void);

// Resume paused playback
void audio_player_resume(void);

// Get current playback state
audio_state_t audio_player_get_state(void);

// Set playback volume (0-100)
void audio_player_set_volume(uint8_t volume);

// Get current filename being played (or NULL if stopped)
const char *audio_player_get_filename(void);

// Update function - call from main loop
// Required for platforms that need polling
void audio_player_update(void);