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. Compilable with VC++ 6.0 and typically for interface with 
00006     Objective C routines, in particular, the SndKit.
00007 
00008     Only C functions are exported to avoid different C++ name mangling between VC++ and gcc
00009 
00010   Original Author: Leigh Smith <leigh@tomandandy.com>
00011 
00012   Copyright (C) 1999 Permission is granted to use this code for commercial and
00013   non-commercial purposes so long as this copyright statement (noting the author) is
00014   preserved.
00015 */
00016 /*
00017   $Log$
00018   Revision 1.1  2001/02/15 19:12:08  skot
00019   Added some stub files from silent MKPerformSndMIDI ready for sndkit2-erization
00020 
00021   Revision 1.1.1.1  2000/12/07 19:32:34  leigh
00022   Initial revision
00023 
00024   Revision 1.2  2000/05/05 22:43:56  leigh
00025   ensure we don't have boolean constants predefined
00026 
00027   Revision 1.1  2000/03/11 01:42:19  leigh
00028   Initial Release
00029 
00030   Revision 1.1.1.1  2000/01/14 00:14:34  leigh
00031   Initial revision
00032 
00033   Revision 1.1.1.1  1999/11/17 17:57:14  leigh
00034   Initial working version
00035 
00036   Revision 1.2  1999/07/21 19:19:42  leigh
00037   Single Sound playback working
00038 */
00039 
00040 #define PERFORM_API 
00041 
00042 // these don't seem to be defined anywhere standard - probably they
00043 // are in GnuStep
00044 /*
00045 #ifndef FALSE
00046 typedef int BOOL;
00047 #define FALSE 0
00048 #define TRUE !(FALSE)
00049 #endif
00050 */
00051 
00052 #include <objc/objc.h>
00053 #include <stdlib.h> // for NULL definition
00054 #include "SndStruct.h"
00055 
00056 #ifdef __cplusplus
00057 extern "C" {
00058 #endif 
00059 
00060 typedef struct {
00061    SndSoundStruct streamFormat;
00062    void*          streamData;
00063         // stub to hold the SNDStruct + data buffers coming up from the CoreAudio / MKPerformSndMidi layer
00064 } SNDStreamBuffer;
00065 
00066 typedef void (*SNDStreamProcessor)(double, SNDStreamBuffer, SNDStreamBuffer, void*); 
00067 
00068 typedef int (*SNDNotificationFun)(SndSoundStruct *s, int tag, int err);
00069 
00070 #define SND_NULL_FUN ((SNDNotificationFun)0)
00071 
00072 PERFORM_API void SNDStreamNativeFormat(SndSoundStruct *s);
00073     PERFORM_API BOOL SNDStreamStart();
00074     PERFORM_API void SNDStreamStop();
00075 
00076     
00077     
00078 PERFORM_API BOOL SNDInit(BOOL guessTheDevice);
00079 
00080 // retrieve a list of available driver descriptions
00081 PERFORM_API char **SNDGetAvailableDriverNames(void);
00082 
00083 // assign currently active driver
00084 PERFORM_API BOOL SNDSetDriverIndex(unsigned int selectedIndex);
00085 
00086 // return the index into driverList currently selected.
00087 PERFORM_API unsigned int SNDGetAssignedDriverIndex(void);
00088 
00089 PERFORM_API void SNDGetVolume(float *left, float * right);
00090 
00091 PERFORM_API void SNDSetVolume(float left, float right);
00092 
00093 PERFORM_API BOOL SNDIsMuted(void);
00094 
00095 PERFORM_API void SNDSetMute(BOOL aFlag);
00096 
00097 PERFORM_API int SNDStartPlaying(SndSoundStruct *soundStruct, int tag, int priority,  int preempt, 
00098   SNDNotificationFun beginFun, SNDNotificationFun endFun);
00099 
00100 PERFORM_API int SNDStartRecording(SndSoundStruct *soundStruct, int tag, int priority, int preempt, 
00101   SNDNotificationFun beginRecFun, SNDNotificationFun endRecFun);
00102  
00103 PERFORM_API int SNDSamplesProcessed(int tag);
00104 
00105 PERFORM_API void SNDStop(int tag);
00106 
00107 PERFORM_API void SNDPause(int tag);
00108 
00109 PERFORM_API void SNDResume(int tag);
00110 
00111 PERFORM_API int SNDUnreserve(int dunno);
00112 
00113 PERFORM_API void SNDTerminate(void);
00114 
00115 #ifdef __cplusplus
00116 }
00117 #endif
00118