// This seek to the next track (if applicable) void CAudioCD::seekForward() { // Can't go past "max_tracks" if(track >= max_tracks) return; // Increment the track track++; setPlayPos(track); // Set the play pos for the track stop(); // Stop the CD (temporarily) play(); // Immediately start back up at new position }
void CAudioCD::seekBack() { // Can't go past "first track" if(track <= 1) return; // Decrement track track--; setPlayPos(track); // Set the play pos for the track stop(); // Stop the CD (temporarily) play(); // Immediately start back up at new position }
void song::clearProject() { engine::projectJournal()->setJournalling( false ); if( m_playing ) { stop(); } for( int i = 0; i < Mode_Count; i++ ) { setPlayPos( 0, ( PlayModes )i ); } engine::mixer()->lock(); if( engine::getBBEditor() ) { engine::getBBEditor()->clearAllTracks(); } if( engine::songEditor() ) { engine::songEditor()->clearAllTracks(); } if( engine::fxMixerView() ) { engine::fxMixerView()->clear(); } QCoreApplication::sendPostedEvents(); engine::getBBTrackContainer()->clearAllTracks(); clearAllTracks(); engine::fxMixer()->clear(); if( engine::automationEditor() ) { engine::automationEditor()->setCurrentPattern( NULL ); } if( engine::pianoRoll() ) { engine::pianoRoll()->reset(); } m_tempoModel.reset(); m_masterVolumeModel.reset(); m_masterPitchModel.reset(); m_timeSigModel.reset(); AutomationPattern::globalAutomationPattern( &m_tempoModel )->clear(); AutomationPattern::globalAutomationPattern( &m_masterVolumeModel )-> clear(); AutomationPattern::globalAutomationPattern( &m_masterPitchModel )-> clear(); engine::mixer()->unlock(); if( engine::getProjectNotes() ) { engine::getProjectNotes()->clear(); } // Move to function while( !m_controllers.empty() ) { delete m_controllers.last(); } emit dataChanged(); engine::projectJournal()->clearJournal(); engine::projectJournal()->setJournalling( true ); InstrumentTrackView::cleanupWindowCache(); }
bool CAudioCD::init(HWND hwnd) { if(hwnd == NULL) return false; // Got a bogus HWND // Save off the window handle win_hwnd = hwnd; MCI_OPEN_PARMS mci_open_params; // This is a struct provided by MCI "Media Control // Interface". We need to fill it with some information // and then use it to see if we can open a CD audio device. mci_open_params.lpstrDeviceType = "cdaudio"; // We fill the device type with the name // of the device we want to open. // MSDN has a list of all these (if you can // find it :) // Okay this is the function that opens our device (and is the main function for using // MCI as you'll see :) // By parameter // 0 -- Needs to be zero if the second parameter is MCI_OPEN // MCI_OPEN -- This flag says we're initializing a device or file // MCI_OPEN_TYPE -- This flag says the lpstrDeviceType in "mci_open_params" is valid // &mci_open_params -- Address of our MCI_OPEN_PARAMS struct we filled in if(mciSendCommand(0, MCI_OPEN, MCI_OPEN_TYPE, (DWORD)&mci_open_params)) return false; device_handle = mci_open_params.wDeviceID; // Save of the opened device handle // **Now we want to set the way we interrupt "time" for the tracks** MCI_SET_PARMS mci_set_params; // This struct will be filled with how we want the // device to hand the "time of tracks" -- We want to associate // "track time" as minutes and seconds mci_set_params.dwCallback = (ULONG)win_hwnd; // The HWND where the MCI_NOTIFY message // can be found mci_set_params.dwTimeFormat = MCI_FORMAT_TMSF; // This flag says we want the time in // tracks, minutes, seconds and frames // Again we'll use the mciSendCommand(), by parameter: // device_handle -- Device ID that is to receive the command message // MCI_SET -- This flag says "this command sets device information" // MCI_SET_TIME_FORMAT -- This flag says the dwTimeFormat in "mci_set_params" is valid // &mci_set_params -- The address of the MCI_SET_PARAMS struct we need to pass in if(mciSendCommand(device_handle,MCI_SET,MCI_SET_TIME_FORMAT,(DWORD)&mci_set_params)) return false; // **Lastly determine how many tracks our on the CD** MCI_STATUS_PARMS status; // For holding status about the device status.dwCallback = (ULONG)win_hwnd; // Set the window handle status.dwItem = MCI_STATUS_NUMBER_OF_TRACKS; // Set the "dwItem" flag so // it says we are requesting // the number of tracks on the CD // By parameter: // device_handle -- Device ID that is to receive the command message // MCI_STATUS -- This flag says "this retrieves information about an MCI device" // MCI_STATUS_ITEM -- This flag says "the dwItem member in "status" is valid // &status -- Address of the MCI_STATUS_PARMS struct we set if(mciSendCommand(device_handle,MCI_STATUS,MCI_STATUS_ITEM,(DWORD)&status)) return false; max_tracks = status.dwReturn; // Save off the maximum number of tracks // Lastly set the playing position for the first track setPlayPos(track); return true; // Everything has went well }
void Song::clearProject() { Engine::projectJournal()->setJournalling( false ); if( m_playing ) { stop(); } for( int i = 0; i < Mode_Count; i++ ) { setPlayPos( 0, ( PlayModes )i ); } Engine::mixer()->requestChangeInModel(); if( gui && gui->getBBEditor() ) { gui->getBBEditor()->trackContainerView()->clearAllTracks(); } if( gui && gui->songEditor() ) { gui->songEditor()->m_editor->clearAllTracks(); } if( gui && gui->fxMixerView() ) { gui->fxMixerView()->clear(); } QCoreApplication::sendPostedEvents(); Engine::getBBTrackContainer()->clearAllTracks(); clearAllTracks(); Engine::fxMixer()->clear(); if( gui && gui->automationEditor() ) { gui->automationEditor()->setCurrentPattern( NULL ); } if( gui && gui->pianoRoll() ) { gui->pianoRoll()->reset(); } m_tempoModel.reset(); m_masterVolumeModel.reset(); m_masterPitchModel.reset(); m_timeSigModel.reset(); AutomationPattern::globalAutomationPattern( &m_tempoModel )->clear(); AutomationPattern::globalAutomationPattern( &m_masterVolumeModel )-> clear(); AutomationPattern::globalAutomationPattern( &m_masterPitchModel )-> clear(); Engine::mixer()->doneChangeInModel(); if( gui && gui->getProjectNotes() ) { gui->getProjectNotes()->clear(); } removeAllControllers(); emit dataChanged(); Engine::projectJournal()->clearJournal(); Engine::projectJournal()->setJournalling( true ); InstrumentTrackView::cleanupWindowCache(); }