Skip to content

Commit

Permalink
Merge pull request #32 from Bluebie/master
Browse files Browse the repository at this point in the history
Added support for 3D virtual surround rendering in ALWrapper
  • Loading branch information
kstenerud committed Jun 26, 2012
2 parents a34240b + dc4a5d7 commit d50b537
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ObjectAL/ObjectAL/OpenAL/ALWrapper.h
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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

0 comments on commit d50b537

Please sign in to comment.