aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2016-03-11 21:01:32 -0800
committerChris Robinson <[email protected]>2016-03-11 21:01:32 -0800
commit0c4653085ceb9480fc20ec2087f653f0adff02b3 (patch)
tree6f87fb5fca88a7e8df41966fdf9561b33c8c91aa /examples
parent22abaa287d7c10fb1ae8ae34b32d5e0ebbbfad78 (diff)
Don't request a specific HRTF when one isn't specified
Diffstat (limited to 'examples')
-rw-r--r--examples/alhrtf.c19
1 files 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)));