⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rosegardenguiview.cpp

📁 LINUX下的混音软件
💻 CPP
📖 第 1 页 / 共 5 页
字号:
        return ;    }    slotEditSegmentsEventList(segmentsToEdit);}void RosegardenGUIView::slotEditSegmentsEventList(std::vector<Segment *> segmentsToEdit){    int count = 0;    for (std::vector<Segment *>::iterator i = segmentsToEdit.begin();            i != segmentsToEdit.end(); ++i) {        std::vector<Segment *> tmpvec;        tmpvec.push_back(*i);        EventView *view = createEventView(tmpvec);        if (view) {            view->show();            if (++count == maxEditorsToOpen)                break;        }    }}void RosegardenGUIView::slotEditTriggerSegment(int id){    SetWaitCursor waitCursor;    std::vector<Segment *> segmentsToEdit;    Segment *s = getDocument()->getComposition().getTriggerSegment(id);    if (s) {        segmentsToEdit.push_back(s);    } else {        return ;    }    slotEditSegmentsEventList(segmentsToEdit);}void RosegardenGUIView::slotSegmentAutoSplit(Segment *segment){    AudioSplitDialog aSD(this, segment, getDocument());    if (aSD.exec() == QDialog::Accepted) {        KCommand *command =            new AudioSegmentAutoSplitCommand(getDocument(),                                             segment, aSD.getThreshold());        slotAddCommandToHistory(command);    }}void RosegardenGUIView::slotEditSegmentAudio(Segment *segment){    std::cout << "RosegardenGUIView::slotEditSegmentAudio() - "    << "starting external audio editor" << std::endl;    KConfig* config = kapp->config();    config->setGroup(GeneralOptionsConfigGroup);    QString application = config->readEntry("externalaudioeditor", "");    if (application == "") {        application = AudioConfigurationPage::getBestAvailableAudioEditor();    }    QStringList splitCommand = QStringList::split(" ", application);    if (splitCommand.size() == 0) {        std::cerr << "RosegardenGUIView::slotEditSegmentAudio() - "        << "external editor \"" << application.data()        << "\" not found" << std::endl;        KMessageBox::sorry(this,                           i18n("You've not yet defined an audio editor for Rosegarden to use.\nSee Settings -> Configure Rosegarden -> Audio."));        return ;    }    QFileInfo *appInfo = new QFileInfo(splitCommand[0]);    if (appInfo->exists() == false || appInfo->isExecutable() == false) {        std::cerr << "RosegardenGUIView::slotEditSegmentAudio() - "                  << "can't execute \"" << splitCommand[0] << "\""                  << std::endl;        return;    }    AudioFile *aF = getDocument()->getAudioFileManager().                    getAudioFile(segment->getAudioFileId());    if (aF == 0) {        std::cerr << "RosegardenGUIView::slotEditSegmentAudio() - "        << "can't find audio file" << std::endl;        return ;    }    // wait cursor    QApplication::setOverrideCursor(QCursor(Qt::waitCursor));    // Prepare the process    //    KProcess *process = new KProcess();    (*process) << splitCommand;    (*process) << QString(aF->getFilename().c_str());    // Start it    //    if (!process->start()) {        std::cerr << "RosegardenGUIView::slotEditSegmentAudio() - "        << "can't start external editor" << std::endl;    }    // restore cursor    QApplication::restoreOverrideCursor();}void RosegardenGUIView::setZoomSize(double size){    m_rulerScale->setUnitsPerPixel(size);    double duration44 = TimeSignature(4, 4).getBarDuration();    double xScale = duration44 / (size * barWidth44);    RG_DEBUG << "RosegardenGUIView::setZoomSize - xScale =  " << xScale << endl;    m_trackEditor->slotSetPointerPosition    (getDocument()->getComposition().getPosition());    m_trackEditor->getSegmentCanvas()->clearSegmentRectsCache(true);    m_trackEditor->getSegmentCanvas()->slotUpdateSize();    m_trackEditor->getSegmentCanvas()->slotUpdateSegmentsDrawBuffer();    if (m_trackEditor->getTempoRuler()) {        m_trackEditor->getTempoRuler()->repaint();    }    if (m_trackEditor->getChordNameRuler()) {        m_trackEditor->getChordNameRuler()->repaint();    }    if (m_trackEditor->getTopStandardRuler()) {        m_trackEditor->getTopStandardRuler()->repaint();    }    if (m_trackEditor->getBottomStandardRuler()) {        m_trackEditor->getBottomStandardRuler()->repaint();    }}void RosegardenGUIView::slotSelectTrackSegments(int trackId){    // update the instrument parameter box    Composition &comp = getDocument()->getComposition();    Track *track = comp.getTrackById(trackId);    if (track == 0)        return ;    // Show the selection on the track buttons.  Find the position.    //    m_trackEditor->getTrackButtons()->selectLabel(track->getPosition());    m_trackEditor->slotScrollToTrack(track->getPosition());    SegmentSelection segments;    for (Composition::iterator i =                getDocument()->getComposition().begin();            i != getDocument()->getComposition().end(); i++) {        if (((int)(*i)->getTrack()) == trackId)            segments.insert(*i);    }    // Store the selected Track in the Composition    //    comp.setSelectedTrack(trackId);    m_trackParameterBox->slotSelectedTrackChanged();    slotUpdateInstrumentParameterBox(comp.getTrackById(trackId)->                                     getInstrument());    slotPropagateSegmentSelection(segments);    // inform    emit segmentsSelected(segments);    emit compositionStateUpdate();}void RosegardenGUIView::slotPropagateSegmentSelection(const SegmentSelection &segments){    // Send this signal to the GUI to activate the correct tool    // on the toolbar so that we have a SegmentSelector object    // to write the Segments into    //    if (!segments.empty()) {        emit activateTool(SegmentSelector::ToolName);    }    // Send the segment list even if it's empty as we    // use that to clear any current selection    //    m_trackEditor->getSegmentCanvas()->slotSelectSegments(segments);    // update the segment parameter box    m_segmentParameterBox->useSegments(segments);    if (!segments.empty()) {        emit stateChange("have_selection", true);        if (!segments.hasNonAudioSegment()) {            emit stateChange("audio_segment_selected", true);        }    } else {        emit stateChange("have_selection", false);    }}void RosegardenGUIView::slotSelectAllSegments(){    SegmentSelection segments;    InstrumentId instrument = 0;    bool haveInstrument = false;    bool multipleInstruments = false;    Composition &comp = getDocument()->getComposition();    for (Composition::iterator i = comp.begin(); i != comp.end(); ++i) {        InstrumentId myInstrument =            comp.getTrackById((*i)->getTrack())->getInstrument();        if (haveInstrument) {            if (myInstrument != instrument) {                multipleInstruments = true;            }        } else {            instrument = myInstrument;            haveInstrument = true;        }        segments.insert(*i);    }    // Send this signal to the GUI to activate the correct tool    // on the toolbar so that we have a SegmentSelector object    // to write the Segments into    //    if (!segments.empty()) {        emit activateTool(SegmentSelector::ToolName);    }    // Send the segment list even if it's empty as we    // use that to clear any current selection    //    m_trackEditor->getSegmentCanvas()->slotSelectSegments(segments);    // update the segment parameter box    m_segmentParameterBox->useSegments(segments);    // update the instrument parameter box    if (haveInstrument && !multipleInstruments) {        slotUpdateInstrumentParameterBox(instrument);    } else {        m_instrumentParameterBox->useInstrument(0);    }    //!!! similarly, how to set no selected track?    //comp.setSelectedTrack(trackId);    if (!segments.empty()) {        emit stateChange("have_selection", true);        if (!segments.hasNonAudioSegment()) {            emit stateChange("audio_segment_selected", true);        }    } else {        emit stateChange("have_selection", false);    }    // inform    //!!! inform what? is this signal actually used?    emit segmentsSelected(segments);}void RosegardenGUIView::slotUpdateInstrumentParameterBox(int id){    Studio &studio = getDocument()->getStudio();    Instrument *instrument = studio.getInstrumentById(id);    Composition &comp = getDocument()->getComposition();    Track *track = comp.getTrackById(comp.getSelectedTrack());    // Reset the instrument    //    m_instrumentParameterBox->useInstrument(instrument);    // Then do this instrument/track fiddling    //    /*        if (track && instrument &&                instrument->getType() == Instrument::Audio)        {            // Set the mute status            m_instrumentParameterBox->setMute(track->isMuted());                 // Set the record track            m_instrumentParameterBox->setRecord(                        track->getId() == comp.getRecordTrack());                 // Set solo            m_instrumentParameterBox->setSolo(                    comp.isSolo() && (track->getId() == comp.getSelectedTrack()));        }    */    emit checkTrackAssignments();}void RosegardenGUIView::showVisuals(const MappedEvent *mE){    double valueLeft = ((double)mE->getData1()) / 127.0;    double valueRight = ((double)mE->getData2()) / 127.0;    if (mE->getType() == MappedEvent::AudioLevel) {        // Send to the high sensitivity instrument parameter box        // (if any)        //        if (m_instrumentParameterBox->getSelectedInstrument() &&                mE->getInstrument() ==                m_instrumentParameterBox->getSelectedInstrument()->getId()) {            float dBleft = AudioLevel::fader_to_dB                           (mE->getData1(), 127, AudioLevel::LongFader);            float dBright = AudioLevel::fader_to_dB                            (mE->getData2(), 127, AudioLevel::LongFader);            m_instrumentParameterBox->setAudioMeter(dBleft, dBright,                                                    AudioLevel::DB_FLOOR,                                                    AudioLevel::DB_FLOOR);        }        // Don't always send all audio levels so we don't        // get vu meter flickering on track meters        //        if (valueLeft < 0.05 && valueRight < 0.05)            return ;    } else if (mE->getType() != MappedEvent::MidiNote)        return ;    m_trackEditor->getTrackButtons()->    slotSetMetersByInstrument((valueLeft + valueRight) / 2,                              mE->getInstrument());}voidRosegardenGUIView::updateMeters(SequencerMapper *mapper){    const int unknownState = 0, oldState = 1, newState = 2;    typedef std::map<InstrumentId, int> StateMap;    static StateMap states;    static StateMap recStates;    typedef std::map<InstrumentId, LevelInfo> LevelMap;    static LevelMap levels;    static LevelMap recLevels;    for (StateMap::iterator i = states.begin(); i != states.end(); ++i) {        i->second = unknownState;    }    for (StateMap::iterator i = recStates.begin(); i != recStates.end(); ++i) {        i->second = unknownState;    }    for (Composition::trackcontainer::iterator i =                getDocument()->getComposition().getTracks().begin();            i != getDocument()->getComposition().getTracks().end(); ++i) {        Track *track = i->second;        if (!track)            continue;        InstrumentId instrumentId = track->getInstrument();        if (states[instrumentId] == unknownState) {            bool isNew = mapper->getInstrumentLevel(instrumentId,                                                    levels[instrumentId]);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -