// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // ¥ Initialise Static /*e*/ // ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ // Call before instantiating any CMADDrivers void CMADDriver::Initialise() { if (sLib) { SignalPStr_("\pCMADDriver : Already initialised"); return; } OSErr err; err=MADInitLibrary(0,false,&sLib); ThrowIfOSErr_(err); }
// Driver initialization: optimal values for BeOS. static MADDriverSettings MADDriverClass::CreateDefaultDriver(void) { #if 1 MADDriverSettings init = {0}; init.numChn = 4; init.outPutBits = 16; init.outPutRate = 44100; init.outPutMode = DeluxeStereoOutPut; init.driverMode = BeOSSoundDriver; init.repeatMusic = true; init.MicroDelaySize = 0; init.surround = false; init.Reverb = false; init.ReverbSize = 45; init.ReverbStrength = 60; init.TickRemover = true; #else MADDriverSettings init = { .numChn = 4, .outPutBits = 16, .outPutRate = 44100, .outPutMode = DeluxeStereoOutPut, .driverMode = BeOSSoundDriver, .repeatMusic = true, .MicroDelaySize = 0, .surround = false, .Reverb = false, .ReverbSize = 45, .ReverbStrength = 60, .TickRemover = true }; #endif return init; } // Library initialization. bool MADDriverClass::InitLibrary(MADDriverSettings &init) { // Reset data members to indicate that initialization isn't complete. libraryError = MADNoErr; inited = false; musicPlay = false; curDriverRec = NULL; curMusic = NULL; settings = *init; // Init the library: default plugins folder is "add-ons". if ((libraryError = MADInitLibrary("add-ons", &MADLib)) != MADNoErr) { #if DRIVERCLASS_DEBUG debugger("Cannot initialize library."); #else return false; #endif } // Init the driver. if ((libraryError = MADCreateDriver(&init, MADLib, &curDriverRec)) != MADNoErr) { #if DRIVERCLASS_DEBUG debugger("Cannot create driver."); #else return false; #endif } // Init system streamers. media_raw_audio_format format; format.frame_rate = init.outPutRate; format.channel_count = 2; // Always stereo ! format.format = B_AUDIO_FLOAT; // Always float ! format.byte_order = 1; format.buffer_size = (curDriverRec->BufSize * sizeof(float)) / (init.outPutBits / 8); streamPlayer = new BSoundPlayer(&format, BSoundName, trackerStreamPlay, NULL, this); streamPlayer->SetHasData(true); streamPlayer->Start(); return true; }