home *** CD-ROM | disk | FTP | other *** search
-
- #ifndef __MAININCLUDES__
- #define __MAININCLUDES__
- #endif
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // resources IDs
-
- // Menus. The menu IDs have an "m" prefix and item numbers have an "i" prefix.
-
- #define rMenuBar 1000 // application's menu bar
-
- #define mApple 128 // Apple menu
- #define iAbout 1
-
- #define mFile 129 // File menu
- #define iPlay 1
- #define iPlayBackwards 2
- #define iRecord 3
- #define iSynthisize 4
- #define iKill 5
- #define iQuit 7
-
- #define mEdit 130 // Edit menu
- #define iUndo 1
- #define iCut 3
- #define iCopy 4
- #define iPaste 5
- #define iClear 6
-
-
- // window resources
-
- #define rMainWindow 1000 // main window
-
- #define rAmpButton 1000 // main window buttons
- #define rPitchButton 1001
-
-
- // dialog resources
-
- #define rAboutAlert 1000 // about alert
- #define rUserAlert 1001 // user error alert
-
-
- // error strings resource
- #define rErrStrings 1000 // error string list
-
- #define eSystemTooOld 1 // indicies into error STR# resource
- #define eNoMenuBar 2
- #define eNoMemory 3
- #define eNoWindow 4
- #define eNoSndInDevice 5
- #define eRecording 6
- #define eGettingChan 7
- #define eSndOutMgr 8
- #define eSndInMgr 9
- #define eResourceErr 10
- #define eFileErr 11
- #define eUnexpected 12
-
- // other strings
- #define rAmpString 1000 // text drawn below the amplitude control
- #define rPitchString 1001 // text drawn below the pitch control
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // application constants
-
- #define kOldestSystemAllowed 0x0602 // System 6.0.2 version number
-
- #define kBackSleep MAXLONG // sleeping amount while in background
- #define kForeSleep 60 // sleep amount while in foreground
-
- #define kFatalError true // error was fatal for AlertUser
-
- #define kMiddleC 60 // meaningless baseFrequency
-
- #define kMinSize (160 * 1024) // minimal partition for SIZE resource
- #define kPrefSize (300 * 1024) // preferred partition for SIZE resource
-
- #define kMinHeap (80 * 1024) // minimal heap size I want to run in
- #define kMinSpace (40 * 1024) // minimal heap size left for toolbox
-
- #define kDIPosition *(Point *)0x00500070 // the topLeft for the Disk Init dialog
-
- #define kAppCreator 'CAMl' // creator type of this application
-
- #define kFileType 'APPL' // file type of this application
-
- #define kControlTextOffset 24 // text is drawn this far below the controls
-
- #define kPitchDefault 440 // default pitch setting (A)
- #define kAmpDefault 64 // default amplitude
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // typedefs
-
- // typedefs cannot be used by Rez
- #ifndef forRez
-
- struct MainWindow {
- WindowRecord window;
- StringHandle ampString;
- StringHandle pitchString;
- };
- typedef struct MainWindow MainWindow;
- typedef struct MainWindow *MainWindowPtr;
-
-
- struct WaveCycle {
- unsigned short length;
- Ptr wavePtr;
- };
- typedef struct WaveCycle WaveCycle;
- typedef struct WaveCycle *WaveCyclePtr;
-
- #endif
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // handy macros
-
- // C macros cannot be used by Rez
- #ifndef forRez
-
- // this is much better than the toolbox calls
- #define HiWrd(aLong) (((aLong) >> 16) & 0xFFFF)
- #define LoWrd(aLong) ((aLong) & 0xFFFF)
-
- // This will insert debugging code in the application to check conditions
- #if _DEBUG
- #define Assert(cond, s) if (cond) DebugStr (s)
- #else
- #define Assert(cond, s) ((void) 0)
- #endif
-
- // This will display a message in the debugger
- #if _VERBOSE
- #define DebugMessage(s) DebugStr (s)
- #else
- #define DebugMessage(s) ((void) 0)
- #endif
-
-
- #endif
-
-
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // prototypes for file outside of the main source file
-
- // C function prototypes cannot be used by Rez
- #ifndef forRez
-
- // From the source file AIFFGoodies.c
- OSErr OpenAIFFFile (short *fRefNum);
- long GetAIFFHeaderInfo (short frefNum, SoundHeaderPtr theHeader);
- OSErr RecordAIFFFile (OSType creator);
-
-
- // From the source file DoubleBuffers.c
- OSErr InitDoubleBuffer(void);
- void CloseDoubleBuffer(void);
-
- OSErr PlayFile(Boolean foreward, Ptr *privateData);
- void PlayWave (long durration, WaveCyclePtr theWave, Ptr *privateData);
-
-
- OSErr DoubleBuffer (SndChannelPtr chan, unsigned long fileRefNum, ProcPtr readproc, ProcPtr processproc,
- SoundHeaderPtr generalHeader, unsigned long playSize, long dataOffset, Ptr *privateData);
-
- void FreeDBPrivateMem (void *freeSpace);
-
- void KillDoubleBuffer (void);
- OSErr ReadProc (void *private, short bufNum, Boolean asynch);
- void ProcessingProc (void);
- OSErr BackReadProc (void *private, short bufNum, Boolean asynch);
- void BackProcessingProc (void);
- pascal void DBService(SndChannelPtr chan, SndCommand* acmd);
-
- // From the source file Oscilator.c
- WaveCyclePtr NewWaveForm (unsigned char amplitude, unsigned short frequency);
-
- #endif
-
-