Example #1
0
static int shrink_callback(int handle, unsigned hints, void* start, size_t old_size)
{
    (void)start;
    (void)old_size;

    ssize_t old_size_s = old_size;
    size_t size_hint = (hints & BUFLIB_SHRINK_SIZE_MASK);
    ssize_t wanted_size = old_size_s - size_hint;

    if (wanted_size <= 0)
    {
        core_free(handle);
        buffering_reset(NULL, 0);
    }
    else
    {
        if (hints & BUFLIB_SHRINK_POS_FRONT)
            start += size_hint;

        buffering_reset(start, wanted_size);
        core_shrink(handle, start, wanted_size);
        buf = start;

        /* one-shot */
        add_event(BUFFER_EVENT_BUFFER_RESET, true, buffer_reset_handler);
    }

    return BUFLIB_CB_OK;
}
Example #2
0
void radioart_init(bool entering_screen)
{
    int i;
    if (entering_screen)
    {
        for(i=0;i<MAX_RADIOART_IMAGES;i++)
        {
            radioart[i].handle = -1;
            radioart[i].name[0] = '\0';
        }
        add_event(PLAYBACK_EVENT_START_PLAYBACK, true, playback_restarting_handler);

        /* grab control over buffering */
        char* buf;
        size_t bufsize;
        buf = audio_get_buffer(false, &bufsize);
        buffering_reset(buf, bufsize);
    }
    else
    {
#if defined(HAVE_RECORDING)
        add_event(RECORDING_EVENT_START, false, recording_started_handler);
        add_event(RECORDING_EVENT_STOP, false, recording_stopped_handler);
#endif
    }
}
Example #3
0
void radioart_init(bool entering_screen)
{
    if (entering_screen)
    {
        /* grab control over buffering */
        size_t bufsize;
        buf = audio_get_buffer(false, &bufsize);
        buffering_reset(buf, bufsize);
        /* 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';
        }
    }
}
Example #4
0
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';
        }
    }
}