Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1226aec2fc | |||
| 99a55c4452 | |||
| 14cf721094 | |||
| 515bc4ba53 | |||
| 25dfe4b57a | |||
| 9a4a3d3977 | |||
| 4fd0cd3151 |
@@ -328,7 +328,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve
|
||||
devid = get_device_id(device);
|
||||
if(devid)
|
||||
{
|
||||
if(wcscmp(devid, defdevid) != 0)
|
||||
if(!defdevid || wcscmp(devid, defdevid) != 0)
|
||||
add_device(device, devid, list);
|
||||
CoTaskMemFree(devid);
|
||||
}
|
||||
@@ -695,12 +695,14 @@ static ALCboolean MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *
|
||||
{
|
||||
memset(out, 0, sizeof(*out));
|
||||
if(in->wFormatTag == WAVE_FORMAT_EXTENSIBLE)
|
||||
{
|
||||
*out = *(const WAVEFORMATEXTENSIBLE*)in;
|
||||
out->Format.cbSize = sizeof(*out) - sizeof(out->Format);
|
||||
}
|
||||
else if(in->wFormatTag == WAVE_FORMAT_PCM)
|
||||
{
|
||||
out->Format = *in;
|
||||
out->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
out->Format.cbSize = sizeof(*out) - sizeof(*in);
|
||||
out->Format.cbSize = 0;
|
||||
if(out->Format.nChannels == 1)
|
||||
out->dwChannelMask = MONO;
|
||||
else if(out->Format.nChannels == 2)
|
||||
@@ -712,8 +714,7 @@ static ALCboolean MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX *
|
||||
else if(in->wFormatTag == WAVE_FORMAT_IEEE_FLOAT)
|
||||
{
|
||||
out->Format = *in;
|
||||
out->Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
out->Format.cbSize = sizeof(*out) - sizeof(*in);
|
||||
out->Format.cbSize = 0;
|
||||
if(out->Format.nChannels == 1)
|
||||
out->dwChannelMask = MONO;
|
||||
else if(out->Format.nChannels == 2)
|
||||
@@ -938,6 +939,7 @@ static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self)
|
||||
ERR("Unhandled channel config: %d -- 0x%08lx\n", OutputType.Format.nChannels, OutputType.dwChannelMask);
|
||||
}
|
||||
|
||||
OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||
switch(device->FmtChans)
|
||||
{
|
||||
case DevFmtMono:
|
||||
@@ -1079,6 +1081,8 @@ static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self)
|
||||
{
|
||||
ERR("Unhandled format sub-type\n");
|
||||
device->FmtType = DevFmtShort;
|
||||
if(OutputType.Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
||||
OutputType.Format.wFormatTag = WAVE_FORMAT_PCM;
|
||||
OutputType.Format.wBitsPerSample = 16;
|
||||
OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
|
||||
}
|
||||
|
||||
+16
-3
@@ -6,6 +6,19 @@
|
||||
#include "alu.h"
|
||||
#include "almalloc.h"
|
||||
#include "static_assert.h"
|
||||
#include "math_defs.h"
|
||||
|
||||
|
||||
/* Early MSVC lacks round/roundf */
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1800
|
||||
static double round(double val)
|
||||
{
|
||||
if(val < 0.0)
|
||||
return ceil(val-0.5);
|
||||
return floor(val+0.5);
|
||||
}
|
||||
#define roundf(f) ((float)round((float)(f)))
|
||||
#endif
|
||||
|
||||
|
||||
/* These structures assume BUFFERSIZE is a power of 2. */
|
||||
@@ -463,14 +476,14 @@ Compressor* CompressorInit(const ALsizei NumChans, const ALuint SampleRate,
|
||||
if(hold > 0)
|
||||
{
|
||||
Comp->Hold = (SlidingHold*)(Comp + 1);
|
||||
Comp->Hold->Values[0] = -INFINITY;
|
||||
Comp->Hold->Values[0] = -HUGE_VALF;
|
||||
Comp->Hold->Expiries[0] = hold;
|
||||
Comp->Hold->Length = hold;
|
||||
Comp->Delay = (ALfloat(*)[])(Comp->Hold + 1);
|
||||
Comp->Delay = (ALfloat(*)[BUFFERSIZE])(Comp->Hold + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
Comp->Delay = (ALfloat(*)[])(Comp + 1);
|
||||
Comp->Delay = (ALfloat(*)[BUFFERSIZE])(Comp + 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ int main()
|
||||
IF(HAVE___BUILTIN_ASSUME_ALIGNED)
|
||||
SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)")
|
||||
ELSE()
|
||||
SET(ASSUME_ALIGNED_DECL "x")
|
||||
SET(ASSUME_ALIGNED_DECL "(x)")
|
||||
ENDIF()
|
||||
|
||||
SET(SSE_SWITCH "")
|
||||
|
||||
@@ -631,6 +631,39 @@ void alcnd_destroy(alcnd_t *cond)
|
||||
}
|
||||
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
int alsem_init(alsem_t *sem, unsigned int initial)
|
||||
{
|
||||
*sem = dispatch_semaphore_create(initial);
|
||||
return *sem ? althrd_success : althrd_error;
|
||||
}
|
||||
|
||||
void alsem_destroy(alsem_t *sem)
|
||||
{
|
||||
dispatch_release(*sem);
|
||||
}
|
||||
|
||||
int alsem_post(alsem_t *sem)
|
||||
{
|
||||
dispatch_semaphore_signal(*sem);
|
||||
return althrd_success;
|
||||
}
|
||||
|
||||
int alsem_wait(alsem_t *sem)
|
||||
{
|
||||
dispatch_semaphore_wait(*sem, DISPATCH_TIME_FOREVER);
|
||||
return althrd_success;
|
||||
}
|
||||
|
||||
int alsem_trywait(alsem_t *sem)
|
||||
{
|
||||
long value = dispatch_semaphore_wait(*sem, DISPATCH_TIME_NOW);
|
||||
return value == 0 ? althrd_success : althrd_busy;
|
||||
}
|
||||
|
||||
#else /* !__APPLE__ */
|
||||
|
||||
int alsem_init(alsem_t *sem, unsigned int initial)
|
||||
{
|
||||
if(sem_init(sem, 0, initial) == 0)
|
||||
@@ -665,6 +698,8 @@ int alsem_trywait(alsem_t *sem)
|
||||
return althrd_error;
|
||||
}
|
||||
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
int altss_create(altss_t *tss_id, altss_dtor_t callback)
|
||||
{
|
||||
|
||||
@@ -130,13 +130,21 @@ inline int altss_set(altss_t tss_id, void *val)
|
||||
#include <stdint.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#ifdef __APPLE__
|
||||
#include <dispatch/dispatch.h>
|
||||
#else /* !__APPLE__ */
|
||||
#include <semaphore.h>
|
||||
#endif /* __APPLE__ */
|
||||
|
||||
|
||||
typedef pthread_t althrd_t;
|
||||
typedef pthread_mutex_t almtx_t;
|
||||
typedef pthread_cond_t alcnd_t;
|
||||
#ifdef __APPLE__
|
||||
typedef dispatch_semaphore_t alsem_t;
|
||||
#else /* !__APPLE__ */
|
||||
typedef sem_t alsem_t;
|
||||
#endif /* __APPLE__ */
|
||||
typedef pthread_key_t altss_t;
|
||||
typedef pthread_once_t alonce_flag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user