AudioUtils.h
author snej@snej-mbp.mtv.corp.google.com
Tue Apr 07 11:13:25 2009 -0700 (2009-04-07)
changeset 23 a910102a1c9d
permissions -rw-r--r--
* Added MYReturnError.
* Better iPhone support in ExceptionUtils.
* Make sure "All Tests Passed/Failed" message is always logged.
jens@14
     1
//
jens@14
     2
//  AudioUtils.h
jens@14
     3
//  Cloudy
jens@14
     4
//
jens@14
     5
//  Created by Jens Alfke on 6/17/08.
jens@14
     6
//  Copyright 2008 Jens Alfke. All rights reserved.
jens@14
     7
//
jens@14
     8
jens@14
     9
#import <Cocoa/Cocoa.h>
jens@14
    10
jens@14
    11
#ifdef __cplusplus
jens@14
    12
extern "C" {
jens@14
    13
#endif
jens@14
    14
    
jens@14
    15
    #define MYCoreAudioErrorDomain @"MYCoreAudioDomain"
jens@14
    16
jens@14
    17
    NSString* MYCAErrorString( OSStatus coreAudioError );
jens@14
    18
    NSError* MYCAError( OSStatus coreAudioError, NSString *message );
jens@14
    19
jens@14
    20
#ifdef __cplusplus
jens@14
    21
}
jens@14
    22
#endif
jens@14
    23
jens@14
    24
       
jens@14
    25
jens@14
    26
#define XWarnIfError(error, operation) \
jens@14
    27
    do {																	\
jens@14
    28
        OSStatus __err = error;												\
jens@14
    29
        if (__err) _MYWarnCAError(__err,@""operation);	\
jens@14
    30
    } while (0)
jens@14
    31
jens@14
    32
void _MYWarnCAError( OSStatus error, NSString *operation );
jens@14
    33
jens@14
    34
#ifdef __cplusplus
jens@14
    35
jens@14
    36
    #define XThrowIfError(error, operation) \
jens@14
    37
        do {																	\
jens@14
    38
            OSStatus __err = error;												\
jens@14
    39
            if (__err) _MYThrowCAError(__err,@""operation);	\
jens@14
    40
        } while (0)
jens@14
    41
jens@14
    42
    void _MYThrowCAError( OSStatus error, NSString *operation ) throw(NSError*) __attribute__((noreturn));
jens@14
    43
jens@14
    44
#endif __cplusplus