bool GMESong::SetSubsong(int track) { if (CurrTrack == track) { return false; } return StartTrack(track); }
void GMESong::Play(bool looping, int track) { m_Status = STATE_Stopped; m_Looping = looping; if (StartTrack(track) && m_Stream->Play(looping, 1)) { m_Status = STATE_Playing; } }
int CheckGoTo(double desRA, double desDec, int pmodel) { double telra1, teldec1; double errorRA, errorDec, nowRA, nowDec; double tolra, toldec; /* Is the telescope slewing? */ if ( GetSlewStatus() == 1 ) { /* One or more axes remain in motion */ /* Try again later */ return(0); } /* Was this a two-phase slew? */ if ( slewphase == 2 ) { /* Reset the slew phase and continue to the destination */ slewphase = 0; /* Go to the original destination */ /* GoToCoords will change slewphase to 1 */ GoToCoords(desRA, desDec, pmodel); /* Return a flag indicating a new goto operation is in progress */ return(0); } else if ( slewphase == 1 ) { /* No axes are moving. Insure that tracking is started again. */ StartTrack(); /* Where are we now? */ GetTel(&nowRA, &nowDec, pmodel); /* Compare to destination with pre-defined tolerances */ telra1 = desRA; teldec1 = desDec; /* RA slew tolerance in hours */ tolra = SLEWTOLRA; /* Dec slew tolerance in degrees */ toldec = SLEWTOLDEC; /* What is the absolute value of the pointing error? */ /* Magnitude of RA pointing error in hours */ errorRA = fabs(nowRA - telra1); /* Magnitude of Dec pointing error in degrees */ errorDec = fabs(nowDec - teldec1); /* Compare and notify whether we are within tolerance */ if( ( errorRA > tolra ) || ( errorDec > toldec ) ) { /* Result of slew is outside acceptable tolerance */ /* Signal the calling routine that another goto may be needed */ slewphase = 0; return(2); } } else { /* Unexpected slew phase */ /* Reset and return success without a test */ /* This should clear errors and enable another slew request from the UI */ /* Better would be to flag an error but that might have unintended consequences */ slewphase = 0; } return(1); }