Skip to content
Snippets Groups Projects

Pippin/media framework

Merged pippin requested to merge pippin/media_framework into main
2 unresolved threads
1 file
+ 9
1
Compare changes
  • Side-by-side
  • Inline
@@ -14,7 +14,7 @@ static st3m_media *audio_media = NULL;
// XXX should be refactored to either be temporary SPIRAM allocation
// or a static shared global pcm queuing API
//
static int16_t audio_buffer[AUDIO_BUF_SIZE];
static int16_t *audio_buffer = NULL;
void st3m_media_audio_out(int16_t *rx, int16_t *tx, uint16_t len) {
if (!audio_media) return;
@@ -40,6 +40,11 @@ void st3m_media_stop(void) {
if (audio_media && audio_media->destroy) audio_media->destroy(audio_media);
audio_media = 0;
st3m_audio_set_player_function(st3m_audio_player_function_dummy);
if (audio_buffer)
{
free (audio_buffer);
audio_buffer = NULL;
}
}
void st3m_media_pause(void) {
@@ -111,6 +116,7 @@ st3m_media *st3m_media_load_mod(const char *path);
st3m_media *st3m_media_load_mp3(const char *path);
int st3m_media_load(const char *path) {
if (strstr(path, ".mpg")) {
st3m_media_stop();
audio_media = st3m_media_load_mpg1(path);
@@ -124,6 +130,8 @@ int st3m_media_load(const char *path) {
if (!audio_media) return 0;
if (!audio_buffer)
audio_buffer = heap_caps_malloc(AUDIO_BUF_SIZE * 2, MALLOC_CAP_DMA);
st3m_audio_set_player_function(st3m_media_audio_out);
audio_media->audio_buffer = audio_buffer;
audio_media->audio_r = 0;
Loading