Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for 3D virtual surround rendering in ALWrapper #32

Merged
merged 2 commits into from Jun 26, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions ObjectAL/ObjectAL/OpenAL/ALWrapper.h
Expand Up @@ -1094,4 +1094,18 @@
*/
+ (bool) asaSourcef:(ALuint) sourceId property:(ALuint) property value:(ALfloat) value;

/** Set the rendering quality of OpenAL to @"high", @"low", or @"headphones" for 3D sound
*
* @param quality The quality, one of @"high", @"low", or @"headphones"
*/
+ (void) setAlcMacOSXRenderingQuality:(NSString *) quality;

/** Get the rendering quality of OpenAL.
*
* @return @"high" if rendering quality is ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH
* @return @"low" if rendering quality is ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW
* @return @"headphones" if rendering quality is ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES
*/
+ (NSString *) alcMacOSXRenderingQuality;

@end
27 changes: 27 additions & 0 deletions ObjectAL/ObjectAL/OpenAL/ALWrapper.m
Expand Up @@ -1686,4 +1686,31 @@ + (float) getSourceObstruction:(ALuint) sourceID
return value;
}

+ (void) setAlcMacOSXRenderingQuality:(NSString *) quality {
void (*proc)(const ALint) = [ALWrapper getProcAddress:@"alcMacOSXRenderingQuality"];
if ([quality isEqualToString:@"high"]) {
proc(ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH);
} else if ([quality isEqualToString:@"low"]) {
proc(ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW);
} else if ([quality isEqualToString:@"headphones"]) {
proc(ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES);
} else {
[NSException raise:@"InvalidArgument" format:@"Unknown Argument - needs to be :high or :low"];
}
}

+ (NSString *) alcMacOSXRenderingQuality {
ALint (*proc)(void) = [ALWrapper getProcAddress:@"alcMacOSXGetRenderingQuality"];
ALint quality = proc();
if (quality == ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_HIGH) {
return @"high";
} else if (quality == ALC_IPHONE_SPATIAL_RENDERING_QUALITY_HEADPHONES) {
return @"headphones";
} else if (quality == ALC_MAC_OSX_SPATIAL_RENDERING_QUALITY_LOW) {
return @"low";
} else {
return [NSString stringWithFormat:@"%i", quality];
}
}

@end