AudioUtils.h
changeset 15 06e7d03fd23e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/AudioUtils.h	Tue Jun 24 12:05:24 2008 -0700
     1.3 @@ -0,0 +1,44 @@
     1.4 +//
     1.5 +//  AudioUtils.h
     1.6 +//  Cloudy
     1.7 +//
     1.8 +//  Created by Jens Alfke on 6/17/08.
     1.9 +//  Copyright 2008 Jens Alfke. All rights reserved.
    1.10 +//
    1.11 +
    1.12 +#import <Cocoa/Cocoa.h>
    1.13 +
    1.14 +#ifdef __cplusplus
    1.15 +extern "C" {
    1.16 +#endif
    1.17 +    
    1.18 +    #define MYCoreAudioErrorDomain @"MYCoreAudioDomain"
    1.19 +
    1.20 +    NSString* MYCAErrorString( OSStatus coreAudioError );
    1.21 +    NSError* MYCAError( OSStatus coreAudioError, NSString *message );
    1.22 +
    1.23 +#ifdef __cplusplus
    1.24 +}
    1.25 +#endif
    1.26 +
    1.27 +       
    1.28 +
    1.29 +#define XWarnIfError(error, operation) \
    1.30 +    do {																	\
    1.31 +        OSStatus __err = error;												\
    1.32 +        if (__err) _MYWarnCAError(__err,@""operation);	\
    1.33 +    } while (0)
    1.34 +
    1.35 +void _MYWarnCAError( OSStatus error, NSString *operation );
    1.36 +
    1.37 +#ifdef __cplusplus
    1.38 +
    1.39 +    #define XThrowIfError(error, operation) \
    1.40 +        do {																	\
    1.41 +            OSStatus __err = error;												\
    1.42 +            if (__err) _MYThrowCAError(__err,@""operation);	\
    1.43 +        } while (0)
    1.44 +
    1.45 +    void _MYThrowCAError( OSStatus error, NSString *operation ) throw(NSError*) __attribute__((noreturn));
    1.46 +
    1.47 +#endif __cplusplus