From 0c4653085ceb9480fc20ec2087f653f0adff02b3 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 11 Mar 2016 21:01:32 -0800 Subject: Don't request a specific HRTF when one isn't specified --- examples/alhrtf.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/examples/alhrtf.c b/examples/alhrtf.c index b18a5115..2e6e7148 100644 --- a/examples/alhrtf.c +++ b/examples/alhrtf.c @@ -178,19 +178,22 @@ int main(int argc, char **argv) index = i; } + i = 0; + attr[i++] = ALC_HRTF_SOFT; + attr[i++] = ALC_TRUE; if(index == -1) { if(hrtfname) printf("HRTF \"%s\" not found\n", hrtfname); - index = 0; + printf("Using default HRTF...\n"); } - printf("Selecting HRTF %d...\n", index); - - attr[0] = ALC_HRTF_SOFT; - attr[1] = ALC_TRUE; - attr[2] = ALC_HRTF_ID_SOFT; - attr[3] = index; - attr[4] = 0; + else + { + printf("Selecting HRTF %d...\n", index); + attr[i++] = ALC_HRTF_ID_SOFT; + attr[i++] = index; + } + attr[i] = 0; if(!alcResetDeviceSOFT(device, attr)) printf("Failed to reset device: %s\n", alcGetString(device, alcGetError(device))); -- cgit v1.2.3