unleashed-firmware/lib/music_worker/music_worker.h
Sergey Gavrilov 95c1585df6
[FL-3211][FL-3212] Debug apps: speaker, uart_echo with baudrate (#2812)
* Music player: move music_worker to library
* Music player: drop cli
* Debug: speaker debug app
* Debug: baudrate arg in uart_echo app
* Libs: add music_worker to api
* Libs: add music_worker to targets linker_dependencies

Co-authored-by: あく <alleteam@gmail.com>
2023-06-29 20:23:04 +09:00

37 lines
1,018 B
C

#pragma once
#include <stdbool.h>
#include <stdint.h>
typedef void (*MusicWorkerCallback)(
uint8_t semitone,
uint8_t dots,
uint8_t duration,
float position,
void* context);
typedef struct MusicWorker MusicWorker;
MusicWorker* music_worker_alloc();
void music_worker_clear(MusicWorker* instance);
void music_worker_free(MusicWorker* instance);
bool music_worker_load(MusicWorker* instance, const char* file_path);
bool music_worker_load_fmf_from_file(MusicWorker* instance, const char* file_path);
bool music_worker_load_rtttl_from_file(MusicWorker* instance, const char* file_path);
bool music_worker_load_rtttl_from_string(MusicWorker* instance, const char* string);
void music_worker_set_callback(MusicWorker* instance, MusicWorkerCallback callback, void* context);
void music_worker_set_volume(MusicWorker* instance, float volume);
void music_worker_start(MusicWorker* instance);
void music_worker_stop(MusicWorker* instance);
bool music_worker_is_playing(MusicWorker* instance);