Ejemplo n.º 1
0
void OPL_Timer_SetCallback(uint64_t us, opl_callback_t callback, void *data)
{
    SDL_LockMutex(callback_queue_mutex);
    OPL_Queue_Push(callback_queue, callback, data,
                   current_time + us - pause_offset);
    SDL_UnlockMutex(callback_queue_mutex);
}
Ejemplo n.º 2
0
void OPL_SetCallback(unsigned int ms,
	opl_callback_t callback,
	void *data)
{
	OPL_Queue_Push(callback_queue, callback, data,
		current_time - pause_offset + (ms * opl_sample_rate) / 1000);
}
Ejemplo n.º 3
0
static void OPL_SDL_SetCallback(unsigned int ms,
                                opl_callback_t callback,
                                void *data)
{
    SDL_LockMutex(callback_queue_mutex);
    OPL_Queue_Push(callback_queue, callback, data,
                   current_time - pause_offset + (ms * mixing_freq) / 1000);
    SDL_UnlockMutex(callback_queue_mutex);
}
Ejemplo n.º 4
0
int main()
{
    opl_callback_queue_t *queue;
    int iteration;

    queue = OPL_Queue_Create();

    for (iteration=0; iteration<5000; ++iteration)
    {
        opl_callback_t callback;
        void *data;
        unsigned int time;
        unsigned int newtime;
        int i;

        for (i=0; i<MAX_OPL_QUEUE; ++i)
        {
            time = rand() % 0x10000;
            OPL_Queue_Push(queue, NULL, NULL, time);
        }

        time = 0;

        for (i=0; i<MAX_OPL_QUEUE; ++i)
        {
            assert(!OPL_Queue_IsEmpty(queue));
            newtime = OPL_Queue_Peek(queue);
            assert(OPL_Queue_Pop(queue, &callback, &data));

            assert(newtime >= time);
            time = newtime;
        }

        assert(OPL_Queue_IsEmpty(queue));
        assert(!OPL_Queue_Pop(queue, &callback, &data));
    }
}