MusicKit  0.0.0
PerformSound.h
00001 /*
00002   $Id$
00003   Description:
00004     This is basically a bare-bones duplicate of NeXT/Apples' performsound module
00005     functionality using the PortAudio library. Compilable with VC++
00006     6.0 or MinGW and typically for interface with Objective C
00007     routines, in particular, the SndKit.
00008 
00009     Only C functions are exported to avoid different C++ name mangling between VC++ and gcc
00010 
00011   Original Author: Leigh Smith <leigh@leighsmith.com>
00012 
00013   Copyright (C) 1999 Permission is granted to use this code for commercial and
00014   non-commercial purposes so long as this copyright statement (noting the author) is
00015   preserved.
00016 */
00017 
00018 #ifndef __PERFORMSOUND__
00019 #define __PERFORMSOUND__
00020 
00021 /* We #include this file regardless of the setting of
00022    HAVE_CONFIG_H so that other applications compiling against this
00023    header don't have to define it. If you are seeing errors for
00024    MKPerformSndMIDIConfig.h not found, you haven't run ./configure 
00025  */
00026 #include "MKPerformSndMIDIConfig.h"
00027 #include <objc/objc.h> // for BOOL
00028 
00029 /* these don't seem to be defined anywhere standard - probably they
00030    are in GnuStep */
00031 #ifndef FALSE
00032 #define FALSE 0
00033 #define TRUE !(FALSE)
00034 #endif
00035 
00036 #if STDC_HEADERS
00037 # include <stdlib.h> // for NULL definition
00038 #endif
00039 #include "SndStruct.h"
00040 #include "SndFormats.h"
00041 
00042 #define MKPERFORMSND_USE_STREAMING       1  // Uses the newer streaming API
00043 
00044 #ifdef __cplusplus
00045 extern "C" {
00046 #endif 
00047 
00051 typedef struct SNDStreamBuffer {
00053     SndSampleFormat dataFormat;
00055     long frameCount;
00057     int channelCount;
00059     double sampleRate;
00061     void *streamData;
00062 } SNDStreamBuffer;
00063 
00072 typedef void (*SNDStreamProcessor)(double sampleTime, SNDStreamBuffer *inStream, SNDStreamBuffer *outStream, void *userData);
00073 
00086 PERFORM_API BOOL SNDInit(BOOL guessTheDevice);
00087 
00094 PERFORM_API BOOL SNDTerminate(void);
00095 
00102 PERFORM_API const char **SNDGetAvailableDriverNames(BOOL outputDrivers);
00103 
00111 PERFORM_API BOOL SNDSetDriverIndex(unsigned int selectedIndex, BOOL outputDrivers);
00112 
00119 PERFORM_API unsigned int SNDGetAssignedDriverIndex(BOOL outputDrivers);
00120 
00126 PERFORM_API BOOL SNDIsMuted(void);
00127 
00133 PERFORM_API void SNDSetMute(BOOL muted);
00134 
00144 PERFORM_API BOOL SNDSetBufferSizeInBytes(long newBufferSizeInBytes, BOOL forOutputDevices);
00145 
00155 PERFORM_API long SNDGetBufferSizeInBytes(BOOL forOutputDevices);
00156 
00165 PERFORM_API void SNDStreamNativeFormat(SNDStreamBuffer *streamFormat,
00166                                        BOOL isOutputStream);
00167 
00174 PERFORM_API float SNDGetLatency(BOOL forOutputDevices);
00175 
00183 PERFORM_API BOOL SNDStreamStart(SNDStreamProcessor newStreamProcessor, void *userData);
00184 
00190 PERFORM_API BOOL SNDStreamStop(void);
00191 
00198 PERFORM_API const char **SNDSpeakerConfiguration(void);
00199 
00200 #ifdef __cplusplus
00201 }
00202 #endif
00203 
00204 #endif