home *** CD-ROM | disk | FTP | other *** search
- /********************************************************/
- /*
- Player PRO 4.5.1 -- Music Driver EXAMPLE
-
- Library Version 4.01
-
- To use with Think C & CodeWarrior
-
- Antoine ROSSET
- 16 Tranchees
- 1206 GENEVA
- SWITZERLAND
-
- FAX: (41 22) 346 11 97
- PHONE: (41 89) 203 74 62
- Compuserve: 100277,164
- Internet: rosset@dial.eunet.ch
- */
- /********************************************************/
-
- #include "RDriver.h" // Mad Driver functions & globals
-
- /*****************************/
- /****** MAIN FUNCTION ********/
- /*****************************/
-
- void main( void)
- {
- Point where = { -1, -1};
- SFReply reply;
- SFTypeList aType;
- Boolean End;
-
- /*************** ****************/
- /****** Toolbox Initialization **********/
- /*************** ****************/
-
- InitGraf( &qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs(0L);
- InitCursor();
- MaxApplZone();
- MoreMasters();
-
- /*******************************************************************************************/
- /****** MAD Library Initialisation : choose the best driver for the current hardware ******/
- /****** ******/
- /****** Standard initialization with 4 channels... ******/
- /*******************************************************************************************/
-
- {
- MADDriverSettings init;
-
-
- /*
- MANUAL DRIVER CONFIGURATION, by example:
-
- init.numChn = 4;
- init.outPutBits = 8;
- init.outPutRate = rate22khz;
- init.outPutMode = StereoOutPut;
- init.driverMode = SoundManagerDriver;
- init.antiAliasing = false;
- init.repeatMusic = false;
- init.Interpolation = false;
- init.MicroDelay = false;
- init.MicroDelaySize = 0;
- init.surround = false;
-
- */
-
- /* AUTOMATIC DRIVER CONFIGURATION FOR CURRENT MAC HARDWARE*/
- MADGetBestDriver( &init);
-
- MADInitLibrary( "\pPlugs");
- if( MADCreateDriver( &init) != noErr) DebugStr("\pSmall Problem...");
- }
- /*********************************/
- /*********************************/
- /*********************************/
-
- /****** Open a music file via Plugs ********/
- End = false;
-
-
-
- while( End == false)
- {
- FlushEvents( everyEvent, 0);
- SFGetFile( where, "\p", 0L, -1, aType, 0L, &reply);
-
- if( !reply.good) End = true;
- else
- {
- SetVol( 0L, reply.vRefNum);
-
- if( MADPlugAvailable( reply.fType)) // Is available a plug to open this file?
- {
- if( MADImportMusicFile( reply.fType, reply.fName) == noErr) // Load this music with help of Plugs
- // in application folder or in 'Plugs' folder
- {
- MADPlay(); // Turn interrupt driver function ON
- MADDriver->Reading = true; // Read the current partition in memory
-
- while( !Button())
- {
- /** Do what you want here.... **/
- /** Bla bla... **/
- /** By example: Run your realtime 3D game... **/
- }
- MADDriver->Reading = false; // Stop reading current partition
- MADStop(); // Stop driver interrupt function
-
- MADDisposeMusic(); // Dispose the current music
- }
- }
- }
- }
- MADDisposeDriver(); // Dispose music driver
- MADDisposeLibrary(); // Close music library
-
- FlushEvents( everyEvent, 0);
- }