/* Returns a pointer to the mp3 buffer. Playback gets stopped, to avoid conflicts. Talk buffer is stolen as well. */ static void* plugin_get_audio_buffer(size_t *buffer_size) { /* dummy ops with no callbacks, needed because by * default buflib buffers can be moved around which must be avoided */ static struct buflib_callbacks dummy_ops; plugin_buffer_handle = core_alloc_maximum("plugin audio buf", buffer_size, &dummy_ops); return core_get_data(plugin_buffer_handle); }
void radioart_init(bool entering_screen) { if (entering_screen) { /* grab control over buffering */ size_t bufsize; int handle = core_alloc_maximum("radioart", &bufsize, &radioart_ops); buffering_reset(core_get_data(handle), bufsize); buf = core_get_data(handle); /* one-shot */ add_event(BUFFER_EVENT_BUFFER_RESET, true, buffer_reset_handler); } else /* init at startup */ { for(int i=0;i<MAX_RADIOART_IMAGES;i++) { radioart[i].handle = -1; radioart[i].name[0] = '\0'; } } }