Permalink
Browse files

* check iphone os/simulator for AVFoundation

* Fixed checkError logic being backwards than what seems to be expected
* Changed stringWithCString to stringWithUTF8String
* newWithPath now sourceWithPath to follow standard style for autoreleased object it returns
  • Loading branch information...
1 parent dafd5f3 commit 90bc3ec1ff2398359b14463c00bce970f40b8759 @jfro jfro committed Dec 29, 2009
Showing with 13 additions and 10 deletions.
  1. +2 −0 ALBuffer.m
  2. +3 −3 ALObject.m
  3. +1 −1 ALSource.h
  4. +3 −2 ALSource.m
  5. +4 −4 ALState.m
  6. 0 README.txt → README.md
View
@@ -1,5 +1,7 @@
#import "ALBuffer.h"
+#if defined(TARGET_IPHONE_SIMULATOR) || defined(TARGET_OS_IPHONE)
#import <AVFoundation/AVFoundation.h>
+#endif
#import <AudioToolbox/AudioToolbox.h>
#import <AudioToolbox/ExtendedAudioFile.h>
View
@@ -19,7 +19,7 @@ + (BOOL)logsErrors
- (NSString *)stringForAlErrorCode:(ALenum)err
{
- return [NSString stringWithCString:alGetString(err)];
+ return [NSString stringWithUTF8String:alGetString(err)];
}
- (void)setError:(NSString *)e
@@ -43,10 +43,10 @@ - (BOOL)checkError
if (errorCode != AL_NO_ERROR)
{
[self setError:[self stringForAlErrorCode:errorCode]];
- return NO;
+ return YES;
}
- return YES;
+ return NO;
}
@end
View
@@ -10,7 +10,7 @@
ALBuffer *buffer;
}
-+ newWithPath:(NSString *)path;
++ (ALSource *)sourceWithPath:(NSString *)path;
- (void)setBuffer:(ALBuffer *)buffer;
- (ALBuffer *)buffer;
View
@@ -8,7 +8,7 @@ - (void)close;
@implementation ALSource
-+ newWithPath:(NSString *)path
++ (ALSource *)sourceWithPath:(NSString *)path
{
ALSource *source = [[[ALSource alloc] init] autorelease];
[source setBuffer:[ALBuffer bufferFromCacheForPath:path]];
@@ -161,7 +161,8 @@ - (void)close
- (BOOL)play
{
alSourcePlay(alcSource);
- if ([self checkError]) return NO;
+ if ([self checkError])
+ return NO;
return YES;
}
View
@@ -4,22 +4,22 @@ @implementation ALState
+ (NSString *)vendor
{
- return [NSString stringWithCString:alGetString(AL_VENDOR)];
+ return [NSString stringWithUTF8String:alGetString(AL_VENDOR)];
}
+ (NSString *)version
{
- return [NSString stringWithCString:alGetString(AL_VERSION)];
+ return [NSString stringWithUTF8String:alGetString(AL_VERSION)];
}
+ (NSString *)renderer
{
- return [NSString stringWithCString:alGetString(AL_RENDERER)];
+ return [NSString stringWithUTF8String:alGetString(AL_RENDERER)];
}
+ (NSString *)extensions
{
- return [NSString stringWithCString:alGetString(AL_EXTENSIONS)];
+ return [NSString stringWithUTF8String:alGetString(AL_EXTENSIONS)];
}
+ (void)setDistanceModel:(ALenum)v
View
File renamed without changes.

0 comments on commit 90bc3ec

Please sign in to comment.