Compare commits
19 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 14df326876 | |||
| e3d2df58b3 | |||
| 4612378593 | |||
| 26f8676b9b | |||
| f8a4ef6f51 | |||
| c08e975aa5 | |||
| 455d5f48c0 | |||
| 21998924d8 | |||
| 48447e2864 | |||
| 482372577e | |||
| 4e6acfa0d5 | |||
| 675ec99d33 | |||
| e45ff47361 | |||
| 63567526b0 | |||
| c8a3e51296 | |||
| 6bb4bdfa4c | |||
| 8ac8830478 | |||
| b2b7be6561 | |||
| 21c84bcd96 |
+5
-2
@@ -677,6 +677,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
||||
unsigned int rate;
|
||||
const char *funcerr;
|
||||
int allowmmap;
|
||||
int dir;
|
||||
int err;
|
||||
|
||||
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)));
|
||||
/* 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)
|
||||
ERR("Failed to disable ALSA resampler\n");
|
||||
@@ -787,7 +788,9 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self)
|
||||
/* retrieve configuration info */
|
||||
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_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);
|
||||
hp = NULL;
|
||||
|
||||
+24
-18
@@ -137,8 +137,8 @@ static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *
|
||||
|
||||
static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
||||
{
|
||||
ComponentDescription desc;
|
||||
Component comp;
|
||||
AudioComponentDescription desc;
|
||||
AudioComponent comp;
|
||||
ca_data *data;
|
||||
OSStatus err;
|
||||
|
||||
@@ -154,19 +154,19 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
||||
desc.componentFlags = 0;
|
||||
desc.componentFlagsMask = 0;
|
||||
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
comp = AudioComponentFindNext(NULL, &desc);
|
||||
if(comp == NULL)
|
||||
{
|
||||
ERR("FindNextComponent failed\n");
|
||||
ERR("AudioComponentFindNext failed\n");
|
||||
return ALC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
data = calloc(1, sizeof(*data));
|
||||
|
||||
err = OpenAComponent(comp, &data->audioUnit);
|
||||
err = AudioComponentInstanceNew(comp, &data->audioUnit);
|
||||
if(err != noErr)
|
||||
{
|
||||
ERR("OpenAComponent failed\n");
|
||||
ERR("AudioComponentInstanceNew failed\n");
|
||||
free(data);
|
||||
return ALC_INVALID_VALUE;
|
||||
}
|
||||
@@ -176,7 +176,7 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName)
|
||||
if(err != noErr)
|
||||
{
|
||||
ERR("AudioUnitInitialize failed\n");
|
||||
CloseComponent(data->audioUnit);
|
||||
AudioComponentInstanceDispose(data->audioUnit);
|
||||
free(data);
|
||||
return ALC_INVALID_VALUE;
|
||||
}
|
||||
@@ -191,7 +191,7 @@ static void ca_close_playback(ALCdevice *device)
|
||||
ca_data *data = (ca_data*)device->ExtraData;
|
||||
|
||||
AudioUnitUninitialize(data->audioUnit);
|
||||
CloseComponent(data->audioUnit);
|
||||
AudioComponentInstanceDispose(data->audioUnit);
|
||||
|
||||
free(data);
|
||||
device->ExtraData = NULL;
|
||||
@@ -374,12 +374,13 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
AudioStreamBasicDescription hardwareFormat; // The hardware format
|
||||
AudioStreamBasicDescription outputFormat; // The AudioUnit output format
|
||||
AURenderCallbackStruct input;
|
||||
ComponentDescription desc;
|
||||
AudioComponentDescription desc;
|
||||
AudioDeviceID inputDevice;
|
||||
UInt32 outputFrameCount;
|
||||
UInt32 propertySize;
|
||||
AudioObjectPropertyAddress propertyAddress;
|
||||
UInt32 enableIO;
|
||||
Component comp;
|
||||
AudioComponent comp;
|
||||
ca_data *data;
|
||||
OSStatus err;
|
||||
|
||||
@@ -395,10 +396,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
desc.componentFlagsMask = 0;
|
||||
|
||||
// Search for component with given description
|
||||
comp = FindNextComponent(NULL, &desc);
|
||||
comp = AudioComponentFindNext(NULL, &desc);
|
||||
if(comp == NULL)
|
||||
{
|
||||
ERR("FindNextComponent failed\n");
|
||||
ERR("AudioComponentFindNext failed\n");
|
||||
return ALC_INVALID_VALUE;
|
||||
}
|
||||
|
||||
@@ -406,10 +407,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
device->ExtraData = data;
|
||||
|
||||
// Open the component
|
||||
err = OpenAComponent(comp, &data->audioUnit);
|
||||
err = AudioComponentInstanceNew(comp, &data->audioUnit);
|
||||
if(err != noErr)
|
||||
{
|
||||
ERR("OpenAComponent failed\n");
|
||||
ERR("AudioComponentInstanceNew failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -432,11 +433,16 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName)
|
||||
}
|
||||
|
||||
// Get the default input device
|
||||
|
||||
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)
|
||||
{
|
||||
ERR("AudioHardwareGetProperty failed\n");
|
||||
ERR("AudioObjectGetPropertyData failed\n");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -596,7 +602,7 @@ error:
|
||||
if(data->audioConverter)
|
||||
AudioConverterDispose(data->audioConverter);
|
||||
if(data->audioUnit)
|
||||
CloseComponent(data->audioUnit);
|
||||
AudioComponentInstanceDispose(data->audioUnit);
|
||||
|
||||
free(data);
|
||||
device->ExtraData = NULL;
|
||||
@@ -613,7 +619,7 @@ static void ca_close_capture(ALCdevice *device)
|
||||
destroy_buffer_list(data->bufferList);
|
||||
|
||||
AudioConverterDispose(data->audioConverter);
|
||||
CloseComponent(data->audioUnit);
|
||||
AudioComponentInstanceDispose(data->audioUnit);
|
||||
|
||||
free(data);
|
||||
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_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
|
||||
@@ -145,13 +145,12 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA
|
||||
{
|
||||
const DevMap *iter;
|
||||
|
||||
al_string_copy_wcstr(&entry.name, desc);
|
||||
if(count == 0)
|
||||
al_string_append_cstr(&entry.name, DEVNAME_TAIL);
|
||||
else
|
||||
al_string_copy_cstr(&entry.name, DEVNAME_HEAD);
|
||||
al_string_append_wcstr(&entry.name, desc);
|
||||
if(count != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
+13
-12
@@ -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_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 {
|
||||
@@ -125,10 +125,13 @@ static void get_device_name(IMMDevice *device, al_string *name)
|
||||
PROPVARIANT pvname;
|
||||
HRESULT hr;
|
||||
|
||||
al_string_copy_cstr(name, DEVNAME_HEAD);
|
||||
|
||||
hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
WARN("OpenPropertyStore failed: 0x%08lx\n", hr);
|
||||
al_string_append_cstr(name, "Unknown Device Name");
|
||||
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);
|
||||
if(FAILED(hr))
|
||||
{
|
||||
WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr);
|
||||
al_string_append_cstr(name, "Unknown Device Name");
|
||||
}
|
||||
else if(pvname.vt == VT_LPWSTR)
|
||||
al_string_copy_wcstr(name, pvname.pwszVal);
|
||||
al_string_append_wcstr(name, pvname.pwszVal);
|
||||
else
|
||||
{
|
||||
WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt);
|
||||
al_string_append_cstr(name, "Unknown Device Name");
|
||||
}
|
||||
|
||||
PropVariantClear(&pvname);
|
||||
IPropertyStore_Release(ps);
|
||||
@@ -193,12 +202,10 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list)
|
||||
const DevMap *iter;
|
||||
|
||||
al_string_copy(&entry.name, tmpname);
|
||||
if(count == 0)
|
||||
al_string_append_cstr(&entry.name, DEVNAME_TAIL);
|
||||
else
|
||||
if(count != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -755,10 +762,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self)
|
||||
{
|
||||
self->client = ptr;
|
||||
if(al_string_empty(device->DeviceName))
|
||||
{
|
||||
get_device_name(self->mmdev, &device->DeviceName);
|
||||
al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
|
||||
}
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
@@ -1412,10 +1416,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self)
|
||||
{
|
||||
self->client = ptr;
|
||||
if(al_string_empty(device->DeviceName))
|
||||
{
|
||||
get_device_name(self->mmdev, &device->DeviceName);
|
||||
al_string_append_cstr(&device->DeviceName, DEVNAME_TAIL);
|
||||
}
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
|
||||
+9
-11
@@ -37,7 +37,7 @@
|
||||
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
|
||||
#endif
|
||||
|
||||
#define DEVNAME_TAIL " on OpenAL Soft"
|
||||
#define DEVNAME_HEAD "OpenAL Soft on "
|
||||
|
||||
|
||||
static vector_al_string PlaybackDevices;
|
||||
@@ -71,13 +71,12 @@ static void ProbePlaybackDevices(void)
|
||||
ALuint count = 0;
|
||||
while(1)
|
||||
{
|
||||
al_string_copy_wcstr(&dname, WaveCaps.szPname);
|
||||
if(count == 0)
|
||||
al_string_append_cstr(&dname, DEVNAME_TAIL);
|
||||
else
|
||||
al_string_copy_cstr(&dname, DEVNAME_HEAD);
|
||||
al_string_append_wcstr(&dname, WaveCaps.szPname);
|
||||
if(count != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
count++;
|
||||
@@ -115,13 +114,12 @@ static void ProbeCaptureDevices(void)
|
||||
ALuint count = 0;
|
||||
while(1)
|
||||
{
|
||||
al_string_copy_wcstr(&dname, WaveCaps.szPname);
|
||||
if(count == 0)
|
||||
al_string_append_cstr(&dname, DEVNAME_TAIL);
|
||||
else
|
||||
al_string_copy_cstr(&dname, DEVNAME_HEAD);
|
||||
al_string_append_wcstr(&dname, WaveCaps.szPname);
|
||||
if(count != 0)
|
||||
{
|
||||
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);
|
||||
}
|
||||
count++;
|
||||
|
||||
+115
-5
@@ -549,6 +549,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)
|
||||
{
|
||||
for(;*str != 0;++str)
|
||||
@@ -570,9 +577,27 @@ static const WCHAR *strrchrW(const WCHAR *str, WCHAR ch)
|
||||
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
|
||||
* 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)
|
||||
{
|
||||
@@ -608,6 +633,40 @@ static int MatchFilter(const WCHAR *match, const WIN32_FIND_DATAW *fdata)
|
||||
ret = l > 0;
|
||||
++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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -785,8 +844,17 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
||||
al_string path = AL_STRING_INIT_STATIC();
|
||||
WCHAR *cwdbuf;
|
||||
|
||||
/* Search the CWD. */
|
||||
if(!(cwdbuf=_wgetcwd(NULL, 0)))
|
||||
/* Search the app-local directory. */
|
||||
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, ".");
|
||||
else
|
||||
{
|
||||
@@ -798,6 +866,9 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
||||
}
|
||||
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);
|
||||
|
||||
/* Search the local and global data dirs. */
|
||||
@@ -973,6 +1044,40 @@ static int MatchFilter(const struct dirent *dir)
|
||||
if(ret) name = end;
|
||||
++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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1099,8 +1204,13 @@ vector_al_string SearchDataFiles(const char *match, const char *subdir)
|
||||
const char *str, *next;
|
||||
char cwdbuf[PATH_MAX];
|
||||
|
||||
// Search CWD
|
||||
if(!getcwd(cwdbuf, sizeof(cwdbuf)))
|
||||
/* Search the app-local directory. */
|
||||
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, ".");
|
||||
RecurseDirectorySearch(cwdbuf, match, &results);
|
||||
|
||||
|
||||
+1
-1
@@ -820,7 +820,7 @@ error:
|
||||
vector_HrtfEntry EnumerateHrtf(const_al_string devname)
|
||||
{
|
||||
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);
|
||||
while(fnamelist && *fnamelist)
|
||||
|
||||
+41
-26
@@ -41,7 +41,9 @@ OPTION(ALSOFT_HRTF_DEFS "Install HRTF definition files" ON)
|
||||
OPTION(ALSOFT_INSTALL "Install headers and libraries" ON)
|
||||
|
||||
|
||||
IF(WIN32)
|
||||
IF(NOT WIN32)
|
||||
SET(LIBNAME openal)
|
||||
ELSE()
|
||||
SET(LIBNAME OpenAL32)
|
||||
ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502")
|
||||
|
||||
@@ -60,23 +62,8 @@ IF(WIN32)
|
||||
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()
|
||||
|
||||
# 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
|
||||
IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX")
|
||||
@@ -90,7 +77,7 @@ ENDIF()
|
||||
|
||||
SET(LIB_MAJOR_VERSION "1")
|
||||
SET(LIB_MINOR_VERSION "17")
|
||||
SET(LIB_REVISION "0")
|
||||
SET(LIB_REVISION "1")
|
||||
SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}")
|
||||
|
||||
SET(EXPORT_DECL "")
|
||||
@@ -111,6 +98,29 @@ ELSE()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# Check if _POSIX_C_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=200809L")
|
||||
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=200809L)
|
||||
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
|
||||
IF(MSVC)
|
||||
# TODO: Once we truly require C99, these restrict and inline checks should go
|
||||
@@ -476,12 +486,12 @@ ENDIF()
|
||||
# Check if we have Windows headers
|
||||
CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502)
|
||||
IF(NOT HAVE_WINDOWS_H)
|
||||
CHECK_FUNCTION_EXISTS(gettimeofday HAVE_GETTIMEOFDAY)
|
||||
CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
|
||||
IF(NOT HAVE_GETTIMEOFDAY)
|
||||
MESSAGE(FATAL_ERROR "No timing function found!")
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
||||
CHECK_SYMBOL_EXISTS(nanosleep time.h HAVE_NANOSLEEP)
|
||||
IF(NOT HAVE_NANOSLEEP)
|
||||
MESSAGE(FATAL_ERROR "No sleep function found!")
|
||||
ENDIF()
|
||||
@@ -924,7 +934,7 @@ IF(JACK_FOUND)
|
||||
SET(HAVE_JACK 1)
|
||||
SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},")
|
||||
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")
|
||||
INCLUDE_DIRECTORIES(${JACK_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
@@ -1220,32 +1230,37 @@ IF(ALSOFT_EXAMPLES)
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
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}
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
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}
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
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}
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
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}
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
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}
|
||||
${SDL_SOUND_INCLUDE_DIR})
|
||||
|
||||
IF(ALSOFT_INSTALL)
|
||||
INSTALL(TARGETS alstream alreverb allatency alloopback
|
||||
INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION "lib${LIB_SUFFIX}"
|
||||
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
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:
|
||||
|
||||
Implemented a JACK playback backend.
|
||||
|
||||
+2
-1
@@ -101,6 +101,7 @@
|
||||
# format of the files are described in hrtf.txt. The filenames may contain
|
||||
# these markers, which will be replaced as needed:
|
||||
# %r - Device sampling rate
|
||||
# %s - Non-greedy string (up to the following matching characters)
|
||||
# %% - Percent sign (%)
|
||||
# The listed files are relative to system-dependant data directories. On
|
||||
# Windows this is:
|
||||
@@ -110,7 +111,7 @@
|
||||
# $XDG_DATA_DIRS/openal/hrtf (defaults to /usr/local/share/openal/hrtf and
|
||||
# /usr/share/openal/hrtf)
|
||||
# An absolute path may also be specified, if the given file is elsewhere.
|
||||
#hrtf_tables = default-%r.mhr
|
||||
#hrtf_tables = %s.mhr
|
||||
|
||||
## cf_level:
|
||||
# Sets the crossfeed level for stereo output. Valid values are:
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ int main(int argc, char **argv)
|
||||
angle = 0.0;
|
||||
alSourcePlay(source);
|
||||
do {
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
|
||||
/* Rotate the source around the listener by about 1/4 cycle per second.
|
||||
* Only affects mono sounds.
|
||||
|
||||
@@ -182,7 +182,7 @@ int main(int argc, char **argv)
|
||||
/* Play the sound until it finishes. */
|
||||
alSourcePlay(source);
|
||||
do {
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||
|
||||
/* 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. */
|
||||
alSourcePlay(source);
|
||||
do {
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
||||
|
||||
|
||||
+1
-1
@@ -311,7 +311,7 @@ int main(int argc, char **argv)
|
||||
/* Play the sound until it finishes. */
|
||||
alSourcePlay(source);
|
||||
do {
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||
} while(alGetError() == AL_NO_ERROR && state == AL_PLAYING);
|
||||
|
||||
|
||||
+1
-1
@@ -318,7 +318,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
while(UpdatePlayer(player))
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
|
||||
/* All done with this file. Close it and go to the next */
|
||||
ClosePlayerFile(player);
|
||||
|
||||
@@ -246,7 +246,7 @@ int main(int argc, char *argv[])
|
||||
alSourcePlay(source);
|
||||
do {
|
||||
ALint pos;
|
||||
Sleep(10);
|
||||
al_nssleep(10000000);
|
||||
alGetSourcei(source, AL_SAMPLE_OFFSET, &pos);
|
||||
alGetSourcei(source, AL_SOURCE_STATE, &state);
|
||||
if(pos < last_pos && state == AL_PLAYING)
|
||||
|
||||
@@ -1,18 +1,12 @@
|
||||
#ifndef 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/al.h"
|
||||
#include "AL/alext.h"
|
||||
|
||||
#include "threads.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -224,6 +224,7 @@ to stereo output.</string>
|
||||
are used in place of the default sets. The filenames may
|
||||
contain these markers, which will be replaced as needed:
|
||||
%r - Device sampling rate
|
||||
%s - Non-greedy string (up to the following matching characters)
|
||||
%% - Percent sign (%)</string>
|
||||
</property>
|
||||
<property name="dragEnabled">
|
||||
|
||||
Reference in New Issue
Block a user