void setup(void) { board.init(); // sleep for 100ms board.delayMilliseconds(100); // flash the LEDs to indicate startup board.ledRedOn(); board.ledGreenOff(); for (uint8_t i = 0; i < 10; i++) { board.ledRedToggle(); board.ledGreenToggle(); board.delayMilliseconds(50); } board.ledRedOff(); board.ledGreenOff(); // initialize our RC, IMU, mixer, and PID controller rc.init(&board); imu.init(&board); pid.init(); mixer.init(&board, &rc, &pid); msp.init(&board, &imu, &mixer, &rc); // set initial time previousTime = board.getMicros(); // always do gyro calibration at startup calibratingG = CONFIG_CALIBRATING_GYRO_CYCLES; // trigger accelerometer calibration requirement haveSmallAngle = true; } // setup
void mh_loadPatch_DEPR_(bool isProject, const char *projPath) { G_Mixer.init(); G_Mixer.ready = false; // put it in wait mode int numChans = G_Patch_DEPR_.getNumChans(); for (int i=0; i<numChans; i++) { Channel *ch = glue_addChannel(G_Patch_DEPR_.getColumn(i), G_Patch_DEPR_.getType(i)); string projectPath = projPath; // safe string samplePath = isProject ? projectPath + G_SLASH + G_Patch_DEPR_.getSamplePath(i) : ""; ch->readPatch_DEPR_(samplePath.c_str(), i, &G_Patch_DEPR_, G_Conf.samplerate, G_Conf.rsmpQuality); } G_Mixer.outVol = G_Patch_DEPR_.getOutVol(); G_Mixer.inVol = G_Patch_DEPR_.getInVol(); G_Mixer.bpm = G_Patch_DEPR_.getBpm(); G_Mixer.bars = G_Patch_DEPR_.getBars(); G_Mixer.beats = G_Patch_DEPR_.getBeats(); G_Mixer.quantize = G_Patch_DEPR_.getQuantize(); G_Mixer.metronome = G_Patch_DEPR_.getMetronome(); G_Patch_DEPR_.lastTakeId = G_Patch_DEPR_.getLastTakeId(); G_Patch_DEPR_.samplerate = G_Patch_DEPR_.getSamplerate(); /* rewind and update frames in Mixer (it's vital) */ G_Mixer.rewind(); G_Mixer.updateFrameBars(); G_Mixer.ready = true; }
void glue_resetToInitState(bool resetGui) { G_Mixer.running = false; for (unsigned i=0; i<MAX_NUM_CHAN; i++) mh_freeChan(i); recorder::init(); G_Patch.setDefault(); G_Mixer.init(); #ifdef WITH_VST G_PluginHost.freeAllStacks(); #endif if (resetGui) gu_update_controls(); }
/*Control method to mute sound using WinMM header */ void ControlSound ( bool flagMute ) { if ( MUTE_CHECK_FLAG ) { Mixer mixer; if ( mixer.init() && mixer.GetMuteControl() ) { if ( flagMute ) mixer.SetMute ( true ); else mixer.SetMute ( false ); } mixer.close(); } }
void setup(void) { uint32_t calibratingGyroMsec; // Get particulars for board board.init(imuLooptimeUsec, calibratingGyroMsec); // sleep for 100ms board.delayMilliseconds(100); // flash the LEDs to indicate startup board.ledRedOn(); board.ledGreenOff(); for (uint8_t i = 0; i < 10; i++) { board.ledRedToggle(); board.ledGreenToggle(); board.delayMilliseconds(50); } board.ledRedOff(); board.ledGreenOff(); // compute cycles for calibration based on board's time constant calibratingGyroCycles = (uint16_t)(1000. * calibratingGyroMsec / imuLooptimeUsec); calibratingAccCycles = (uint16_t)(1000. * CONFIG_CALIBRATING_ACC_MSEC / imuLooptimeUsec); // initializing timing tasks imuTask.init(imuLooptimeUsec); rcTask.init(CONFIG_RC_LOOPTIME_MSEC * 1000); accelCalibrationTask.init(CONFIG_CALIBRATE_ACCTIME_MSEC * 1000); altitudeEstimationTask.init(CONFIG_ALTITUDE_UPDATE_MSEC * 1000); // initialize our external objects with objects they need rc.init(&board); stab.init(&rc, &imu); imu.init(&board, calibratingGyroCycles, calibratingAccCycles); mixer.init(&board, &rc, &stab); msp.init(&board, &imu, &nav, &mixer, &rc); nav.init(&board, &imu, &baro, &rc); // always do gyro calibration at startup calibratingG = calibratingGyroCycles; // assume shallow angle (no accelerometer calibration needed) haveSmallAngle = true; // ensure not armed armed = false; // attempt to initialize barometer baro.init(&board); } // setup
void mh_loadPatch(bool isProject, const char *projPath) { G_Mixer.init(); G_Mixer.ready = false; // put it in wait mode int numChans = G_Patch.getNumChans(); for (int i=0; i<numChans; i++) { Channel *ch = glue_addChannel(G_Patch.getColumn(i), G_Patch.getType(i)); char smpPath[PATH_MAX]; /* projects < 0.6.3 version are not portable. Just use the regular * samplePath */ /* TODO version >= 0.10.0 - old stuff, remove backward compatibility */ if (isProject && G_Patch.version >= 0.63f) sprintf(smpPath, "%s%s%s", gDirname(projPath).c_str(), gGetSlash().c_str(), G_Patch.getSamplePath(i).c_str()); else sprintf(smpPath, "%s", G_Patch.getSamplePath(i).c_str()); ch->loadByPatch(smpPath, i); } G_Mixer.outVol = G_Patch.getOutVol(); G_Mixer.inVol = G_Patch.getInVol(); G_Mixer.bpm = G_Patch.getBpm(); G_Mixer.bars = G_Patch.getBars(); G_Mixer.beats = G_Patch.getBeats(); G_Mixer.quantize = G_Patch.getQuantize(); G_Mixer.metronome = G_Patch.getMetronome(); G_Patch.lastTakeId = G_Patch.getLastTakeId(); G_Patch.samplerate = G_Patch.getSamplerate(); /* rewind and update frames in Mixer (it's vital) */ G_Mixer.rewind(); G_Mixer.updateFrameBars(); G_Mixer.ready = true; }