mirror of
https://github.com/love2d/megasource.git
synced 2026-08-17 11:11:35 +02:00
Updated OpenAL Soft to 1.17.2.
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
language: c
|
||||||
|
script: cmake . && make -j2
|
||||||
@@ -677,6 +677,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
|||||||
unsigned int rate;
|
unsigned int rate;
|
||||||
const char *funcerr;
|
const char *funcerr;
|
||||||
int allowmmap;
|
int allowmmap;
|
||||||
|
int dir;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
switch(device->FmtType)
|
switch(device->FmtType)
|
||||||
@@ -770,7 +771,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
|||||||
}
|
}
|
||||||
CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)));
|
CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)));
|
||||||
/* set rate (implicitly constrains period/buffer parameters) */
|
/* set rate (implicitly constrains period/buffer parameters) */
|
||||||
if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0))
|
if(!GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0))
|
||||||
{
|
{
|
||||||
if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0)
|
if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0)
|
||||||
ERR("Failed to disable ALSA resampler\n");
|
ERR("Failed to disable ALSA resampler\n");
|
||||||
@@ -787,7 +788,9 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
|||||||
/* retrieve configuration info */
|
/* retrieve configuration info */
|
||||||
CHECK(snd_pcm_hw_params_get_access(hp, &access));
|
CHECK(snd_pcm_hw_params_get_access(hp, &access));
|
||||||
CHECK(snd_pcm_hw_params_get_period_size(hp, &periodSizeInFrames, NULL));
|
CHECK(snd_pcm_hw_params_get_period_size(hp, &periodSizeInFrames, NULL));
|
||||||
CHECK(snd_pcm_hw_params_get_periods(hp, &periods, NULL));
|
CHECK(snd_pcm_hw_params_get_periods(hp, &periods, &dir));
|
||||||
|
if(dir != 0)
|
||||||
|
WARN("Inexact period count: %u (%d)\n", periods, dir);
|
||||||
|
|
||||||
snd_pcm_hw_params_free(hp);
|
snd_pcm_hw_params_free(hp);
|
||||||
hp = NULL;
|
hp = NULL;
|
||||||
|
|||||||
@@ -137,8 +137,8 @@ static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *
|
|||||||
|
|
||||||
static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
||||||
{
|
{
|
||||||
ComponentDescription desc;
|
AudioComponentDescription desc;
|
||||||
Component comp;
|
AudioComponent comp;
|
||||||
ca_data *data;
|
ca_data *data;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
@@ -154,19 +154,19 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
desc.componentFlags = 0;
|
desc.componentFlags = 0;
|
||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
|
|
||||||
comp = FindNextComponent(NULL, &desc);
|
comp = AudioComponentFindNext(NULL, &desc);
|
||||||
if(comp == NULL)
|
if(comp == NULL)
|
||||||
{
|
{
|
||||||
ERR("FindNextComponent failed\n");
|
ERR("AudioComponentFindNext failed\n");
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
data = calloc(1, sizeof(*data));
|
data = calloc(1, sizeof(*data));
|
||||||
|
|
||||||
err = OpenAComponent(comp, &data->audioUnit);
|
err = AudioComponentInstanceNew(comp, &data->audioUnit);
|
||||||
if(err != noErr)
|
if(err != noErr)
|
||||||
{
|
{
|
||||||
ERR("OpenAComponent failed\n");
|
ERR("AudioComponentInstanceNew failed\n");
|
||||||
free(data);
|
free(data);
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
if(err != noErr)
|
if(err != noErr)
|
||||||
{
|
{
|
||||||
ERR("AudioUnitInitialize failed\n");
|
ERR("AudioUnitInitialize failed\n");
|
||||||
CloseComponent(data->audioUnit);
|
AudioComponentInstanceDispose(data->audioUnit);
|
||||||
free(data);
|
free(data);
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
@@ -191,7 +191,7 @@ static void ca_close_playback(ALCdevice *device)
|
|||||||
ca_data *data = (ca_data*)device->ExtraData;
|
ca_data *data = (ca_data*)device->ExtraData;
|
||||||
|
|
||||||
AudioUnitUninitialize(data->audioUnit);
|
AudioUnitUninitialize(data->audioUnit);
|
||||||
CloseComponent(data->audioUnit);
|
AudioComponentInstanceDispose(data->audioUnit);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
device->ExtraData = NULL;
|
device->ExtraData = NULL;
|
||||||
@@ -374,12 +374,13 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
AudioStreamBasicDescription hardwareFormat; // The hardware format
|
AudioStreamBasicDescription hardwareFormat; // The hardware format
|
||||||
AudioStreamBasicDescription outputFormat; // The AudioUnit output format
|
AudioStreamBasicDescription outputFormat; // The AudioUnit output format
|
||||||
AURenderCallbackStruct input;
|
AURenderCallbackStruct input;
|
||||||
ComponentDescription desc;
|
AudioComponentDescription desc;
|
||||||
AudioDeviceID inputDevice;
|
AudioDeviceID inputDevice;
|
||||||
UInt32 outputFrameCount;
|
UInt32 outputFrameCount;
|
||||||
UInt32 propertySize;
|
UInt32 propertySize;
|
||||||
|
AudioObjectPropertyAddress propertyAddress;
|
||||||
UInt32 enableIO;
|
UInt32 enableIO;
|
||||||
Component comp;
|
AudioComponent comp;
|
||||||
ca_data *data;
|
ca_data *data;
|
||||||
OSStatus err;
|
OSStatus err;
|
||||||
|
|
||||||
@@ -395,10 +396,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
desc.componentFlagsMask = 0;
|
desc.componentFlagsMask = 0;
|
||||||
|
|
||||||
// Search for component with given description
|
// Search for component with given description
|
||||||
comp = FindNextComponent(NULL, &desc);
|
comp = AudioComponentFindNext(NULL, &desc);
|
||||||
if(comp == NULL)
|
if(comp == NULL)
|
||||||
{
|
{
|
||||||
ERR("FindNextComponent failed\n");
|
ERR("AudioComponentFindNext failed\n");
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,10 +407,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
device->ExtraData = data;
|
device->ExtraData = data;
|
||||||
|
|
||||||
// Open the component
|
// Open the component
|
||||||
err = OpenAComponent(comp, &data->audioUnit);
|
err = AudioComponentInstanceNew(comp, &data->audioUnit);
|
||||||
if(err != noErr)
|
if(err != noErr)
|
||||||
{
|
{
|
||||||
ERR("OpenAComponent failed\n");
|
ERR("AudioComponentInstanceNew failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,11 +433,16 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the default input device
|
// Get the default input device
|
||||||
|
|
||||||
propertySize = sizeof(AudioDeviceID);
|
propertySize = sizeof(AudioDeviceID);
|
||||||
err = AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &propertySize, &inputDevice);
|
propertyAddress.mSelector = kAudioHardwarePropertyDefaultInputDevice;
|
||||||
|
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
|
||||||
|
propertyAddress.mElement = kAudioObjectPropertyElementMaster;
|
||||||
|
|
||||||
|
err = AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, 0, NULL, &propertySize, &inputDevice);
|
||||||
if(err != noErr)
|
if(err != noErr)
|
||||||
{
|
{
|
||||||
ERR("AudioHardwareGetProperty failed\n");
|
ERR("AudioObjectGetPropertyData failed\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -596,7 +602,7 @@ error:
|
|||||||
if(data->audioConverter)
|
if(data->audioConverter)
|
||||||
AudioConverterDispose(data->audioConverter);
|
AudioConverterDispose(data->audioConverter);
|
||||||
if(data->audioUnit)
|
if(data->audioUnit)
|
||||||
CloseComponent(data->audioUnit);
|
AudioComponentInstanceDispose(data->audioUnit);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
device->ExtraData = NULL;
|
device->ExtraData = NULL;
|
||||||
@@ -613,7 +619,7 @@ static void ca_close_capture(ALCdevice *device)
|
|||||||
destroy_buffer_list(data->bufferList);
|
destroy_buffer_list(data->bufferList);
|
||||||
|
|
||||||
AudioConverterDispose(data->audioConverter);
|
AudioConverterDispose(data->audioConverter);
|
||||||
CloseComponent(data->audioUnit);
|
AudioComponentInstanceDispose(data->audioUnit);
|
||||||
|
|
||||||
free(data);
|
free(data);
|
||||||
device->ExtraData = NULL;
|
device->ExtraData = NULL;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
|
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
|
||||||
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
|
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71);
|
||||||
|
|
||||||
#define DEVNAME_TAIL " on OpenAL Soft"
|
#define DEVNAME_HEAD "OpenAL Soft on "
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_DYNLOAD
|
#ifdef HAVE_DYNLOAD
|
||||||
@@ -145,13 +145,12 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
|
|||||||
{
|
{
|
||||||
const DevMap *iter;
|
const DevMap *iter;
|
||||||
|
|
||||||
al_string_copy_wcstr(&entry.name, desc);
|
al_string_copy_cstr(&entry.name, DEVNAME_HEAD);
|
||||||
if(count == 0)
|
al_string_append_wcstr(&entry.name, desc);
|
||||||
al_string_append_cstr(&entry.name, DEVNAME_TAIL);
|
if(count != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char str[64];
|
char str[64];
|
||||||
snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
|
snprintf(str, sizeof(str), " #%d", count+1);
|
||||||
al_string_append_cstr(&entry.name, str);
|
al_string_append_cstr(&entry.name, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_FormFactor, 0x1da5d803, 0xd492, 0x4edd, 0x
|
|||||||
#define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
|
#define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT)
|
||||||
#define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER)
|
#define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER)
|
||||||
|
|
||||||
#define DEVNAME_TAIL " on OpenAL Soft"
|
#define DEVNAME_HEAD "OpenAL Soft on "
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -125,10 +125,13 @@ static void get_device_name(IMMDevice *device, al_string *name)
|
|||||||
PROPVARIANT pvname;
|
PROPVARIANT pvname;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
|
al_string_copy_cstr(name, DEVNAME_HEAD);
|
||||||
|
|
||||||
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);
|
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
|
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
|
||||||
|
al_string_append_cstr(name, "Unknown Device Name");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,11 +139,17 @@ static void get_device_name(IMMDevice *device, al_string *name)
|
|||||||
|
|
||||||
hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pvname);
|
hr = IPropertyStore_GetValue(ps, (const PROPERTYKEY*)&DEVPKEY_Device_FriendlyName, &pvname);
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
|
{
|
||||||
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
|
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
|
||||||
|
al_string_append_cstr(name, "Unknown Device Name");
|
||||||
|
}
|
||||||
else if(pvname.vt == VT_LPWSTR)
|
else if(pvname.vt == VT_LPWSTR)
|
||||||
al_string_copy_wcstr(name, pvname.pwszVal);
|
al_string_append_wcstr(name, pvname.pwszVal);
|
||||||
else
|
else
|
||||||
|
{
|
||||||
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt);
|
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt);
|
||||||
|
al_string_append_cstr(name, "Unknown Device Name");
|
||||||
|
}
|
||||||
|
|
||||||
PropVariantClear(&pvname);
|
PropVariantClear(&pvname);
|
||||||
IPropertyStore_Release(ps);
|
IPropertyStore_Release(ps);
|
||||||
@@ -193,12 +202,10 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list)
|
|||||||
const DevMap *iter;
|
const DevMap *iter;
|
||||||
|
|
||||||
al_string_copy(&entry.name, tmpname);
|
al_string_copy(&entry.name, tmpname);
|
||||||
if(count == 0)
|
if(count != 0)
|
||||||
al_string_append_cstr(&entry.name, DEVNAME_TAIL);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char str[64];
|
char str[64];
|
||||||
snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
|
snprintf(str, sizeof(str), " #%d", count+1);
|
||||||
al_string_append_cstr(&entry.name, str);
|
al_string_append_cstr(&entry.name, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -755,10 +762,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self)
|
|||||||
{
|
{
|
||||||
self->client = ptr;
|
self->client = ptr;
|
||||||
if(al_string_empty(device->DeviceName))
|
if(al_string_empty(device->DeviceName))
|
||||||
{
|
|
||||||
get_device_name(self->mmdev, &device->DeviceName);
|
get_device_name(self->mmdev, &device->DeviceName);
|
||||||
al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
@@ -1412,10 +1416,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self)
|
|||||||
{
|
{
|
||||||
self->client = ptr;
|
self->client = ptr;
|
||||||
if(al_string_empty(device->DeviceName))
|
if(al_string_empty(device->DeviceName))
|
||||||
{
|
|
||||||
get_device_name(self->mmdev, &device->DeviceName);
|
get_device_name(self->mmdev, &device->DeviceName);
|
||||||
al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(FAILED(hr))
|
if(FAILED(hr))
|
||||||
|
|||||||
@@ -22,10 +22,12 @@
|
|||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <memory.h>
|
#include <memory.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@@ -51,11 +53,175 @@
|
|||||||
#define SOUND_MIXER_WRITE MIXER_WRITE
|
#define SOUND_MIXER_WRITE MIXER_WRITE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(SOUND_VERSION) && (SOUND_VERSION < 0x040000)
|
||||||
|
#define ALC_OSS_COMPAT
|
||||||
|
#endif
|
||||||
|
#ifndef SNDCTL_AUDIOINFO
|
||||||
|
#define ALC_OSS_COMPAT
|
||||||
|
#endif
|
||||||
|
|
||||||
static const ALCchar oss_device[] = "OSS Default";
|
/*
|
||||||
|
* FreeBSD strongly discourages the use of specific devices,
|
||||||
|
* such as those returned in oss_audioinfo.devnode
|
||||||
|
*/
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define ALC_OSS_DEVNODE_TRUC
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *oss_driver = "/dev/dsp";
|
struct oss_device {
|
||||||
static const char *oss_capture = "/dev/dsp";
|
const ALCchar *handle;
|
||||||
|
const char *path;
|
||||||
|
struct oss_device *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct oss_device oss_playback = {
|
||||||
|
"OSS Default",
|
||||||
|
"/dev/dsp",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static struct oss_device oss_capture = {
|
||||||
|
"OSS Default",
|
||||||
|
"/dev/dsp",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef ALC_OSS_COMPAT
|
||||||
|
|
||||||
|
static void ALCossListPopulate(struct oss_device *UNUSED(playback), struct oss_device *UNUSED(capture))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#ifndef HAVE_STRNLEN
|
||||||
|
static size_t strnlen(const char *str, size_t maxlen)
|
||||||
|
{
|
||||||
|
const char *end = memchr(str, 0, maxlen);
|
||||||
|
if(!end) return maxlen;
|
||||||
|
return end - str;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void ALCossListAppend(struct oss_device *list, const char *handle, size_t hlen, const char *path, size_t plen)
|
||||||
|
{
|
||||||
|
struct oss_device *next;
|
||||||
|
struct oss_device *last;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
/* skip the first item "OSS Default" */
|
||||||
|
last = list;
|
||||||
|
next = list->next;
|
||||||
|
#ifdef ALC_OSS_DEVNODE_TRUC
|
||||||
|
for(i = 0;i < plen;i++)
|
||||||
|
{
|
||||||
|
if(path[i] == '.')
|
||||||
|
{
|
||||||
|
if(strncmp(path + i, handle + hlen + i - plen, plen - i) == 0)
|
||||||
|
hlen = hlen + i - plen;
|
||||||
|
plen = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
(void)i;
|
||||||
|
#endif
|
||||||
|
if(handle[0] == '\0')
|
||||||
|
{
|
||||||
|
handle = path;
|
||||||
|
hlen = plen;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(next != NULL)
|
||||||
|
{
|
||||||
|
if(strncmp(next->path, path, plen) == 0)
|
||||||
|
return;
|
||||||
|
last = next;
|
||||||
|
next = next->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
next = (struct oss_device*)malloc(sizeof(struct oss_device) + hlen + plen + 2);
|
||||||
|
next->handle = (char*)(next + 1);
|
||||||
|
next->path = next->handle + hlen + 1;
|
||||||
|
next->next = NULL;
|
||||||
|
last->next = next;
|
||||||
|
|
||||||
|
strncpy((char*)next->handle, handle, hlen);
|
||||||
|
((char*)next->handle)[hlen] = '\0';
|
||||||
|
strncpy((char*)next->path, path, plen);
|
||||||
|
((char*)next->path)[plen] = '\0';
|
||||||
|
|
||||||
|
TRACE("Got device \"%s\", \"%s\"\n", next->handle, next->path);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ALCossListPopulate(struct oss_device *playback, struct oss_device *capture)
|
||||||
|
{
|
||||||
|
struct oss_sysinfo si;
|
||||||
|
struct oss_audioinfo ai;
|
||||||
|
int fd, i;
|
||||||
|
|
||||||
|
if((fd=open("/dev/mixer", O_RDONLY)) < 0)
|
||||||
|
{
|
||||||
|
ERR("Could not open /dev/mixer\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(ioctl(fd, SNDCTL_SYSINFO, &si) == -1)
|
||||||
|
{
|
||||||
|
ERR("SNDCTL_SYSINFO failed: %s\n", strerror(errno));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
for(i = 0;i < si.numaudios;i++)
|
||||||
|
{
|
||||||
|
const char *handle;
|
||||||
|
size_t len;
|
||||||
|
|
||||||
|
ai.dev = i;
|
||||||
|
if(ioctl(fd, SNDCTL_AUDIOINFO, &ai) == -1)
|
||||||
|
{
|
||||||
|
ERR("SNDCTL_AUDIOINFO (%d) failed: %s\n", i, strerror(errno));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(ai.devnode[0] == '\0')
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(ai.handle[0] != '\0')
|
||||||
|
{
|
||||||
|
len = strnlen(ai.handle, sizeof(ai.handle));
|
||||||
|
handle = ai.handle;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
len = strnlen(ai.name, sizeof(ai.name));
|
||||||
|
handle = ai.name;
|
||||||
|
}
|
||||||
|
if((ai.caps&DSP_CAP_INPUT) && capture != NULL)
|
||||||
|
ALCossListAppend(capture, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode)));
|
||||||
|
if((ai.caps&DSP_CAP_OUTPUT) && playback != NULL)
|
||||||
|
ALCossListAppend(playback, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode)));
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void ALCossListFree(struct oss_device *list)
|
||||||
|
{
|
||||||
|
struct oss_device *cur;
|
||||||
|
if(list == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* skip the first item "OSS Default" */
|
||||||
|
cur = list->next;
|
||||||
|
list->next = NULL;
|
||||||
|
|
||||||
|
while(cur != NULL)
|
||||||
|
{
|
||||||
|
struct oss_device *next = cur->next;
|
||||||
|
free(cur);
|
||||||
|
cur = next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int log2i(ALCuint x)
|
static int log2i(ALCuint x)
|
||||||
{
|
{
|
||||||
@@ -68,7 +234,6 @@ static int log2i(ALCuint x)
|
|||||||
return y;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct ALCplaybackOSS {
|
typedef struct ALCplaybackOSS {
|
||||||
DERIVE_FROM_TYPE(ALCbackend);
|
DERIVE_FROM_TYPE(ALCbackend);
|
||||||
|
|
||||||
@@ -152,19 +317,29 @@ static void ALCplaybackOSS_Construct(ALCplaybackOSS *self, ALCdevice *device)
|
|||||||
|
|
||||||
static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name)
|
static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name)
|
||||||
{
|
{
|
||||||
|
struct oss_device *dev = &oss_playback;
|
||||||
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
|
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
|
||||||
|
|
||||||
if(!name)
|
if(!name)
|
||||||
name = oss_device;
|
name = dev->handle;
|
||||||
else if(strcmp(name, oss_device) != 0)
|
else
|
||||||
return ALC_INVALID_VALUE;
|
{
|
||||||
|
while (dev != NULL)
|
||||||
|
{
|
||||||
|
if (strcmp(dev->handle, name) == 0)
|
||||||
|
break;
|
||||||
|
dev = dev->next;
|
||||||
|
}
|
||||||
|
if (dev == NULL)
|
||||||
|
return ALC_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
self->killNow = 0;
|
self->killNow = 0;
|
||||||
|
|
||||||
self->fd = open(oss_driver, O_WRONLY);
|
self->fd = open(dev->path, O_WRONLY);
|
||||||
if(self->fd == -1)
|
if(self->fd == -1)
|
||||||
{
|
{
|
||||||
ERR("Could not open %s: %s\n", oss_driver, strerror(errno));
|
ERR("Could not open %s: %s\n", dev->path, strerror(errno));
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +557,7 @@ static void ALCcaptureOSS_Construct(ALCcaptureOSS *self, ALCdevice *device)
|
|||||||
static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
|
static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
|
||||||
{
|
{
|
||||||
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
|
ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice;
|
||||||
|
struct oss_device *dev = &oss_capture;
|
||||||
int numFragmentsLogSize;
|
int numFragmentsLogSize;
|
||||||
int log2FragmentSize;
|
int log2FragmentSize;
|
||||||
unsigned int periods;
|
unsigned int periods;
|
||||||
@@ -393,14 +569,23 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name)
|
|||||||
char *err;
|
char *err;
|
||||||
|
|
||||||
if(!name)
|
if(!name)
|
||||||
name = oss_device;
|
name = dev->handle;
|
||||||
else if(strcmp(name, oss_device) != 0)
|
else
|
||||||
return ALC_INVALID_VALUE;
|
{
|
||||||
|
while (dev != NULL)
|
||||||
|
{
|
||||||
|
if (strcmp(dev->handle, name) == 0)
|
||||||
|
break;
|
||||||
|
dev = dev->next;
|
||||||
|
}
|
||||||
|
if (dev == NULL)
|
||||||
|
return ALC_INVALID_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
self->fd = open(oss_capture, O_RDONLY);
|
self->fd = open(dev->path, O_RDONLY);
|
||||||
if(self->fd == -1)
|
if(self->fd == -1)
|
||||||
{
|
{
|
||||||
ERR("Could not open %s: %s\n", oss_capture, strerror(errno));
|
ERR("Could not open %s: %s\n", dev->path, strerror(errno));
|
||||||
return ALC_INVALID_VALUE;
|
return ALC_INVALID_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,7 +731,7 @@ typedef struct ALCossBackendFactory {
|
|||||||
ALCbackendFactory *ALCossBackendFactory_getFactory(void);
|
ALCbackendFactory *ALCossBackendFactory_getFactory(void);
|
||||||
|
|
||||||
static ALCboolean ALCossBackendFactory_init(ALCossBackendFactory *self);
|
static ALCboolean ALCossBackendFactory_init(ALCossBackendFactory *self);
|
||||||
static DECLARE_FORWARD(ALCossBackendFactory, ALCbackendFactory, void, deinit)
|
static void ALCossBackendFactory_deinit(ALCossBackendFactory *self);
|
||||||
static ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory *self, ALCbackend_Type type);
|
static ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory *self, ALCbackend_Type type);
|
||||||
static void ALCossBackendFactory_probe(ALCossBackendFactory *self, enum DevProbe type);
|
static void ALCossBackendFactory_probe(ALCossBackendFactory *self, enum DevProbe type);
|
||||||
static ALCbackend* ALCossBackendFactory_createBackend(ALCossBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
static ALCbackend* ALCossBackendFactory_createBackend(ALCossBackendFactory *self, ALCdevice *device, ALCbackend_Type type);
|
||||||
@@ -562,12 +747,19 @@ ALCbackendFactory *ALCossBackendFactory_getFactory(void)
|
|||||||
|
|
||||||
ALCboolean ALCossBackendFactory_init(ALCossBackendFactory* UNUSED(self))
|
ALCboolean ALCossBackendFactory_init(ALCossBackendFactory* UNUSED(self))
|
||||||
{
|
{
|
||||||
ConfigValueStr(NULL, "oss", "device", &oss_driver);
|
ConfigValueStr(NULL, "oss", "device", &oss_playback.path);
|
||||||
ConfigValueStr(NULL, "oss", "capture", &oss_capture);
|
ConfigValueStr(NULL, "oss", "capture", &oss_capture.path);
|
||||||
|
|
||||||
return ALC_TRUE;
|
return ALC_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ALCossBackendFactory_deinit(ALCossBackendFactory* UNUSED(self))
|
||||||
|
{
|
||||||
|
ALCossListFree(&oss_playback);
|
||||||
|
ALCossListFree(&oss_capture);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self), ALCbackend_Type type)
|
ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self), ALCbackend_Type type)
|
||||||
{
|
{
|
||||||
if(type == ALCbackend_Playback || type == ALCbackend_Capture)
|
if(type == ALCbackend_Playback || type == ALCbackend_Capture)
|
||||||
@@ -581,21 +773,27 @@ void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProb
|
|||||||
{
|
{
|
||||||
case ALL_DEVICE_PROBE:
|
case ALL_DEVICE_PROBE:
|
||||||
{
|
{
|
||||||
#ifdef HAVE_STAT
|
struct oss_device *cur = &oss_playback;
|
||||||
struct stat buf;
|
ALCossListFree(cur);
|
||||||
if(stat(oss_driver, &buf) == 0)
|
ALCossListPopulate(cur, NULL);
|
||||||
#endif
|
while (cur != NULL)
|
||||||
AppendAllDevicesList(oss_device);
|
{
|
||||||
|
AppendAllDevicesList(cur->handle);
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CAPTURE_DEVICE_PROBE:
|
case CAPTURE_DEVICE_PROBE:
|
||||||
{
|
{
|
||||||
#ifdef HAVE_STAT
|
struct oss_device *cur = &oss_capture;
|
||||||
struct stat buf;
|
ALCossListFree(cur);
|
||||||
if(stat(oss_capture, &buf) == 0)
|
ALCossListPopulate(NULL, cur);
|
||||||
#endif
|
while (cur != NULL)
|
||||||
AppendCaptureDeviceList(oss_device);
|
{
|
||||||
|
AppendCaptureDeviceList(cur->handle);
|
||||||
|
cur = cur->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <sys/time.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|||||||
@@ -56,16 +56,14 @@ static const ALubyte SUBTYPE_BFORMAT_FLOAT[] = {
|
|||||||
|
|
||||||
static void fwrite16le(ALushort val, FILE *f)
|
static void fwrite16le(ALushort val, FILE *f)
|
||||||
{
|
{
|
||||||
fputc(val&0xff, f);
|
ALubyte data[2] = { val&0xff, (val>>8)&0xff };
|
||||||
fputc((val>>8)&0xff, f);
|
fwrite(data, 1, 2, f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fwrite32le(ALuint val, FILE *f)
|
static void fwrite32le(ALuint val, FILE *f)
|
||||||
{
|
{
|
||||||
fputc(val&0xff, f);
|
ALubyte data[4] = { val&0xff, (val>>8)&0xff, (val>>16)&0xff, (val>>24)&0xff };
|
||||||
fputc((val>>8)&0xff, f);
|
fwrite(data, 1, 4, f);
|
||||||
fputc((val>>16)&0xff, f);
|
|
||||||
fputc((val>>24)&0xff, f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEVNAME_TAIL " on OpenAL Soft"
|
#define DEVNAME_HEAD "OpenAL Soft on "
|
||||||
|
|
||||||
|
|
||||||
static vector_al_string PlaybackDevices;
|
static vector_al_string PlaybackDevices;
|
||||||
@@ -71,13 +71,12 @@ static void ProbePlaybackDevices(void)
|
|||||||
ALuint count = 0;
|
ALuint count = 0;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
al_string_copy_wcstr(&dname, WaveCaps.szPname);
|
al_string_copy_cstr(&dname, DEVNAME_HEAD);
|
||||||
if(count == 0)
|
al_string_append_wcstr(&dname, WaveCaps.szPname);
|
||||||
al_string_append_cstr(&dname, DEVNAME_TAIL);
|
if(count != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char str[64];
|
char str[64];
|
||||||
snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
|
snprintf(str, sizeof(str), " #%d", count+1);
|
||||||
al_string_append_cstr(&dname, str);
|
al_string_append_cstr(&dname, str);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
@@ -115,13 +114,12 @@ static void ProbeCaptureDevices(void)
|
|||||||
ALuint count = 0;
|
ALuint count = 0;
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
al_string_copy_wcstr(&dname, WaveCaps.szPname);
|
al_string_copy_cstr(&dname, DEVNAME_HEAD);
|
||||||
if(count == 0)
|
al_string_append_wcstr(&dname, WaveCaps.szPname);
|
||||||
al_string_append_cstr(&dname, DEVNAME_TAIL);
|
if(count != 0)
|
||||||
else
|
|
||||||
{
|
{
|
||||||
char str[64];
|
char str[64];
|
||||||
snprintf(str, sizeof(str), " #%d"DEVNAME_TAIL, count+1);
|
snprintf(str, sizeof(str), " #%d", count+1);
|
||||||
al_string_append_cstr(&dname, str);
|
al_string_append_cstr(&dname, str);
|
||||||
}
|
}
|
||||||
count++;
|
count++;
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
|
|||||||
for(it = 0;it < td;it++)
|
for(it = 0;it < td;it++)
|
||||||
{
|
{
|
||||||
ALfloat smp = SamplesIn[it+base];
|
ALfloat smp = SamplesIn[it+base];
|
||||||
|
ALfloat a[3], b[3];
|
||||||
ALfloat alpha, w0;
|
ALfloat alpha, w0;
|
||||||
ALfloat amplitude;
|
ALfloat amplitude;
|
||||||
ALfloat cutoff;
|
ALfloat cutoff;
|
||||||
@@ -117,19 +118,18 @@ static ALvoid ALautowahState_process(ALautowahState *state, ALuint SamplesToDo,
|
|||||||
/* FIXME: Resonance controls the resonant peak, or Q. How? Not sure
|
/* FIXME: Resonance controls the resonant peak, or Q. How? Not sure
|
||||||
* that Q = resonance*0.1. */
|
* that Q = resonance*0.1. */
|
||||||
alpha = sinf(w0) / (2.0f * state->Resonance*0.1f);
|
alpha = sinf(w0) / (2.0f * state->Resonance*0.1f);
|
||||||
state->LowPass.b[0] = (1.0f - cosf(w0)) / 2.0f;
|
b[0] = (1.0f - cosf(w0)) / 2.0f;
|
||||||
state->LowPass.b[1] = 1.0f - cosf(w0);
|
b[1] = 1.0f - cosf(w0);
|
||||||
state->LowPass.b[2] = (1.0f - cosf(w0)) / 2.0f;
|
b[2] = (1.0f - cosf(w0)) / 2.0f;
|
||||||
state->LowPass.a[0] = 1.0f + alpha;
|
a[0] = 1.0f + alpha;
|
||||||
state->LowPass.a[1] = -2.0f * cosf(w0);
|
a[1] = -2.0f * cosf(w0);
|
||||||
state->LowPass.a[2] = 1.0f - alpha;
|
a[2] = 1.0f - alpha;
|
||||||
|
|
||||||
state->LowPass.b[2] /= state->LowPass.a[0];
|
state->LowPass.a1 = a[1] / a[0];
|
||||||
state->LowPass.b[1] /= state->LowPass.a[0];
|
state->LowPass.a2 = a[2] / a[0];
|
||||||
state->LowPass.b[0] /= state->LowPass.a[0];
|
state->LowPass.b1 = b[1] / a[0];
|
||||||
state->LowPass.a[2] /= state->LowPass.a[0];
|
state->LowPass.b2 = b[2] / a[0];
|
||||||
state->LowPass.a[1] /= state->LowPass.a[0];
|
state->LowPass.input_gain = b[0] / a[0];
|
||||||
state->LowPass.a[0] /= state->LowPass.a[0];
|
|
||||||
|
|
||||||
temps[it] = ALfilterState_processSingle(&state->LowPass, smp);
|
temps[it] = ALfilterState_processSingle(&state->LowPass, smp);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesTo
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(i = 0;i < SamplesToDo;i++)
|
for(i = 0;i < SamplesToDo;i++)
|
||||||
SamplesOut[c][i] = SamplesIn[i] * gains[c];
|
SamplesOut[c][i] += SamplesIn[i] * gains[c];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -142,12 +142,11 @@ static ALvoid ALmodulatorState_update(ALmodulatorState *state, ALCdevice *Device
|
|||||||
cw = cosf(F_TAU * Slot->EffectProps.Modulator.HighPassCutoff / Device->Frequency);
|
cw = cosf(F_TAU * Slot->EffectProps.Modulator.HighPassCutoff / Device->Frequency);
|
||||||
a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f);
|
a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f);
|
||||||
|
|
||||||
state->Filter.b[0] = a;
|
state->Filter.a1 = -a;
|
||||||
state->Filter.b[1] = -a;
|
state->Filter.a2 = 0.0f;
|
||||||
state->Filter.b[2] = 0.0f;
|
state->Filter.b1 = -a;
|
||||||
state->Filter.a[0] = 1.0f;
|
state->Filter.b2 = 0.0f;
|
||||||
state->Filter.a[1] = -a;
|
state->Filter.input_gain = a;
|
||||||
state->Filter.a[2] = 0.0f;
|
|
||||||
|
|
||||||
ComputeAmbientGains(Device, Slot->Gain, state->Gain);
|
ComputeAmbientGains(Device, Slot->Gain, state->Gain);
|
||||||
}
|
}
|
||||||
|
|||||||
+161
-28
@@ -364,6 +364,11 @@ void RestoreFPUMode(const FPUCtl *ctl)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int StringSortCompare(const void *str1, const void *str2)
|
||||||
|
{
|
||||||
|
return al_string_cmp(*(const_al_string*)str1, *(const_al_string*)str2);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static WCHAR *FromUTF8(const char *str)
|
static WCHAR *FromUTF8(const char *str)
|
||||||
@@ -549,6 +554,13 @@ FILE *OpenDataFile(const char *fname, const char *subdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static size_t strlenW(const WCHAR *str)
|
||||||
|
{
|
||||||
|
const WCHAR *end = str;
|
||||||
|
while(*end) ++end;
|
||||||
|
return end-str;
|
||||||
|
}
|
||||||
|
|
||||||
static const WCHAR *strchrW(const WCHAR *str, WCHAR ch)
|
static const WCHAR *strchrW(const WCHAR *str, WCHAR ch)
|
||||||
{
|
{
|
||||||
for(;*str != 0;++str)
|
for(;*str != 0;++str)
|
||||||
@@ -570,9 +582,27 @@ static const WCHAR *strrchrW(const WCHAR *str, WCHAR ch)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const WCHAR *strstrW(const WCHAR *haystack, const WCHAR *needle)
|
||||||
|
{
|
||||||
|
size_t len = strlenW(needle);
|
||||||
|
while(*haystack != 0)
|
||||||
|
{
|
||||||
|
if(CompareStringW(GetThreadLocale(), NORM_IGNORECASE,
|
||||||
|
haystack, len, needle, len) == CSTR_EQUAL)
|
||||||
|
return haystack;
|
||||||
|
|
||||||
|
do {
|
||||||
|
++haystack;
|
||||||
|
} while(((*haystack)&0xC000) == 0x8000);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Compares the filename in the find data with the match string. The match
|
/* Compares the filename in the find data with the match string. The match
|
||||||
* string may contain the "%r" marker to signifiy a sample rate (really any
|
* string may contain the "%r" marker to signifiy a sample rate (really any
|
||||||
* positive integer), or "%%" to signify a single '%'.
|
* positive integer), "%%" to signify a single '%', or "%s" for a (non-greedy)
|
||||||
|
* string.
|
||||||
*/
|
*/
|
||||||
static int MatchFilter(const WCHAR *match, const WIN32_FIND_DATAW *fdata)
|
static int MatchFilter(const WCHAR *match, const WIN32_FIND_DATAW *fdata)
|
||||||
{
|
{
|
||||||
@@ -608,6 +638,40 @@ static int MatchFilter(const WCHAR *match, const WIN32_FIND_DATAW *fdata)
|
|||||||
ret = l > 0;
|
ret = l > 0;
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
else if(*p == 's')
|
||||||
|
{
|
||||||
|
const WCHAR *next = p+1;
|
||||||
|
if(*next != '\0' && *next != '%')
|
||||||
|
{
|
||||||
|
const WCHAR *next_p = strchrW(next, '%');
|
||||||
|
const WCHAR *m;
|
||||||
|
|
||||||
|
if(!next_p)
|
||||||
|
m = strstrW(name, next);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WCHAR *tmp = malloc((next_p - next + 1) * 2);
|
||||||
|
memcpy(tmp, next, (next_p - next) * 2);
|
||||||
|
tmp[next_p - next] = 0;
|
||||||
|
|
||||||
|
m = strstrW(name, tmp);
|
||||||
|
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = !!m;
|
||||||
|
if(ret)
|
||||||
|
{
|
||||||
|
size_t l;
|
||||||
|
if(next_p) l = next_p - next;
|
||||||
|
else l = strlenW(next);
|
||||||
|
|
||||||
|
name = m + l;
|
||||||
|
next += l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,6 +711,7 @@ static void RecurseDirectorySearch(const char *path, const WCHAR *match, vector_
|
|||||||
hdl = FindFirstFileW(wpath, &fdata);
|
hdl = FindFirstFileW(wpath, &fdata);
|
||||||
if(hdl != INVALID_HANDLE_VALUE)
|
if(hdl != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
|
size_t base = VECTOR_SIZE(*results);
|
||||||
do {
|
do {
|
||||||
if(MatchFilter(match, &fdata))
|
if(MatchFilter(match, &fdata))
|
||||||
{
|
{
|
||||||
@@ -659,6 +724,10 @@ static void RecurseDirectorySearch(const char *path, const WCHAR *match, vector_
|
|||||||
}
|
}
|
||||||
} while(FindNextFileW(hdl, &fdata));
|
} while(FindNextFileW(hdl, &fdata));
|
||||||
FindClose(hdl);
|
FindClose(hdl);
|
||||||
|
|
||||||
|
if(VECTOR_SIZE(*results) > base)
|
||||||
|
qsort(VECTOR_ITER_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||||
|
sizeof(VECTOR_FRONT(*results)), StringSortCompare);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(wpath);
|
free(wpath);
|
||||||
@@ -785,8 +854,17 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
|||||||
al_string path = AL_STRING_INIT_STATIC();
|
al_string path = AL_STRING_INIT_STATIC();
|
||||||
WCHAR *cwdbuf;
|
WCHAR *cwdbuf;
|
||||||
|
|
||||||
/* Search the CWD. */
|
/* Search the app-local directory. */
|
||||||
if(!(cwdbuf=_wgetcwd(NULL, 0)))
|
if((cwdbuf=_wgetenv(L"ALSOFT_LOCAL_PATH")) && *cwdbuf != '\0')
|
||||||
|
{
|
||||||
|
al_string_copy_wcstr(&path, cwdbuf);
|
||||||
|
if(is_slash(VECTOR_BACK(path)))
|
||||||
|
{
|
||||||
|
VECTOR_POP_BACK(path);
|
||||||
|
*VECTOR_ITER_END(path) = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!(cwdbuf=_wgetcwd(NULL, 0)))
|
||||||
al_string_copy_cstr(&path, ".");
|
al_string_copy_cstr(&path, ".");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -798,6 +876,9 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
|||||||
}
|
}
|
||||||
free(cwdbuf);
|
free(cwdbuf);
|
||||||
}
|
}
|
||||||
|
#define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0)
|
||||||
|
VECTOR_FOR_EACH(char, path, FIX_SLASH);
|
||||||
|
#undef FIX_SLASH
|
||||||
RecurseDirectorySearch(al_string_get_cstr(path), wmatch, &results);
|
RecurseDirectorySearch(al_string_get_cstr(path), wmatch, &results);
|
||||||
|
|
||||||
/* Search the local and global data dirs. */
|
/* Search the local and global data dirs. */
|
||||||
@@ -945,11 +1026,8 @@ FILE *OpenDataFile(const char *fname, const char *subdir)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const char *MatchString;
|
static int MatchFilter(const char *name, const char *match)
|
||||||
static int MatchFilter(const struct dirent *dir)
|
|
||||||
{
|
{
|
||||||
const char *match = MatchString;
|
|
||||||
const char *name = dir->d_name;
|
|
||||||
int ret = 1;
|
int ret = 1;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@@ -973,6 +1051,40 @@ static int MatchFilter(const struct dirent *dir)
|
|||||||
if(ret) name = end;
|
if(ret) name = end;
|
||||||
++p;
|
++p;
|
||||||
}
|
}
|
||||||
|
else if(*p == 's')
|
||||||
|
{
|
||||||
|
const char *next = p+1;
|
||||||
|
if(*next != '\0' && *next != '%')
|
||||||
|
{
|
||||||
|
const char *next_p = strchr(next, '%');
|
||||||
|
const char *m;
|
||||||
|
|
||||||
|
if(!next_p)
|
||||||
|
m = strstr(name, next);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char *tmp = malloc(next_p - next + 1);
|
||||||
|
memcpy(tmp, next, next_p - next);
|
||||||
|
tmp[next_p - next] = 0;
|
||||||
|
|
||||||
|
m = strstr(name, tmp);
|
||||||
|
|
||||||
|
free(tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = !!m;
|
||||||
|
if(ret)
|
||||||
|
{
|
||||||
|
size_t l;
|
||||||
|
if(next_p) l = next_p - next;
|
||||||
|
else l = strlen(next);
|
||||||
|
|
||||||
|
name = m + l;
|
||||||
|
next += l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p = next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -984,9 +1096,7 @@ static int MatchFilter(const struct dirent *dir)
|
|||||||
|
|
||||||
static void RecurseDirectorySearch(const char *path, const char *match, vector_al_string *results)
|
static void RecurseDirectorySearch(const char *path, const char *match, vector_al_string *results)
|
||||||
{
|
{
|
||||||
struct dirent **namelist;
|
|
||||||
char *sep, *p;
|
char *sep, *p;
|
||||||
int n, i;
|
|
||||||
|
|
||||||
if(!match[0])
|
if(!match[0])
|
||||||
return;
|
return;
|
||||||
@@ -996,22 +1106,33 @@ static void RecurseDirectorySearch(const char *path, const char *match, vector_a
|
|||||||
|
|
||||||
if(!sep)
|
if(!sep)
|
||||||
{
|
{
|
||||||
MatchString = match;
|
DIR *dir;
|
||||||
|
|
||||||
TRACE("Searching %s for %s\n", path?path:"/", match);
|
TRACE("Searching %s for %s\n", path?path:"/", match);
|
||||||
n = scandir(path?path:"/", &namelist, MatchFilter, alphasort);
|
dir = opendir(path?path:"/");
|
||||||
if(n >= 0)
|
if(dir != NULL)
|
||||||
{
|
{
|
||||||
for(i = 0;i < n;++i)
|
size_t base = VECTOR_SIZE(*results);
|
||||||
|
struct dirent *dirent;
|
||||||
|
while((dirent=readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
al_string str = AL_STRING_INIT_STATIC();
|
al_string str;
|
||||||
|
if(strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0 ||
|
||||||
|
!MatchFilter(dirent->d_name, match))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
AL_STRING_INIT(str);
|
||||||
if(path) al_string_copy_cstr(&str, path);
|
if(path) al_string_copy_cstr(&str, path);
|
||||||
al_string_append_char(&str, '/');
|
al_string_append_char(&str, '/');
|
||||||
al_string_append_cstr(&str, namelist[i]->d_name);
|
al_string_append_cstr(&str, dirent->d_name);
|
||||||
TRACE("Got result %s\n", al_string_get_cstr(str));
|
TRACE("Got result %s\n", al_string_get_cstr(str));
|
||||||
VECTOR_PUSH_BACK(*results, str);
|
VECTOR_PUSH_BACK(*results, str);
|
||||||
free(namelist[i]);
|
|
||||||
}
|
}
|
||||||
free(namelist);
|
closedir(dir);
|
||||||
|
|
||||||
|
if(VECTOR_SIZE(*results) > base)
|
||||||
|
qsort(VECTOR_ITER_BEGIN(*results)+base, VECTOR_SIZE(*results)-base,
|
||||||
|
sizeof(VECTOR_FRONT(*results)), StringSortCompare);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -1040,11 +1161,13 @@ static void RecurseDirectorySearch(const char *path, const char *match, vector_a
|
|||||||
{
|
{
|
||||||
al_string npath = AL_STRING_INIT_STATIC();
|
al_string npath = AL_STRING_INIT_STATIC();
|
||||||
al_string nmatch = AL_STRING_INIT_STATIC();
|
al_string nmatch = AL_STRING_INIT_STATIC();
|
||||||
|
const char *tomatch;
|
||||||
|
DIR *dir;
|
||||||
|
|
||||||
if(!sep)
|
if(!sep)
|
||||||
{
|
{
|
||||||
al_string_append_cstr(&npath, path?path:"/.");
|
al_string_append_cstr(&npath, path?path:"/.");
|
||||||
MatchString = match;
|
tomatch = match;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1053,25 +1176,30 @@ static void RecurseDirectorySearch(const char *path, const char *match, vector_a
|
|||||||
al_string_append_range(&npath, match, sep);
|
al_string_append_range(&npath, match, sep);
|
||||||
|
|
||||||
al_string_append_range(&nmatch, sep+1, next);
|
al_string_append_range(&nmatch, sep+1, next);
|
||||||
MatchString = al_string_get_cstr(nmatch);
|
tomatch = al_string_get_cstr(nmatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Searching %s for %s\n", al_string_get_cstr(npath), MatchString);
|
TRACE("Searching %s for %s\n", al_string_get_cstr(npath), tomatch);
|
||||||
n = scandir(al_string_get_cstr(npath), &namelist, MatchFilter, alphasort);
|
dir = opendir(path?path:"/");
|
||||||
if(n >= 0)
|
if(dir != NULL)
|
||||||
{
|
{
|
||||||
al_string ndir = AL_STRING_INIT_STATIC();
|
al_string ndir = AL_STRING_INIT_STATIC();
|
||||||
for(i = 0;i < n;++i)
|
struct dirent *dirent;
|
||||||
|
|
||||||
|
while((dirent=readdir(dir)) != NULL)
|
||||||
{
|
{
|
||||||
|
if(strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0 ||
|
||||||
|
!MatchFilter(dirent->d_name, tomatch))
|
||||||
|
continue;
|
||||||
al_string_copy(&ndir, npath);
|
al_string_copy(&ndir, npath);
|
||||||
al_string_append_char(&ndir, '/');
|
al_string_append_char(&ndir, '/');
|
||||||
al_string_append_cstr(&ndir, namelist[i]->d_name);
|
al_string_append_cstr(&ndir, dirent->d_name);
|
||||||
free(namelist[i]);
|
|
||||||
TRACE("Recursing %s with %s\n", al_string_get_cstr(ndir), next+1);
|
TRACE("Recursing %s with %s\n", al_string_get_cstr(ndir), next+1);
|
||||||
RecurseDirectorySearch(al_string_get_cstr(ndir), next+1, results);
|
RecurseDirectorySearch(al_string_get_cstr(ndir), next+1, results);
|
||||||
}
|
}
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
al_string_deinit(&ndir);
|
al_string_deinit(&ndir);
|
||||||
free(namelist);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
al_string_deinit(&nmatch);
|
al_string_deinit(&nmatch);
|
||||||
@@ -1099,8 +1227,13 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
|||||||
const char *str, *next;
|
const char *str, *next;
|
||||||
char cwdbuf[PATH_MAX];
|
char cwdbuf[PATH_MAX];
|
||||||
|
|
||||||
// Search CWD
|
/* Search the app-local directory. */
|
||||||
if(!getcwd(cwdbuf, sizeof(cwdbuf)))
|
if((str=getenv("ALSOFT_LOCAL_PATH")) && *str != '\0')
|
||||||
|
{
|
||||||
|
strncpy(cwdbuf, str, sizeof(cwdbuf)-1);
|
||||||
|
cwdbuf[sizeof(cwdbuf)-1] = '\0';
|
||||||
|
}
|
||||||
|
else if(!getcwd(cwdbuf, sizeof(cwdbuf)))
|
||||||
strcpy(cwdbuf, ".");
|
strcpy(cwdbuf, ".");
|
||||||
RecurseDirectorySearch(cwdbuf, match, &results);
|
RecurseDirectorySearch(cwdbuf, match, &results);
|
||||||
|
|
||||||
|
|||||||
@@ -820,7 +820,7 @@ error:
|
|||||||
vector_HrtfEntry EnumerateHrtf(const_al_string devname)
|
vector_HrtfEntry EnumerateHrtf(const_al_string devname)
|
||||||
{
|
{
|
||||||
vector_HrtfEntry list = VECTOR_INIT_STATIC();
|
vector_HrtfEntry list = VECTOR_INIT_STATIC();
|
||||||
const char *fnamelist = "default-%r.mhr";
|
const char *fnamelist = "%s.mhr";
|
||||||
|
|
||||||
ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf_tables", &fnamelist);
|
ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf_tables", &fnamelist);
|
||||||
while(fnamelist && *fnamelist)
|
while(fnamelist && *fnamelist)
|
||||||
|
|||||||
+120
-66
@@ -5,8 +5,11 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
|||||||
PROJECT(OpenAL)
|
PROJECT(OpenAL)
|
||||||
|
|
||||||
IF(COMMAND CMAKE_POLICY)
|
IF(COMMAND CMAKE_POLICY)
|
||||||
CMAKE_POLICY(SET CMP0003 NEW)
|
CMAKE_POLICY(SET CMP0003 NEW)
|
||||||
CMAKE_POLICY(SET CMP0005 NEW)
|
CMAKE_POLICY(SET CMP0005 NEW)
|
||||||
|
IF(POLICY CMP0042)
|
||||||
|
CMAKE_POLICY(SET CMP0042 NEW)
|
||||||
|
ENDIF(POLICY CMP0042)
|
||||||
ENDIF(COMMAND CMAKE_POLICY)
|
ENDIF(COMMAND CMAKE_POLICY)
|
||||||
|
|
||||||
SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
|
SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake")
|
||||||
@@ -30,18 +33,23 @@ OPTION(ALSOFT_DLOPEN "Check for the dlopen API for loading optional libs" ON)
|
|||||||
|
|
||||||
OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
|
OPTION(ALSOFT_WERROR "Treat compile warnings as errors" OFF)
|
||||||
|
|
||||||
OPTION(ALSOFT_UTILS "Build and install utility programs" OFF)
|
OPTION(ALSOFT_UTILS "Build and install utility programs" ON)
|
||||||
OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
|
OPTION(ALSOFT_NO_CONFIG_UTIL "Disable building the alsoft-config utility" OFF)
|
||||||
|
|
||||||
OPTION(ALSOFT_EXAMPLES "Build and install example programs" OFF)
|
OPTION(ALSOFT_EXAMPLES "Build and install example programs" ON)
|
||||||
OPTION(ALSOFT_TESTS "Build and install test programs" OFF)
|
OPTION(ALSOFT_TESTS "Build and install test programs" ON)
|
||||||
|
|
||||||
OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" OFF)
|
OPTION(ALSOFT_CONFIG "Install alsoft.conf sample configuration file" ON)
|
||||||
OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" OFF)
|
OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
|
||||||
OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
|
OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
|
||||||
|
|
||||||
|
|
||||||
IF(WIN32)
|
set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE STRING "The share install dir")
|
||||||
|
|
||||||
|
|
||||||
|
IF(NOT WIN32)
|
||||||
|
SET(LIBNAME openal)
|
||||||
|
ELSE()
|
||||||
SET(LIBNAME OpenAL32)
|
SET(LIBNAME OpenAL32)
|
||||||
ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
|
ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
|
||||||
|
|
||||||
@@ -60,23 +68,8 @@ IF(WIN32)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ELSE()
|
|
||||||
SET(LIBNAME openal)
|
|
||||||
|
|
||||||
# These are needed on non-Windows systems for extra features
|
|
||||||
ADD_DEFINITIONS(-D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700)
|
|
||||||
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_GNU_SOURCE=1 -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Set defines for large file support
|
|
||||||
CHECK_FILE_OFFSET_BITS()
|
|
||||||
IF(_FILE_OFFSET_BITS)
|
|
||||||
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
|
|
||||||
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
|
|
||||||
ENDIF()
|
|
||||||
ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES)
|
|
||||||
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
|
|
||||||
|
|
||||||
|
|
||||||
# QNX's gcc do not uses /usr/include and /usr/lib pathes by default
|
# QNX's gcc do not uses /usr/include and /usr/lib pathes by default
|
||||||
IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
|
IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
|
||||||
@@ -84,15 +77,13 @@ IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
|
|||||||
SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib)
|
SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(OPENAL_LIB_NAME ${LIBNAME} PARENT_SCOPE)
|
|
||||||
|
|
||||||
IF(NOT LIBTYPE)
|
IF(NOT LIBTYPE)
|
||||||
SET(LIBTYPE SHARED)
|
SET(LIBTYPE SHARED)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(LIB_MAJOR_VERSION "1")
|
SET(LIB_MAJOR_VERSION "1")
|
||||||
SET(LIB_MINOR_VERSION "17")
|
SET(LIB_MINOR_VERSION "17")
|
||||||
SET(LIB_REVISION "0")
|
SET(LIB_REVISION "2")
|
||||||
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
||||||
|
|
||||||
SET(EXPORT_DECL "")
|
SET(EXPORT_DECL "")
|
||||||
@@ -113,6 +104,31 @@ ELSE()
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
if(NOT WIN32)
|
||||||
|
# Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions
|
||||||
|
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT)
|
||||||
|
IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT)
|
||||||
|
SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
|
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500")
|
||||||
|
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX)
|
||||||
|
IF(NOT HAVE_POSIX_MEMALIGN_POSIX)
|
||||||
|
SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS})
|
||||||
|
ELSE()
|
||||||
|
ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500)
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
UNSET(OLD_REQUIRED_FLAGS)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Set defines for large file support
|
||||||
|
CHECK_FILE_OFFSET_BITS()
|
||||||
|
IF(_FILE_OFFSET_BITS)
|
||||||
|
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS})
|
||||||
|
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}")
|
||||||
|
ENDIF()
|
||||||
|
ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES)
|
||||||
|
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES")
|
||||||
|
|
||||||
# MSVC may need workarounds for C99 restrict and inline
|
# MSVC may need workarounds for C99 restrict and inline
|
||||||
IF(MSVC)
|
IF(MSVC)
|
||||||
# TODO: Once we truly require C99, these restrict and inline checks should go
|
# TODO: Once we truly require C99, these restrict and inline checks should go
|
||||||
@@ -278,6 +294,25 @@ ELSE()
|
|||||||
|
|
||||||
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
|
CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor));
|
||||||
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
|
int main() {return 0;}" HAVE_GCC_DESTRUCTOR)
|
||||||
|
|
||||||
|
option(ALSOFT_STATIC_LIBGCC "Force -static-libgcc for static GCC runtimes" OFF)
|
||||||
|
if(ALSOFT_STATIC_LIBGCC)
|
||||||
|
set(OLD_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} -static-libgcc)
|
||||||
|
check_c_source_compiles(
|
||||||
|
"#include <stdlib.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
HAVE_STATIC_LIBGCC_SWITCH
|
||||||
|
)
|
||||||
|
if(HAVE_STATIC_LIBGCC_SWITCH)
|
||||||
|
set(EXTRA_LIBS ${EXTRA_LIBS} -static-libgcc)
|
||||||
|
endif()
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES})
|
||||||
|
unset(OLD_REQUIRED_LIBRARIES)
|
||||||
|
endif()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Set visibility/export options if available
|
# Set visibility/export options if available
|
||||||
@@ -323,6 +358,7 @@ ENDIF()
|
|||||||
|
|
||||||
SET(SSE_SWITCH "")
|
SET(SSE_SWITCH "")
|
||||||
SET(SSE2_SWITCH "")
|
SET(SSE2_SWITCH "")
|
||||||
|
SET(SSE3_SWITCH "")
|
||||||
SET(SSE4_1_SWITCH "")
|
SET(SSE4_1_SWITCH "")
|
||||||
IF(NOT MSVC)
|
IF(NOT MSVC)
|
||||||
CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
|
CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH)
|
||||||
@@ -350,7 +386,6 @@ CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
|
|||||||
CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
|
CHECK_INCLUDE_FILE(stdalign.h HAVE_STDALIGN_H)
|
||||||
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
|
CHECK_INCLUDE_FILE(malloc.h HAVE_MALLOC_H)
|
||||||
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
|
CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H)
|
||||||
CHECK_INCLUDE_FILE(io.h HAVE_IO_H)
|
|
||||||
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
|
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
|
||||||
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
|
CHECK_INCLUDE_FILE(cpuid.h HAVE_CPUID_H)
|
||||||
CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
|
CHECK_INCLUDE_FILE(intrin.h HAVE_INTRIN_H)
|
||||||
@@ -363,6 +398,25 @@ IF(NOT HAVE_GUIDDEF_H)
|
|||||||
CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
|
CHECK_INCLUDE_FILE(initguid.h HAVE_INITGUID_H)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Some systems need libm for some of the following math functions to work
|
||||||
|
CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
|
||||||
|
IF(HAVE_LIBM)
|
||||||
|
SET(EXTRA_LIBS m ${EXTRA_LIBS})
|
||||||
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Check for the dlopen API (for dynamicly loading backend libs)
|
||||||
|
IF(ALSOFT_DLOPEN)
|
||||||
|
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
|
||||||
|
IF(HAVE_LIBDL)
|
||||||
|
SET(EXTRA_LIBS dl ${EXTRA_LIBS})
|
||||||
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} dl)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Check for a cpuid intrinsic
|
||||||
IF(HAVE_CPUID_H)
|
IF(HAVE_CPUID_H)
|
||||||
CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
|
CHECK_C_SOURCE_COMPILES("#include <cpuid.h>
|
||||||
int main()
|
int main()
|
||||||
@@ -371,7 +425,6 @@ IF(HAVE_CPUID_H)
|
|||||||
return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
|
return __get_cpuid(0, &eax, &ebx, &ecx, &edx);
|
||||||
}" HAVE_GCC_GET_CPUID)
|
}" HAVE_GCC_GET_CPUID)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(HAVE_INTRIN_H)
|
IF(HAVE_INTRIN_H)
|
||||||
CHECK_C_SOURCE_COMPILES("#include <intrin.h>
|
CHECK_C_SOURCE_COMPILES("#include <intrin.h>
|
||||||
int main()
|
int main()
|
||||||
@@ -382,14 +435,6 @@ IF(HAVE_INTRIN_H)
|
|||||||
}" HAVE_CPUID_INTRINSIC)
|
}" HAVE_CPUID_INTRINSIC)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Some systems need libm for some of the following math functions to work
|
|
||||||
CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
|
|
||||||
IF(HAVE_LIBM)
|
|
||||||
SET(EXTRA_LIBS m ${EXTRA_LIBS})
|
|
||||||
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
|
|
||||||
CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
|
CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC)
|
||||||
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
|
CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN)
|
||||||
CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
|
CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC)
|
||||||
@@ -407,8 +452,8 @@ IF(HAVE_FLOAT_H)
|
|||||||
CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
|
CHECK_SYMBOL_EXISTS(__control87_2 float.h HAVE___CONTROL87_2)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
|
|
||||||
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
|
CHECK_FUNCTION_EXISTS(stat HAVE_STAT)
|
||||||
|
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
|
||||||
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
CHECK_FUNCTION_EXISTS(strcasecmp HAVE_STRCASECMP)
|
||||||
IF(NOT HAVE_STRCASECMP)
|
IF(NOT HAVE_STRCASECMP)
|
||||||
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
|
CHECK_FUNCTION_EXISTS(_stricmp HAVE__STRICMP)
|
||||||
@@ -429,6 +474,7 @@ IF(NOT HAVE_STRNCASECMP)
|
|||||||
ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
|
ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN)
|
||||||
CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
|
CHECK_SYMBOL_EXISTS(snprintf stdio.h HAVE_SNPRINTF)
|
||||||
IF(NOT HAVE_SNPRINTF)
|
IF(NOT HAVE_SNPRINTF)
|
||||||
CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
|
CHECK_FUNCTION_EXISTS(_snprintf HAVE__SNPRINTF)
|
||||||
@@ -464,26 +510,15 @@ IF(NOT HAVE_ISNAN)
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
# Check for the dlopen API (for dynamicly loading backend libs)
|
|
||||||
IF(ALSOFT_DLOPEN)
|
|
||||||
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
|
|
||||||
IF(HAVE_DLFCN_H)
|
|
||||||
CHECK_LIBRARY_EXISTS(dl dlopen "" HAVE_LIBDL)
|
|
||||||
IF(HAVE_LIBDL)
|
|
||||||
SET(EXTRA_LIBS dl ${EXTRA_LIBS})
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
# Check if we have Windows headers
|
# Check if we have Windows headers
|
||||||
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
|
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
|
||||||
IF(NOT HAVE_WINDOWS_H)
|
IF(NOT HAVE_WINDOWS_H)
|
||||||
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
|
CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
|
||||||
IF(NOT HAVE_GETTIMEOFDAY)
|
IF(NOT HAVE_GETTIMEOFDAY)
|
||||||
MESSAGE(FATAL_ERROR "No timing function found!")
|
MESSAGE(FATAL_ERROR "No timing function found!")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
|
||||||
IF(NOT HAVE_NANOSLEEP)
|
IF(NOT HAVE_NANOSLEEP)
|
||||||
MESSAGE(FATAL_ERROR "No sleep function found!")
|
MESSAGE(FATAL_ERROR "No sleep function found!")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -514,12 +549,33 @@ IF(NOT HAVE_WINDOWS_H)
|
|||||||
CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
|
CHECK_SYMBOL_EXISTS(pthread_setname_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SETNAME_NP)
|
||||||
IF(NOT HAVE_PTHREAD_SETNAME_NP)
|
IF(NOT HAVE_PTHREAD_SETNAME_NP)
|
||||||
CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
|
CHECK_SYMBOL_EXISTS(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
|
||||||
|
ELSE()
|
||||||
|
CHECK_C_SOURCE_COMPILES("
|
||||||
|
#include <pthread.h>
|
||||||
|
#include <pthread_np.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
pthread_setname_np(\"testname\");
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
PTHREAD_SETNAME_NP_ONE_PARAM
|
||||||
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
||||||
ELSE()
|
ELSE()
|
||||||
CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
|
CHECK_SYMBOL_EXISTS(pthread_setname_np pthread.h HAVE_PTHREAD_SETNAME_NP)
|
||||||
IF(NOT HAVE_PTHREAD_SETNAME_NP)
|
IF(NOT HAVE_PTHREAD_SETNAME_NP)
|
||||||
CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
|
CHECK_SYMBOL_EXISTS(pthread_set_name_np pthread.h HAVE_PTHREAD_SET_NAME_NP)
|
||||||
|
ELSE()
|
||||||
|
CHECK_C_SOURCE_COMPILES("
|
||||||
|
#include <pthread.h>
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
pthread_setname_np(\"testname\");
|
||||||
|
return 0;
|
||||||
|
}"
|
||||||
|
PTHREAD_SETNAME_NP_ONE_PARAM
|
||||||
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -926,7 +982,7 @@ IF(JACK_FOUND)
|
|||||||
SET(HAVE_JACK 1)
|
SET(HAVE_JACK 1)
|
||||||
SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
|
SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
|
||||||
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
|
SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c)
|
||||||
ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES})
|
ADD_BACKEND_LIBS(${JACK_LIBRARIES})
|
||||||
IF(CMAKE_VERSION VERSION_LESS "2.8.8")
|
IF(CMAKE_VERSION VERSION_LESS "2.8.8")
|
||||||
INCLUDE_DIRECTORIES(${JACK_INCLUDE_DIRS})
|
INCLUDE_DIRECTORIES(${JACK_INCLUDE_DIRS})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -1111,11 +1167,9 @@ IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC")
|
|||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS})
|
TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS})
|
||||||
TARGET_INCLUDE_DIRECTORIES(${LIBNAME} PUBLIC include)
|
|
||||||
|
|
||||||
IF(ALSOFT_INSTALL)
|
IF(ALSOFT_INSTALL)
|
||||||
# Add an install target here
|
# Add an install target here
|
||||||
IF(NOT MEGA)
|
|
||||||
INSTALL(TARGETS ${LIBNAME}
|
INSTALL(TARGETS ${LIBNAME}
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||||
@@ -1131,7 +1185,6 @@ IF(ALSOFT_INSTALL)
|
|||||||
)
|
)
|
||||||
INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
|
INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc"
|
||||||
DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
|
DESTINATION "lib${LIB_SUFFIX}/pkgconfig")
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
|
||||||
@@ -1154,7 +1207,7 @@ ENDIF()
|
|||||||
# Install alsoft.conf configuration file
|
# Install alsoft.conf configuration file
|
||||||
IF(ALSOFT_CONFIG)
|
IF(ALSOFT_CONFIG)
|
||||||
INSTALL(FILES alsoftrc.sample
|
INSTALL(FILES alsoftrc.sample
|
||||||
DESTINATION share/openal
|
DESTINATION ${SHARE_INSTALL_DIR}/openal
|
||||||
)
|
)
|
||||||
MESSAGE(STATUS "Installing sample configuration")
|
MESSAGE(STATUS "Installing sample configuration")
|
||||||
MESSAGE(STATUS "")
|
MESSAGE(STATUS "")
|
||||||
@@ -1164,7 +1217,7 @@ ENDIF()
|
|||||||
IF(ALSOFT_HRTF_DEFS)
|
IF(ALSOFT_HRTF_DEFS)
|
||||||
INSTALL(FILES hrtf/default-44100.mhr
|
INSTALL(FILES hrtf/default-44100.mhr
|
||||||
hrtf/default-48000.mhr
|
hrtf/default-48000.mhr
|
||||||
DESTINATION share/openal/hrtf
|
DESTINATION ${SHARE_INSTALL_DIR}/openal/hrtf
|
||||||
)
|
)
|
||||||
MESSAGE(STATUS "Installing HRTF definitions")
|
MESSAGE(STATUS "Installing HRTF definitions")
|
||||||
MESSAGE(STATUS "")
|
MESSAGE(STATUS "")
|
||||||
@@ -1225,32 +1278,37 @@ IF(ALSOFT_EXAMPLES)
|
|||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
ADD_EXECUTABLE(alstream examples/alstream.c)
|
ADD_EXECUTABLE(alstream examples/alstream.c)
|
||||||
TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
|
TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
|
||||||
|
common ${LIBNAME})
|
||||||
SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
ADD_EXECUTABLE(alreverb examples/alreverb.c)
|
ADD_EXECUTABLE(alreverb examples/alreverb.c)
|
||||||
TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
|
TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
|
||||||
|
common ${LIBNAME})
|
||||||
SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
ADD_EXECUTABLE(allatency examples/allatency.c)
|
ADD_EXECUTABLE(allatency examples/allatency.c)
|
||||||
TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
|
TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
|
||||||
|
common ${LIBNAME})
|
||||||
SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
ADD_EXECUTABLE(alloopback examples/alloopback.c)
|
ADD_EXECUTABLE(alloopback examples/alloopback.c)
|
||||||
TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
|
TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
|
||||||
|
common ${LIBNAME})
|
||||||
SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
|
ADD_EXECUTABLE(alhrtf examples/alhrtf.c)
|
||||||
TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ${LIBNAME})
|
TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY}
|
||||||
|
common ${LIBNAME})
|
||||||
SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR}
|
||||||
${SDL_SOUND_INCLUDE_DIR})
|
${SDL_SOUND_INCLUDE_DIR})
|
||||||
|
|
||||||
IF(ALSOFT_INSTALL)
|
IF(ALSOFT_INSTALL)
|
||||||
INSTALL(TARGETS alstream alreverb allatency alloopback
|
INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
||||||
@@ -1301,7 +1359,3 @@ IF(ALSOFT_EXAMPLES)
|
|||||||
MESSAGE(STATUS "")
|
MESSAGE(STATUS "")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(MEGA)
|
|
||||||
install(TARGETS ${LIBNAME} RUNTIME DESTINATION . LIBRARY DESTINATION .)
|
|
||||||
ENDIF()
|
|
||||||
|
|||||||
@@ -1,3 +1,33 @@
|
|||||||
|
openal-soft-1.17.2:
|
||||||
|
|
||||||
|
Implemented device enumeration for OSSv4.
|
||||||
|
|
||||||
|
Fixed building on OSX.
|
||||||
|
|
||||||
|
Fixed building on non-Windows systems without POSIX-2008.
|
||||||
|
|
||||||
|
Fixed Dedicated Dialog and Dedicated LFE effect output.
|
||||||
|
|
||||||
|
Added a build option to override the share install dir.
|
||||||
|
|
||||||
|
Added a build option to static-link libgcc for MinGW.
|
||||||
|
|
||||||
|
openal-soft-1.17.1:
|
||||||
|
|
||||||
|
Fixed building with JACK and without PulseAudio.
|
||||||
|
|
||||||
|
Fixed building on FreeBSD.
|
||||||
|
|
||||||
|
Fixed the ALSA backend's allow-resampler option.
|
||||||
|
|
||||||
|
Fixed handling of inexact ALSA period counts.
|
||||||
|
|
||||||
|
Altered device naming scheme on Windows backends to better match other
|
||||||
|
drivers.
|
||||||
|
|
||||||
|
Updated the CoreAudio backend to use the AudioComponent API. This clears up
|
||||||
|
deprecation warnings for OSX 10.11, although requires OSX 10.6 or newer.
|
||||||
|
|
||||||
openal-soft-1.17.0:
|
openal-soft-1.17.0:
|
||||||
|
|
||||||
Implemented a JACK playback backend.
|
Implemented a JACK playback backend.
|
||||||
|
|||||||
@@ -42,8 +42,9 @@ typedef enum ALfilterType {
|
|||||||
typedef struct ALfilterState {
|
typedef struct ALfilterState {
|
||||||
ALfloat x[2]; /* History of two last input samples */
|
ALfloat x[2]; /* History of two last input samples */
|
||||||
ALfloat y[2]; /* History of two last output samples */
|
ALfloat y[2]; /* History of two last output samples */
|
||||||
ALfloat a[3]; /* Transfer function coefficients "a" */
|
ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */
|
||||||
ALfloat b[3]; /* Transfer function coefficients "b" */
|
ALfloat b1, b2; /* Transfer function coefficients "b" (b0 is input_gain) */
|
||||||
|
ALfloat input_gain;
|
||||||
|
|
||||||
void (*process)(struct ALfilterState *self, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples);
|
void (*process)(struct ALfilterState *self, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples);
|
||||||
} ALfilterState;
|
} ALfilterState;
|
||||||
@@ -68,18 +69,25 @@ inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth)
|
|||||||
return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0));
|
return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALfilterState_clear(ALfilterState *filter);
|
inline void ALfilterState_clear(ALfilterState *filter)
|
||||||
|
{
|
||||||
|
filter->x[0] = 0.0f;
|
||||||
|
filter->x[1] = 0.0f;
|
||||||
|
filter->y[0] = 0.0f;
|
||||||
|
filter->y[1] = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ);
|
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ);
|
||||||
|
|
||||||
inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample)
|
inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample)
|
||||||
{
|
{
|
||||||
ALfloat outsmp;
|
ALfloat outsmp;
|
||||||
|
|
||||||
outsmp = filter->b[0] * sample +
|
outsmp = filter->input_gain * sample +
|
||||||
filter->b[1] * filter->x[0] +
|
filter->b1 * filter->x[0] +
|
||||||
filter->b[2] * filter->x[1] -
|
filter->b2 * filter->x[1] -
|
||||||
filter->a[1] * filter->y[0] -
|
filter->a1 * filter->y[0] -
|
||||||
filter->a[2] * filter->y[1];
|
filter->a2 * filter->y[1];
|
||||||
filter->x[1] = filter->x[0];
|
filter->x[1] = filter->x[0];
|
||||||
filter->x[0] = sample;
|
filter->x[0] = sample;
|
||||||
filter->y[1] = filter->y[0];
|
filter->y[1] = filter->y[0];
|
||||||
@@ -90,7 +98,23 @@ inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample
|
|||||||
|
|
||||||
void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples);
|
void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *src, ALuint numsamples);
|
||||||
|
|
||||||
void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *src, ALuint numsamples);
|
inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *src, ALuint numsamples)
|
||||||
|
{
|
||||||
|
if(numsamples >= 2)
|
||||||
|
{
|
||||||
|
filter->x[1] = src[numsamples-2];
|
||||||
|
filter->x[0] = src[numsamples-1];
|
||||||
|
filter->y[1] = src[numsamples-2];
|
||||||
|
filter->y[0] = src[numsamples-1];
|
||||||
|
}
|
||||||
|
else if(numsamples == 1)
|
||||||
|
{
|
||||||
|
filter->x[1] = filter->x[0];
|
||||||
|
filter->x[0] = src[0];
|
||||||
|
filter->y[1] = filter->y[0];
|
||||||
|
filter->y[0] = src[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef struct ALfilter {
|
typedef struct ALfilter {
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
|
|
||||||
extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id);
|
extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id);
|
||||||
extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id);
|
extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id);
|
||||||
|
extern inline void ALfilterState_clear(ALfilterState *filter);
|
||||||
|
extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *src, ALuint numsamples);
|
||||||
extern inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample);
|
extern inline ALfloat ALfilterState_processSingle(ALfilterState *filter, ALfloat sample);
|
||||||
extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope);
|
extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope);
|
||||||
extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth);
|
extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth);
|
||||||
@@ -330,18 +332,12 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ALfilterState_clear(ALfilterState *filter)
|
|
||||||
{
|
|
||||||
filter->x[0] = 0.0f;
|
|
||||||
filter->x[1] = 0.0f;
|
|
||||||
filter->y[0] = 0.0f;
|
|
||||||
filter->y[1] = 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ)
|
void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ)
|
||||||
{
|
{
|
||||||
ALfloat alpha, sqrtgain_alpha_2;
|
ALfloat alpha, sqrtgain_alpha_2;
|
||||||
ALfloat w0, sin_w0, cos_w0;
|
ALfloat w0, sin_w0, cos_w0;
|
||||||
|
ALfloat a[3] = { 1.0f, 0.0f, 0.0f };
|
||||||
|
ALfloat b[3] = { 1.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
// Limit gain to -100dB
|
// Limit gain to -100dB
|
||||||
gain = maxf(gain, 0.00001f);
|
gain = maxf(gain, 0.00001f);
|
||||||
@@ -356,86 +352,67 @@ void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat g
|
|||||||
{
|
{
|
||||||
case ALfilterType_HighShelf:
|
case ALfilterType_HighShelf:
|
||||||
sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha;
|
sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha;
|
||||||
filter->b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2);
|
b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2);
|
||||||
filter->b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 );
|
b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 );
|
||||||
filter->b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2);
|
b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2);
|
||||||
filter->a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2;
|
a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2;
|
||||||
filter->a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 );
|
a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 );
|
||||||
filter->a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2;
|
a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2;
|
||||||
break;
|
break;
|
||||||
case ALfilterType_LowShelf:
|
case ALfilterType_LowShelf:
|
||||||
sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha;
|
sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha;
|
||||||
filter->b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2);
|
b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2);
|
||||||
filter->b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 );
|
b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 );
|
||||||
filter->b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2);
|
b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2);
|
||||||
filter->a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2;
|
a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2;
|
||||||
filter->a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 );
|
a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 );
|
||||||
filter->a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2;
|
a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2;
|
||||||
break;
|
break;
|
||||||
case ALfilterType_Peaking:
|
case ALfilterType_Peaking:
|
||||||
gain = sqrtf(gain);
|
gain = sqrtf(gain);
|
||||||
filter->b[0] = 1.0f + alpha * gain;
|
b[0] = 1.0f + alpha * gain;
|
||||||
filter->b[1] = -2.0f * cos_w0;
|
b[1] = -2.0f * cos_w0;
|
||||||
filter->b[2] = 1.0f - alpha * gain;
|
b[2] = 1.0f - alpha * gain;
|
||||||
filter->a[0] = 1.0f + alpha / gain;
|
a[0] = 1.0f + alpha / gain;
|
||||||
filter->a[1] = -2.0f * cos_w0;
|
a[1] = -2.0f * cos_w0;
|
||||||
filter->a[2] = 1.0f - alpha / gain;
|
a[2] = 1.0f - alpha / gain;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ALfilterType_LowPass:
|
case ALfilterType_LowPass:
|
||||||
filter->b[0] = (1.0f - cos_w0) / 2.0f;
|
b[0] = (1.0f - cos_w0) / 2.0f;
|
||||||
filter->b[1] = 1.0f - cos_w0;
|
b[1] = 1.0f - cos_w0;
|
||||||
filter->b[2] = (1.0f - cos_w0) / 2.0f;
|
b[2] = (1.0f - cos_w0) / 2.0f;
|
||||||
filter->a[0] = 1.0f + alpha;
|
a[0] = 1.0f + alpha;
|
||||||
filter->a[1] = -2.0f * cos_w0;
|
a[1] = -2.0f * cos_w0;
|
||||||
filter->a[2] = 1.0f - alpha;
|
a[2] = 1.0f - alpha;
|
||||||
break;
|
break;
|
||||||
case ALfilterType_HighPass:
|
case ALfilterType_HighPass:
|
||||||
filter->b[0] = (1.0f + cos_w0) / 2.0f;
|
b[0] = (1.0f + cos_w0) / 2.0f;
|
||||||
filter->b[1] = -(1.0f + cos_w0);
|
b[1] = -(1.0f + cos_w0);
|
||||||
filter->b[2] = (1.0f + cos_w0) / 2.0f;
|
b[2] = (1.0f + cos_w0) / 2.0f;
|
||||||
filter->a[0] = 1.0f + alpha;
|
a[0] = 1.0f + alpha;
|
||||||
filter->a[1] = -2.0f * cos_w0;
|
a[1] = -2.0f * cos_w0;
|
||||||
filter->a[2] = 1.0f - alpha;
|
a[2] = 1.0f - alpha;
|
||||||
break;
|
break;
|
||||||
case ALfilterType_BandPass:
|
case ALfilterType_BandPass:
|
||||||
filter->b[0] = alpha;
|
b[0] = alpha;
|
||||||
filter->b[1] = 0;
|
b[1] = 0;
|
||||||
filter->b[2] = -alpha;
|
b[2] = -alpha;
|
||||||
filter->a[0] = 1.0f + alpha;
|
a[0] = 1.0f + alpha;
|
||||||
filter->a[1] = -2.0f * cos_w0;
|
a[1] = -2.0f * cos_w0;
|
||||||
filter->a[2] = 1.0f - alpha;
|
a[2] = 1.0f - alpha;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
filter->b[2] /= filter->a[0];
|
filter->a1 = a[1] / a[0];
|
||||||
filter->b[1] /= filter->a[0];
|
filter->a2 = a[2] / a[0];
|
||||||
filter->b[0] /= filter->a[0];
|
filter->b1 = b[1] / a[0];
|
||||||
filter->a[2] /= filter->a[0];
|
filter->b2 = b[2] / a[0];
|
||||||
filter->a[1] /= filter->a[0];
|
filter->input_gain = b[0] / a[0];
|
||||||
filter->a[0] /= filter->a[0];
|
|
||||||
|
|
||||||
filter->process = ALfilterState_processC;
|
filter->process = ALfilterState_processC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *src, ALuint numsamples)
|
|
||||||
{
|
|
||||||
if(numsamples >= 2)
|
|
||||||
{
|
|
||||||
filter->x[1] = src[numsamples-2];
|
|
||||||
filter->x[0] = src[numsamples-1];
|
|
||||||
filter->y[1] = src[numsamples-2];
|
|
||||||
filter->y[0] = src[numsamples-1];
|
|
||||||
}
|
|
||||||
else if(numsamples == 1)
|
|
||||||
{
|
|
||||||
filter->x[1] = filter->x[0];
|
|
||||||
filter->x[0] = src[0];
|
|
||||||
filter->y[1] = filter->y[0];
|
|
||||||
filter->y[0] = src[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void lp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
|
static void lp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val))
|
||||||
{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); }
|
{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); }
|
||||||
|
|||||||
@@ -101,6 +101,7 @@
|
|||||||
# format of the files are described in hrtf.txt. The filenames may contain
|
# format of the files are described in hrtf.txt. The filenames may contain
|
||||||
# these markers, which will be replaced as needed:
|
# these markers, which will be replaced as needed:
|
||||||
# %r - Device sampling rate
|
# %r - Device sampling rate
|
||||||
|
# %s - Non-greedy string (up to the following matching characters)
|
||||||
# %% - Percent sign (%)
|
# %% - Percent sign (%)
|
||||||
# The listed files are relative to system-dependant data directories. On
|
# The listed files are relative to system-dependant data directories. On
|
||||||
# Windows this is:
|
# Windows this is:
|
||||||
@@ -110,7 +111,7 @@
|
|||||||
# $XDG_DATA_DIRS/openal/hrtf (defaults to /usr/local/share/openal/hrtf and
|
# $XDG_DATA_DIRS/openal/hrtf (defaults to /usr/local/share/openal/hrtf and
|
||||||
# /usr/share/openal/hrtf)
|
# /usr/share/openal/hrtf)
|
||||||
# An absolute path may also be specified, if the given file is elsewhere.
|
# An absolute path may also be specified, if the given file is elsewhere.
|
||||||
#hrtf_tables = default-%r.mhr
|
#hrtf_tables = %s.mhr
|
||||||
|
|
||||||
## cf_level:
|
## cf_level:
|
||||||
# Sets the crossfeed level for stereo output. Valid values are:
|
# Sets the crossfeed level for stereo output. Valid values are:
|
||||||
|
|||||||
@@ -497,11 +497,11 @@ extern inline void alcall_once(alonce_flag *once, void (*callback)(void));
|
|||||||
void althrd_setname(althrd_t thr, const char *name)
|
void althrd_setname(althrd_t thr, const char *name)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_PTHREAD_SETNAME_NP)
|
#if defined(HAVE_PTHREAD_SETNAME_NP)
|
||||||
#if defined(__GNUC__)
|
#if defined(PTHREAD_SETNAME_NP_ONE_PARAM)
|
||||||
pthread_setname_np(thr, name);
|
if(althrd_equal(thr, althrd_current()))
|
||||||
#elif defined(__APPLE__)
|
|
||||||
if(althrd_equal(thr, althrd_current())
|
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(name);
|
||||||
|
#else
|
||||||
|
pthread_setname_np(thr, name);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
|
#elif defined(HAVE_PTHREAD_SET_NAME_NP)
|
||||||
pthread_set_name_np(thr, name);
|
pthread_set_name_np(thr, name);
|
||||||
|
|||||||
@@ -86,6 +86,9 @@
|
|||||||
/* Define if we have the strtof function */
|
/* Define if we have the strtof function */
|
||||||
#cmakedefine HAVE_STRTOF
|
#cmakedefine HAVE_STRTOF
|
||||||
|
|
||||||
|
/* Define if we have the strnlen function */
|
||||||
|
#cmakedefine HAVE_STRNLEN
|
||||||
|
|
||||||
/* Define if we have the __int64 type */
|
/* Define if we have the __int64 type */
|
||||||
#cmakedefine HAVE___INT64
|
#cmakedefine HAVE___INT64
|
||||||
|
|
||||||
@@ -143,9 +146,6 @@
|
|||||||
/* Define if we have dirent.h */
|
/* Define if we have dirent.h */
|
||||||
#cmakedefine HAVE_DIRENT_H
|
#cmakedefine HAVE_DIRENT_H
|
||||||
|
|
||||||
/* Define if we have io.h */
|
|
||||||
#cmakedefine HAVE_IO_H
|
|
||||||
|
|
||||||
/* Define if we have strings.h */
|
/* Define if we have strings.h */
|
||||||
#cmakedefine HAVE_STRINGS_H
|
#cmakedefine HAVE_STRINGS_H
|
||||||
|
|
||||||
@@ -191,6 +191,9 @@
|
|||||||
/* Define if we have pthread_setname_np() */
|
/* Define if we have pthread_setname_np() */
|
||||||
#cmakedefine HAVE_PTHREAD_SETNAME_NP
|
#cmakedefine HAVE_PTHREAD_SETNAME_NP
|
||||||
|
|
||||||
|
/* Define if pthread_setname_np() only accepts one parameter */
|
||||||
|
#cmakedefine PTHREAD_SETNAME_NP_ONE_PARAM
|
||||||
|
|
||||||
/* Define if we have pthread_set_name_np() */
|
/* Define if we have pthread_set_name_np() */
|
||||||
#cmakedefine HAVE_PTHREAD_SET_NAME_NP
|
#cmakedefine HAVE_PTHREAD_SET_NAME_NP
|
||||||
|
|
||||||
|
|||||||
@@ -686,7 +686,7 @@ static int audio_thread(void *userdata)
|
|||||||
movState->audio.st->codec->sample_rate,
|
movState->audio.st->codec->sample_rate,
|
||||||
movState->audio.st->codec->channel_layout ?
|
movState->audio.st->codec->channel_layout ?
|
||||||
movState->audio.st->codec->channel_layout :
|
movState->audio.st->codec->channel_layout :
|
||||||
av_get_default_channel_layout(movState->audio.st->codec->channels),
|
(uint64_t)av_get_default_channel_layout(movState->audio.st->codec->channels),
|
||||||
movState->audio.st->codec->sample_fmt,
|
movState->audio.st->codec->sample_fmt,
|
||||||
movState->audio.st->codec->sample_rate,
|
movState->audio.st->codec->sample_rate,
|
||||||
0, NULL
|
0, NULL
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ int main(int argc, char **argv)
|
|||||||
angle = 0.0;
|
angle = 0.0;
|
||||||
alSourcePlay(source);
|
alSourcePlay(source);
|
||||||
do {
|
do {
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
|
|
||||||
/* Rotate the source around the listener by about 1/4 cycle per second.
|
/* Rotate the source around the listener by about 1/4 cycle per second.
|
||||||
* Only affects mono sounds.
|
* Only affects mono sounds.
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
|
|||||||
/* Play the sound until it finishes. */
|
/* Play the sound until it finishes. */
|
||||||
alSourcePlay(source);
|
alSourcePlay(source);
|
||||||
do {
|
do {
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
|
|
||||||
/* Get the source offset and latency. AL_SEC_OFFSET_LATENCY_SOFT will
|
/* Get the source offset and latency. AL_SEC_OFFSET_LATENCY_SOFT will
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Play the sound until it finishes. */
|
/* Play the sound until it finishes. */
|
||||||
alSourcePlay(source);
|
alSourcePlay(source);
|
||||||
do {
|
do {
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
||||||
|
|
||||||
|
|||||||
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
|
|||||||
/* Play the sound until it finishes. */
|
/* Play the sound until it finishes. */
|
||||||
alSourcePlay(source);
|
alSourcePlay(source);
|
||||||
do {
|
do {
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
||||||
|
|
||||||
|
|||||||
@@ -318,7 +318,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while(UpdatePlayer(player))
|
while(UpdatePlayer(player))
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
|
|
||||||
/* All done with this file. Close it and go to the next */
|
/* All done with this file. Close it and go to the next */
|
||||||
ClosePlayerFile(player);
|
ClosePlayerFile(player);
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
|
|||||||
alSourcePlay(source);
|
alSourcePlay(source);
|
||||||
do {
|
do {
|
||||||
ALint pos;
|
ALint pos;
|
||||||
Sleep(10);
|
al_nssleep(10000000);
|
||||||
alGetSourcei(source, AL_SAMPLE_OFFSET, &pos);
|
alGetSourcei(source, AL_SAMPLE_OFFSET, &pos);
|
||||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||||
if(pos < last_pos && state == AL_PLAYING)
|
if(pos < last_pos && state == AL_PLAYING)
|
||||||
|
|||||||
@@ -1,18 +1,12 @@
|
|||||||
#ifndef ALHELPERS_H
|
#ifndef ALHELPERS_H
|
||||||
#define ALHELPERS_H
|
#define ALHELPERS_H
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#define Sleep(x) usleep((x)*1000)
|
|
||||||
#else
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "AL/alc.h"
|
#include "AL/alc.h"
|
||||||
#include "AL/al.h"
|
#include "AL/al.h"
|
||||||
#include "AL/alext.h"
|
#include "AL/alext.h"
|
||||||
|
|
||||||
|
#include "threads.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|||||||
@@ -224,6 +224,7 @@ to stereo output.</string>
|
|||||||
are used in place of the default sets. The filenames may
|
are used in place of the default sets. The filenames may
|
||||||
contain these markers, which will be replaced as needed:
|
contain these markers, which will be replaced as needed:
|
||||||
%r - Device sampling rate
|
%r - Device sampling rate
|
||||||
|
%s - Non-greedy string (up to the following matching characters)
|
||||||
%% - Percent sign (%)</string>
|
%% - Percent sign (%)</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="dragEnabled">
|
<property name="dragEnabled">
|
||||||
|
|||||||
Reference in New Issue
Block a user