diff options
Diffstat (limited to 'src/uscxml/plugins/invoker/audio/AudioToolbox.mm')
-rw-r--r-- | src/uscxml/plugins/invoker/audio/AudioToolbox.mm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm index 44720b1..58e0224 100644 --- a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm +++ b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm @@ -4,10 +4,20 @@ #import <Foundation/Foundation.h> #import <Foundation/NSURL.h> +#ifdef __has_feature +# if __has_feature(objc_arc) +# define(HAS_AUTORELEASE_POOL) +# endif +#endif + namespace uscxml { AudioToolbox::AudioToolbox(const std::string filename) { - @autoreleasepool { +#if HAS_AUTORELEASE_POOL + @autoreleasepool { +#else + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#endif _afId = 0; NSString* filePath = [NSString stringWithCString:filename.c_str() encoding:NSASCIIStringEncoding]; NSURL* afUrl = [NSURL fileURLWithPath:filePath]; @@ -44,7 +54,11 @@ AudioToolbox::AudioToolbox(const std::string filename) { return; } - } +#if HAS_AUTORELEASE_POOL + } +#else + [pool drain]; +#endif } AudioToolbox::~AudioToolbox() { |