static void event_loop(uint64_t data) #endif { float out_tmp[CELL_AUDIO_BLOCK_SAMPLES * AUDIO_CHANNELS] __attribute__((aligned(16))); sys_event_queue_t id; sys_ipc_key_t key; sys_event_t event; ps3_audio_t *aud = data; cellAudioCreateNotifyEventQueue(&id, &key); cellAudioSetNotifyEventQueue(key); while (!aud->quit_thread) { sys_event_queue_receive(id, &event, SYS_NO_TIMEOUT); sys_lwmutex_lock(&aud->lock, SYS_NO_TIMEOUT); if (fifo_read_avail(aud->buffer) >= sizeof(out_tmp)) fifo_read(aud->buffer, out_tmp, sizeof(out_tmp)); else memset(out_tmp, 0, sizeof(out_tmp)); sys_lwmutex_unlock(&aud->lock); sys_lwcond_signal(&aud->cond); cellAudioAddData(aud->audio_port, out_tmp, CELL_AUDIO_BLOCK_SAMPLES, 1.0); } cellAudioRemoveNotifyEventQueue(key); sys_ppu_thread_exit(0); }
void ESAudio::Shutdown () { cellAudioPortStop(Port); ThreadDie = true; delete Thread; delete Semaphore; cellAudioPortClose(Port); cellAudioRemoveNotifyEventQueue(QueueKey); sys_event_queue_destroy(QueueID, SYS_EVENT_QUEUE_DESTROY_FORCE); cellAudioQuit(); }
static void* event_loop(void *data) { audioport_t *port = data; sys_event_queue_t id; sys_ipc_key_t key; cellAudioCreateNotifyEventQueue(&id, &key); cellAudioSetNotifyEventQueue(key); if (port->re) resampler_event_loop(port, id); else pull_event_loop(port, id); cellAudioRemoveNotifyEventQueue(key); pthread_exit(NULL); return NULL; }