I'm not claiming this _is_ final; after it's accepted, I'll want to do
one last check. But I think this is it.
It modifies a bunch of main rosegarden stuff to add "pitch tracker" to
various places, allowing the user to actually enter the view.
Cheers,
- Graham
Index: src/gui/application/RosegardenMainViewWidget.h
===================================================================
--- src/gui/application/RosegardenMainViewWidget.h (revision 12276)
+++ src/gui/application/RosegardenMainViewWidget.h (working copy)
@@ -46,6 +46,7 @@
class RosegardenDocument;
class RealTime;
class NotationView;
+class PitchTrackerView;
class MatrixView;
class MappedEvent;
class InstrumentParameterBox;
@@ -141,6 +142,8 @@
void slotEditSegmentsPercussionMatrix(std::vector<Segment*>);
void slotEditSegmentEventList(Segment*);
void slotEditSegmentsEventList(std::vector<Segment*>);
+ void slotEditSegmentPitchTracker(Segment*);
+ void slotEditSegmentsPitchTracker(std::vector<Segment*>);
void slotEditTriggerSegment(int);
void slotEditSegmentAudio(Segment*);
void slotSegmentAutoSplit(Segment*);
@@ -310,6 +313,7 @@
NotationView *createNotationView(std::vector<Segment *>);
MatrixView *createMatrixView (std::vector<Segment *>, bool drumMode);
EventView *createEventView (std::vector<Segment *>);
+ PitchTrackerView *createPitchTrackerView (std::vector<Segment *>);
virtual void windowActivationChange(bool);
Index: src/gui/application/RosegardenMainWindow.cpp
===================================================================
--- src/gui/application/RosegardenMainWindow.cpp (revision 12276)
+++ src/gui/application/RosegardenMainWindow.cpp (working copy)
@@ -758,6 +758,7 @@
createAction("edit_percussion_matrix", SLOT(slotEditInPercussionMatrix()));
createAction("edit_notation", SLOT(slotEditAsNotation()));
createAction("edit_event_list", SLOT(slotEditInEventList()));
+ createAction("edit_pitch_tracker", SLOT(slotEditInPitchTracker()));
createAction("quantize_selection", SLOT(slotQuantizeSelection()));
createAction("relabel_segment", SLOT(slotRelabelSegments()));
createAction("transpose", SLOT(slotTransposeSegments()));
@@ -3077,6 +3078,12 @@
}
void
+RosegardenMainWindow::slotEditInPitchTracker()
+{
+ m_view->slotEditSegmentPitchTracker(0);
+}
+
+void
RosegardenMainWindow::slotEditTempos()
{
slotEditTempos(m_doc->getComposition().getPosition());
Index: src/gui/application/RosegardenMainWindow.h
===================================================================
--- src/gui/application/RosegardenMainWindow.h (revision 12276)
+++ src/gui/application/RosegardenMainWindow.h (working copy)
@@ -839,6 +839,12 @@
void slotEditInPercussionMatrix();
/**
+ * open a pitch tracker view for the currently-selected segments
+ * (NB: only accepts 1 segment)
+ */
+ void slotEditInPitchTracker();
+
+ /**
* open a notation view with all currently-selected segments in it
*/
void slotEditAsNotation();
Index: src/gui/application/RosegardenMainViewWidget.cpp
===================================================================
--- src/gui/application/RosegardenMainViewWidget.cpp (revision 12276)
+++ src/gui/application/RosegardenMainViewWidget.cpp (working copy)
@@ -55,6 +55,7 @@
#include "gui/editors/parameters/InstrumentParameterBox.h"
#include "gui/editors/parameters/SegmentParameterBox.h"
#include "gui/editors/parameters/TrackParameterBox.h"
+#include "gui/editors/pitchtracker/PitchTrackerView.h"
#include "gui/editors/segment/compositionview/CompositionView.h"
#include "gui/editors/segment/compositionview/SegmentSelector.h"
#include "gui/editors/segment/TrackEditor.h"
@@ -151,6 +152,10 @@
SLOT(slotEditSegmentNotation(Segment*)));
connect(m_trackEditor->getCompositionView(),
+ SIGNAL(editSegmentPitchView(Segment*)),
+ SLOT(slotEditSegmentPitchView(Segment*)));
+
+ connect(m_trackEditor->getCompositionView(),
SIGNAL(editSegmentMatrix(Segment*)),
SLOT(slotEditSegmentMatrix(Segment*)));
@@ -502,6 +507,178 @@
return notationView;
}
+// mostly copied from slotEditSegmentNotationView, but some changes
+// marked with CMT
+void RosegardenMainViewWidget::slotEditSegmentPitchTracker(Segment* p)
+{
+
+ SetWaitCursor waitCursor;
+ std::vector<Segment *> segmentsToEdit;
+
+ RG_DEBUG << "\n\n\n\nRosegardenMainViewWidget::slotEditSegmentNotation: p is " << p << endl;
+
+ // The logic here is: If we're calling for this operation to
+ // happen on a particular segment, then open that segment and if
+ // it's part of a selection open all other selected segments too.
+ // If we're not calling for any particular segment, then open all
+ // selected segments if there are any.
+
+ if (haveSelection()) {
+
+ SegmentSelection selection = getSelection();
+
+ if (!p || (selection.find(p) != selection.end())) {
+ for (SegmentSelection::iterator i = selection.begin();
+ i != selection.end(); ++i) {
+ if ((*i)->getType() != Segment::Audio) {
+ segmentsToEdit.push_back(*i);
+ }
+ }
+ } else {
+ if (p->getType() != Segment::Audio) {
+ segmentsToEdit.push_back(p);
+ }
+ }
+
+ } else if (p) {
+ if (p->getType() != Segment::Audio) {
+ segmentsToEdit.push_back(p);
+ }
+ } else {
+ return ;
+ }
+
+ if (segmentsToEdit.empty()) {
+ /* was sorry */ QMessageBox::warning(this, "", tr("No non-audio segments selected"));
+ return ;
+ }
+
+
+ // addition by CMT
+ if (segmentsToEdit.size() > 1) {
+ QMessageBox::warning(this, "", tr("Pitch Tracker can only contain 1 segment."));
+ return ;
+ }
+ //!!! not necessary? NotationView doesn't do this. -gp
+// if (Segment::Audio == segmentsToEdit[0]->getType()) {
+// QMessageBox::warning(this, "", tr("Pitch Tracker needs a non-audio track."));
+// return ;
+// }
+
+ slotEditSegmentsPitchTracker(segmentsToEdit);
+}
+
+void RosegardenMainViewWidget::slotEditSegmentsPitchTracker(std::vector<Segment *> segmentsToEdit)
+{
+ PitchTrackerView *view = createPitchTrackerView(segmentsToEdit);
+ if (view) {
+ if (view->getJackConnected()) {
+ view->show();
+ } else {
+ delete view;
+ }
+ }
+}
+
+//!!! copied (+ renamed vars) blindly from NotationView, but it works. -gp
+PitchTrackerView *
+RosegardenMainViewWidget::createPitchTrackerView(std::vector<Segment *> segmentsToEdit)
+{
+ PitchTrackerView *pitchTrackerView =
+ new PitchTrackerView(getDocument(), segmentsToEdit, this);
+
+
+ // For tempo changes (ugh -- it'd be nicer to make a tempo change
+ // command that could interpret all this stuff from the dialog)
+ //
+ connect(pitchTrackerView, SIGNAL(changeTempo(timeT,
+ tempoT,
+ tempoT,
+ TempoDialog::TempoDialogAction)),
+ RosegardenMainWindow::self(), SLOT(slotChangeTempo(timeT,
+ tempoT,
+ tempoT,
+ TempoDialog::TempoDialogAction)));
+
+
+ connect(pitchTrackerView, SIGNAL(windowActivated()),
+ this, SLOT(slotActiveMainWindowChanged()));
+
+ connect(pitchTrackerView, SIGNAL(selectTrack(int)),
+ this, SLOT(slotSelectTrackSegments(int)));
+
+ connect(pitchTrackerView, SIGNAL(play()),
+ RosegardenMainWindow::self(), SLOT(slotPlay()));
+ connect(pitchTrackerView, SIGNAL(stop()),
+ RosegardenMainWindow::self(), SLOT(slotStop()));
+ connect(pitchTrackerView, SIGNAL(fastForwardPlayback()),
+ RosegardenMainWindow::self(), SLOT(slotFastforward()));
+ connect(pitchTrackerView, SIGNAL(rewindPlayback()),
+ RosegardenMainWindow::self(), SLOT(slotRewind()));
+ connect(pitchTrackerView, SIGNAL(fastForwardPlaybackToEnd()),
+ RosegardenMainWindow::self(), SLOT(slotFastForwardToEnd()));
+ connect(pitchTrackerView, SIGNAL(rewindPlaybackToBeginning()),
+ RosegardenMainWindow::self(), SLOT(slotRewindToBeginning()));
+ connect(pitchTrackerView, SIGNAL(panic()),
+ RosegardenMainWindow::self(), SLOT(slotPanic()));
+
+ connect(pitchTrackerView, SIGNAL(saveFile()),
+ RosegardenMainWindow::self(), SLOT(slotFileSave()));
+// This probably is obsolete in Thorn.
+// connect(pitchTrackerView, SIGNAL(jumpPlaybackTo(timeT)),
+// getDocument(), SLOT(slotSetPointerPosition(timeT)));
+ connect(pitchTrackerView, SIGNAL(openInNotation(std::vector<Segment *>)),
+ this, SLOT(slotEditSegmentsNotation(std::vector<Segment *>)));
+ connect(pitchTrackerView, SIGNAL(openInMatrix(std::vector<Segment *>)),
+ this, SLOT(slotEditSegmentsMatrix(std::vector<Segment *>)));
+ connect(pitchTrackerView, SIGNAL(openInPercussionMatrix(std::vector<Segment *>)),
+ this, SLOT(slotEditSegmentsPercussionMatrix(std::vector<Segment *>)));
+ connect(pitchTrackerView, SIGNAL(openInEventList(std::vector<Segment *>)),
+ this, SLOT(slotEditSegmentsEventList(std::vector<Segment *>)));
+/* hjj: WHAT DO DO WITH THIS ?
+ connect(pitchTrackerView, SIGNAL(editMetadata(QString)),
+ this, SLOT(slotEditMetadata(QString)));
+*/
+ connect(pitchTrackerView, SIGNAL(editTriggerSegment(int)),
+ this, SLOT(slotEditTriggerSegment(int)));
+ connect(pitchTrackerView, SIGNAL(staffLabelChanged(TrackId, QString)),
+ this, SLOT(slotChangeTrackLabel(TrackId, QString)));
+ connect(pitchTrackerView, SIGNAL(toggleSolo(bool)),
+ RosegardenMainWindow::self(), SLOT(slotToggleSolo(bool)));
+ connect(pitchTrackerView, SIGNAL(editTimeSignature(timeT)),
+ RosegardenMainWindow::self(), SLOT(slotEditTempos(timeT)));
+
+ SequenceManager *sM = getDocument()->getSequenceManager();
+
+ connect(sM, SIGNAL(insertableNoteOnReceived(int, int)),
+ pitchTrackerView, SLOT(slotInsertableNoteOnReceived(int, int)));
+ connect(sM, SIGNAL(insertableNoteOffReceived(int, int)),
+ pitchTrackerView, SLOT(slotInsertableNoteOffReceived(int, int)));
+
+ connect(pitchTrackerView, SIGNAL(stepByStepTargetRequested(QObject *)),
+ this, SIGNAL(stepByStepTargetRequested(QObject *)));
+ connect(this, SIGNAL(stepByStepTargetRequested(QObject *)),
+ pitchTrackerView, SLOT(slotStepByStepTargetRequested(QObject *)));
+ connect(RosegardenMainWindow::self(), SIGNAL(compositionStateUpdate()),
+ pitchTrackerView, SLOT(slotCompositionStateUpdate()));
+ connect(this, SIGNAL(compositionStateUpdate()),
+ pitchTrackerView, SLOT(slotCompositionStateUpdate()));
+
+ // Encourage the notation view window to open to the same
+ // interval as the current segment view
+ if (m_trackEditor->getCompositionView()->horizontalScrollBar()->value() > 1) { // don't scroll unless we need to
+ // first find the time at the center of the visible segment canvas
+ int centerX = (int)(m_trackEditor->getCompositionView()->contentsX() +
+ m_trackEditor->getCompositionView()->visibleWidth() / 2);
+ timeT centerSegmentView = m_trackEditor->getRulerScale()->getTimeForX(centerX);
+ // then scroll the notation view to that time, "localized" for the current segment
+//!!! pitchTrackerView->scrollToTime(centerSegmentView);
+//!!! pitchTrackerView->updateView();
+ }
+
+ return pitchTrackerView;
+}
+
void RosegardenMainViewWidget::slotEditSegmentMatrix(Segment* p)
{
SetWaitCursor waitCursor;
Index: src/gui/general/EditViewBase.cpp
===================================================================
--- src/gui/general/EditViewBase.cpp (revision 12276)
+++ src/gui/general/EditViewBase.cpp (working copy)
@@ -121,6 +121,7 @@
createAction("open_in_percussion_matrix", SLOT(slotOpenInPercussionMatrix()));
createAction("open_in_notation", SLOT(slotOpenInNotation()));
createAction("open_in_event_list", SLOT(slotOpenInEventList()));
+ createAction("open_in_pitch_tracker", SLOT(slotOpenInPitchTracker()));
createAction("set_segment_start", SLOT(slotSetSegmentStartTime()));
createAction("set_segment_duration", SLOT(slotSetSegmentDuration()));
}
@@ -179,6 +180,12 @@
emit openInEventList(m_segments);
}
+void
+EditViewBase::slotOpenInPitchTracker()
+{
+ emit slotOpenInPitchTracker(m_segments);
+}
+
void EditViewBase::closeEvent(QCloseEvent* e)
{
RG_DEBUG << "EditViewBase::closeEvent()\n";
Index: src/gui/general/EditViewBase.h
===================================================================
--- src/gui/general/EditViewBase.h (revision 12276)
+++ src/gui/general/EditViewBase.h (working copy)
@@ -77,6 +77,7 @@
void openInMatrix(std::vector<Segment *>);
void openInPercussionMatrix(std::vector<Segment *>);
void openInEventList(std::vector<Segment *>);
+ void slotOpenInPitchTracker(std::vector<Segment *>);
/**
* Tell the main view that the track being edited is the
@@ -157,6 +158,7 @@
virtual void slotOpenInPercussionMatrix();
virtual void slotOpenInNotation();
virtual void slotOpenInEventList();
+ virtual void slotOpenInPitchTracker();
virtual void slotSegmentDeleted(Segment *);
Index: data/rc/rosegardenmainwindow.rc
===================================================================
--- data/rc/rosegardenmainwindow.rc (revision 12276)
+++ data/rc/rosegardenmainwindow.rc (working copy)
@@ -170,6 +170,7 @@
<Action name="edit_percussion_matrix" text="Open in &Percussion Matrix Editor" icon="matrix-percussion" shortcut="D" />
<Action name="edit_notation" text="Open in &Notation Editor" icon="notation" shortcut="N" />
<Action name="edit_event_list" text="Open in &Event List Editor" icon="eventlist" shortcut="E" />
+ <Action name="edit_pitch_tracker" text="Open in &Pitch Tracker" icon="pitchtracker" shortcut="I" />
</Menu>
<Separator/>
<Action name="relabel_segment" text="R&elabel..." icon="text" />
@@ -311,6 +312,7 @@
<Action name="edit_percussion_matrix" />
<Action name="edit_notation" />
<Action name="edit_event_list" />
+ <Action name="edit_pitch_tracker" />
<Action name="audio_manager" />
<Separator/>
<Action name="manage_midi_devices" />
@@ -343,6 +345,7 @@
<Action name="edit_percussion_matrix" />
<Action name="edit_notation" />
<Action name="edit_event_list" />
+ <Action name="edit_pitch_tracker" />
<Separator/>
<Action name="edit_undo" />
<Action name="edit_redo" />
@@ -408,6 +411,7 @@
<Action name="edit_percussion_matrix"/>
<Action name="edit_notation"/>
<Action name="edit_event_list"/>
+ <Action name="edit_pitch_tracker"/>
<Action name="quantize_selection"/>
<Action name="repeat_quantize"/>
<!-- <Action name="harmonize_selection"/> -->
@@ -447,6 +451,7 @@
<Action name="edit_matrix"/>
<Action name="edit_percussion_matrix"/>
<Action name="edit_event_list"/>
+ <Action name="edit_pitch_tracker"/>
<Action name="quantize_selection"/>
<Action name="repeat_quantize"/>
<Action name="switch_preset"/>
Index: data/rc/notation.rc
===================================================================
--- data/rc/notation.rc (revision 12276)
+++ data/rc/notation.rc (working copy)
@@ -126,6 +126,7 @@
<Action name="open_in_event_list" text="Open in &Event List Editor" icon="eventlist" />
<Action name="open_in_matrix" text="Open in Matri&x Editor" icon="matrix" />
<Action name="open_in_percussion_matrix" text="Open in &Percussion Matrix Editor" icon="matrix-percussion" />
+ <Action name="open_in_pitch_tracker" text="Open in &Pitch Tracker" icon="pitchtracker" />
</Menu>
<Separator/>
<Action name="add_clef" text="Add Cle&f Change..." />
------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
Rosegarden-devel mailing list
Rosegarden-devel@lists.sourceforge.net - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel