Compiled libao locally
This commit is contained in:
@@ -12,6 +12,10 @@
|
||||
#ifdef USE_WINDOWS_THREADS
|
||||
#define MUTEX_LOCK(m) WaitForSingleObject(m, INFINITE)
|
||||
#define MUTEX_UNLOCK(m) ReleaseMutex(m)
|
||||
#define SEM_WAIT(sem, ms) (WaitForSingleObject(sem, ms) == WAIT_OBJECT_0)
|
||||
#define SEM_TRYWAIT(sem) (WaitForSingleObject(sem, 0) == WAIT_OBJECT_0)
|
||||
#define SEM_POST(sem) ReleaseSemaphore(sem, 1, NULL)
|
||||
#define YIELD() sleep_ms(5)
|
||||
#endif
|
||||
|
||||
#ifdef USE_PTHREADS
|
||||
@@ -108,8 +112,10 @@ typedef struct {
|
||||
#ifdef USE_WINDOWS_THREADS
|
||||
HANDLE mutex;
|
||||
HANDLE pause_mutex;
|
||||
HANDLE clear_mutex;
|
||||
HANDLE thread;
|
||||
DWORD thread_id;
|
||||
HANDLE queue_sem;
|
||||
#endif
|
||||
#ifdef USE_PTHREADS
|
||||
pthread_mutex_t mutex;
|
||||
@@ -267,7 +273,11 @@ int ao_async_version()
|
||||
#include <dlfcn.h>
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
static void at_exit_shutdown_ao(void)
|
||||
#else
|
||||
static void at_exit_shutdown_ao()
|
||||
#endif
|
||||
{
|
||||
ao_shutdown();
|
||||
}
|
||||
@@ -328,8 +338,11 @@ void *ao_create_async(int bits, int rate, int channels, int byte_format)
|
||||
handle->pause_mutex = CreateMutex(NULL, // default security attributes
|
||||
FALSE, // initially not owned
|
||||
NULL);
|
||||
handle->clear_mutex = CreateMutex(NULL,
|
||||
FALSE,
|
||||
NULL);
|
||||
handle->queue_sem = CreateSemaphore(NULL, 0, 1000000, NULL);
|
||||
handle->thread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) run, handle, 0, &handle->thread_id);
|
||||
// TODO Windows Semaphores!
|
||||
#endif
|
||||
|
||||
MUTEX_UNLOCK(handle->pause_mutex);
|
||||
|
||||
Reference in New Issue
Block a user