Files
buzzer_2/firmware/libs/audio/include/audio.h

33 lines
1.1 KiB
C

#ifndef AUDIO_H
#define AUDIO_H
#include <zephyr/kernel.h>
#include "fs_mgmt.h"
/** Audio command message structure */
struct audio_cmd_msg
{
char filename[CONFIG_FS_MGMT_MAX_PATH_LENGTH]; // Wenn leer, nutze Fallback-Sound
bool is_interrupt; // True = sofort abbrechen, False = Enqueue
};
/**
* @brief Queues an audio playback command to the audio thread
* @param filename Name of the audio file to play. If empty, a random sound will be played
* @param is_interrupt If true, the command will interrupt any currently playing audio. If
* false, it will be enqueued and played after the current audio finishes
* @return 0 on success, negative error code on failure
*/
int audio_queue_play(const char *filename, bool is_interrupt);
/**
* @brief Starts playback of a random audio file from the audio directory. This is a non-blocking call that signals the audio thread to select and play a random sound.
*/
void audio_start_random_playback(void);
/**
* @brief Refreshes the list of available audio files
*/
void audio_refresh_files(void);
#endif /* AUDIO_H */