mirror of
https://github.com/perfect-dark-pc-port/perfect_dark.git
synced 2026-10-24 00:02:43 +02:00
port: experimental multithreaded audio
This commit is contained in:
1 parent
e8e513fecb
commit
4c552a42f2
17 files changed
+186
-56
No files matched your search
@@ -6,7 +6,6 @@
|
||||
s32 audioInit(void);
|
||||
s32 audioGetBytesBuffered(void);
|
||||
s32 audioGetSamplesBuffered(void);
|
||||
void audioSetNextBuffer(const s16 *buf, u32 len);
|
||||
void audioEndFrame(void);
|
||||
void audioSubmitBuffer(const s16 *buf, u32 size);
|
||||
|
||||
#endif
|
||||
@@ -35,7 +35,11 @@ void *sysMemZeroAlloc(const u32 size);
|
||||
void sysMemFree(void *ptr);
|
||||
|
||||
// hns is specified in 100ns units
|
||||
void sysSleep(const s64 hns);
|
||||
// do not use sysFrameLimiterSleep on any thread other than the main one
|
||||
void sysFrameLimiterSleep(const s64 hns);
|
||||
|
||||
// us is specified in microseconds
|
||||
void sysSleep(const s64 us);
|
||||
|
||||
// yield CPU if supported (e.g. during a busy loop)
|
||||
void sysCpuRelax(void);
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef _IN_THREAD_H
|
||||
#define _IN_THREAD_H
|
||||
|
||||
#include <PR/ultratypes.h>
|
||||
#include "platform.h"
|
||||
|
||||
// TODO: backends
|
||||
#ifndef PLATFORM_USE_PTHREAD
|
||||
#error "No available thread backend."
|
||||
#endif
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define SYSMUTEX_STATIC_INIT PTHREAD_MUTEX_INITIALIZER
|
||||
|
||||
typedef pthread_t systhread;
|
||||
typedef pthread_mutex_t sysmutex;
|
||||
|
||||
typedef void *(*systhreadfn)(void *);
|
||||
|
||||
s32 sysThreadCreate(systhread *thread, systhreadfn func, void *arg);
|
||||
s32 sysThreadJoin(systhread *thread, void **result);
|
||||
|
||||
void sysMutexLock(sysmutex *mtx);
|
||||
void sysMutexUnlock(sysmutex *mtx);
|
||||
|
||||
#endif // _IN_THREAD_H
|
||||
Reference in new issue
Block a user