diff options
author | Chris Robinson <[email protected]> | 2014-04-16 06:11:40 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2014-04-16 06:11:40 -0700 |
commit | d124aee4d78db389117a8eda60c12a829489622b (patch) | |
tree | 71b50e2e25b8089088ce46fd8bfd045a3e5451d3 /Alc/backends/qsa.c | |
parent | 505ef82246d608970e291289c1087ed42f444281 (diff) |
Remove the old thread wrappers for the new ones
Diffstat (limited to 'Alc/backends/qsa.c')
-rw-r--r-- | Alc/backends/qsa.c | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/Alc/backends/qsa.c b/Alc/backends/qsa.c index d9d7c87b..b77a66ad 100644 --- a/Alc/backends/qsa.c +++ b/Alc/backends/qsa.c @@ -34,8 +34,7 @@ #include "threads.h" -typedef struct -{ +typedef struct { snd_pcm_t* pcmHandle; int audio_fd; @@ -46,27 +45,24 @@ typedef struct ALsizei size; volatile int killNow; - althread_t thread; + althrd_t thread; } qsa_data; -typedef struct -{ +typedef struct { ALCchar* name; int card; int dev; } DevMap; -static const ALCchar qsaDevice[]="QSA Default"; +static const ALCchar qsaDevice[] = "QSA Default"; static DevMap* allDevNameMap; static ALuint numDevNames; static DevMap* allCaptureDevNameMap; static ALuint numCaptureDevNames; -static const struct -{ +static const struct { int32_t format; -} formatlist[]= -{ +} formatlist[] = { {SND_PCM_SFMT_FLOAT_LE}, {SND_PCM_SFMT_S32_LE}, {SND_PCM_SFMT_U32_LE}, @@ -77,11 +73,9 @@ static const struct {0}, }; -static const struct -{ +static const struct { int32_t rate; -} ratelist[]= -{ +} ratelist[] = { {192000}, {176400}, {96000}, @@ -98,11 +92,9 @@ static const struct {0}, }; -static const struct -{ +static const struct { int32_t channels; -} channellist[]= -{ +} channellist[] = { {8}, {7}, {6}, @@ -112,7 +104,7 @@ static const struct {0}, }; -static DevMap* deviceList(int type, ALuint* count) +static DevMap *deviceList(int type, ALuint *count) { snd_ctl_t* handle; snd_pcm_info_t pcminfo; @@ -178,7 +170,7 @@ static DevMap* deviceList(int type, ALuint* count) } -FORCE_ALIGN static ALuint qsa_proc_playback(ALvoid* ptr) +FORCE_ALIGN static int qsa_proc_playback(void* ptr) { ALCdevice* device=(ALCdevice*)ptr; qsa_data* data=(qsa_data*)device->ExtraData; @@ -616,7 +608,8 @@ static ALCboolean qsa_start_playback(ALCdevice* device) { qsa_data *data = (qsa_data*)device->ExtraData; - if(!StartThread(&data->thread, qsa_proc_playback, device)) + data->killNow = 0; + if(althrd_create(&data->thread, qsa_proc_playback, device) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -624,15 +617,14 @@ static ALCboolean qsa_start_playback(ALCdevice* device) static void qsa_stop_playback(ALCdevice* device) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = (qsa_data*)device->ExtraData; + int res; - if (data->thread) - { - data->killNow=1; - StopThread(data->thread); - data->thread=NULL; - } - data->killNow=0; + if(data->killNow) + return; + + data->killNow = 1; + althrd_join(data->thread, &res); } /***********/ |