comparison framework/MainWindowBase.h @ 515:51befd6165a3 alignment-simple

Merge in from SV 3.0-integration branches
author Chris Cannam
date Wed, 02 Mar 2016 17:25:27 +0000
parents 74d575708e06 21d3cf5c8f21
children dd195633fc9f
comparison
equal deleted inserted replaced
459:74d575708e06 515:51befd6165a3
44 class Overview; 44 class Overview;
45 class Layer; 45 class Layer;
46 class WaveformLayer; 46 class WaveformLayer;
47 class WaveFileModel; 47 class WaveFileModel;
48 class AudioCallbackPlaySource; 48 class AudioCallbackPlaySource;
49 class AudioCallbackPlayTarget; 49 class AudioRecordTarget;
50 class CommandHistory; 50 class CommandHistory;
51 class QMenu; 51 class QMenu;
52 class AudioDial; 52 class AudioDial;
53 class QLabel; 53 class QLabel;
54 class QCheckBox; 54 class QCheckBox;
62 class ModelDataTableDialog; 62 class ModelDataTableDialog;
63 class QSignalMapper; 63 class QSignalMapper;
64 class QShortcut; 64 class QShortcut;
65 class AlignmentModel; 65 class AlignmentModel;
66 66
67 namespace breakfastquay {
68 class SystemPlaybackTarget;
69 class SystemAudioIO;
70 }
71
67 /** 72 /**
68 * The base class for the SV main window. This includes everything to 73 * The base class for the SV main window. This includes everything to
69 * do with general document and pane stack management, but nothing 74 * do with general document and pane stack management, but nothing
70 * that involves user interaction -- this doesn't create the widget or 75 * that involves user interaction -- this doesn't create the widget or
71 * menu structures or editing tools, and if a function needs to open a 76 * menu structures or editing tools, and if a function needs to open a
76 class MainWindowBase : public QMainWindow, public FrameTimer 81 class MainWindowBase : public QMainWindow, public FrameTimer
77 { 82 {
78 Q_OBJECT 83 Q_OBJECT
79 84
80 public: 85 public:
81 MainWindowBase(bool withAudioOutput, bool withMIDIInput); 86 enum SoundOption {
87 WithAudioOutput = 0x01,
88 WithAudioInput = 0x02,
89 WithMIDIInput = 0x04,
90 WithEverything = 0xff,
91 WithNothing = 0x00
92 };
93 typedef int SoundOptions;
94
95 MainWindowBase(SoundOptions options = WithEverything);
82 virtual ~MainWindowBase(); 96 virtual ~MainWindowBase();
83 97
84 enum AudioFileOpenMode { 98 enum AudioFileOpenMode {
85 ReplaceSession, 99 ReplaceSession,
86 ReplaceMainModel, 100 ReplaceMainModel,
94 FileOpenFailed, 108 FileOpenFailed,
95 FileOpenCancelled, 109 FileOpenCancelled,
96 FileOpenWrongMode // attempted to open layer when no main model present 110 FileOpenWrongMode // attempted to open layer when no main model present
97 }; 111 };
98 112
113 enum AudioRecordMode {
114 RecordReplaceSession,
115 RecordCreateAdditionalModel
116 };
117
99 virtual FileOpenStatus open(FileSource source, AudioFileOpenMode = AskUser); 118 virtual FileOpenStatus open(FileSource source, AudioFileOpenMode = AskUser);
100 virtual FileOpenStatus openPath(QString fileOrUrl, AudioFileOpenMode = AskUser); 119 virtual FileOpenStatus openPath(QString fileOrUrl, AudioFileOpenMode = AskUser);
101 virtual FileOpenStatus openAudio(FileSource source, AudioFileOpenMode = AskUser, QString templateName = ""); 120 virtual FileOpenStatus openAudio(FileSource source, AudioFileOpenMode = AskUser, QString templateName = "");
102 virtual FileOpenStatus openPlaylist(FileSource source, AudioFileOpenMode = AskUser); 121 virtual FileOpenStatus openPlaylist(FileSource source, AudioFileOpenMode = AskUser);
103 virtual FileOpenStatus openLayer(FileSource source); 122 virtual FileOpenStatus openLayer(FileSource source);
118 137
119 void setDefaultFfwdRwdStep(RealTime step) { 138 void setDefaultFfwdRwdStep(RealTime step) {
120 m_defaultFfwdRwdStep = step; 139 m_defaultFfwdRwdStep = step;
121 } 140 }
122 141
142 void setAudioRecordMode(AudioRecordMode mode) {
143 m_audioRecordMode = mode;
144 }
145
123 signals: 146 signals:
124 // Used to toggle the availability of menu actions 147 // Used to toggle the availability of menu actions
125 void canAddPane(bool); 148 void canAddPane(bool);
126 void canDeleteCurrentPane(bool); 149 void canDeleteCurrentPane(bool);
127 void canAddLayer(bool); 150 void canAddLayer(bool);
147 void canRenumberInstants(bool); 170 void canRenumberInstants(bool);
148 void canDeleteCurrentLayer(bool); 171 void canDeleteCurrentLayer(bool);
149 void canZoom(bool); 172 void canZoom(bool);
150 void canScroll(bool); 173 void canScroll(bool);
151 void canPlay(bool); 174 void canPlay(bool);
175 void canRecord(bool);
152 void canFfwd(bool); 176 void canFfwd(bool);
153 void canRewind(bool); 177 void canRewind(bool);
154 void canPlaySelection(bool); 178 void canPlaySelection(bool);
155 void canSpeedUpPlayback(bool); 179 void canSpeedUpPlayback(bool);
156 void canSlowDownPlayback(bool); 180 void canSlowDownPlayback(bool);
197 virtual void play(); 221 virtual void play();
198 virtual void ffwd(); 222 virtual void ffwd();
199 virtual void ffwdEnd(); 223 virtual void ffwdEnd();
200 virtual void rewind(); 224 virtual void rewind();
201 virtual void rewindStart(); 225 virtual void rewindStart();
226 virtual void record();
202 virtual void stop(); 227 virtual void stop();
203 228
204 virtual void ffwdSimilar(); 229 virtual void ffwdSimilar();
205 virtual void rewindSimilar(); 230 virtual void rewindSimilar();
206 231
224 virtual void playbackFrameChanged(sv_frame_t); 249 virtual void playbackFrameChanged(sv_frame_t);
225 virtual void globalCentreFrameChanged(sv_frame_t); 250 virtual void globalCentreFrameChanged(sv_frame_t);
226 virtual void viewCentreFrameChanged(View *, sv_frame_t); 251 virtual void viewCentreFrameChanged(View *, sv_frame_t);
227 virtual void viewZoomLevelChanged(View *, int, bool); 252 virtual void viewZoomLevelChanged(View *, int, bool);
228 virtual void outputLevelsChanged(float, float) = 0; 253 virtual void outputLevelsChanged(float, float) = 0;
254 virtual void recordDurationChanged(sv_frame_t, sv_samplerate_t);
229 255
230 virtual void currentPaneChanged(Pane *); 256 virtual void currentPaneChanged(Pane *);
231 virtual void currentLayerChanged(Pane *, Layer *); 257 virtual void currentLayerChanged(Pane *, Layer *);
232 258
233 virtual void selectAll(); 259 virtual void selectAll();
307 333
308 PaneStack *m_paneStack; 334 PaneStack *m_paneStack;
309 ViewManager *m_viewManager; 335 ViewManager *m_viewManager;
310 Layer *m_timeRulerLayer; 336 Layer *m_timeRulerLayer;
311 337
312 bool m_audioOutput; 338 SoundOptions m_soundOptions;
339
313 AudioCallbackPlaySource *m_playSource; 340 AudioCallbackPlaySource *m_playSource;
314 AudioCallbackPlayTarget *m_playTarget; 341 AudioRecordTarget *m_recordTarget;
342 breakfastquay::SystemPlaybackTarget *m_playTarget; // only one of this...
343 breakfastquay::SystemAudioIO *m_audioIO; // ... and this exists
315 344
316 class OSCQueueStarter : public QThread 345 class OSCQueueStarter : public QThread
317 { 346 {
318 public: 347 public:
319 OSCQueueStarter(MainWindowBase *mwb) : QThread(mwb), m_mwb(mwb) { } 348 OSCQueueStarter(MainWindowBase *mwb) : QThread(mwb), m_mwb(mwb) { }
344 mutable QString m_myStatusMessage; 373 mutable QString m_myStatusMessage;
345 374
346 bool m_initialDarkBackground; 375 bool m_initialDarkBackground;
347 376
348 RealTime m_defaultFfwdRwdStep; 377 RealTime m_defaultFfwdRwdStep;
378
379 AudioRecordMode m_audioRecordMode;
349 380
350 mutable QLabel *m_statusLabel; 381 mutable QLabel *m_statusLabel;
351 QLabel *getStatusLabel() const; 382 QLabel *getStatusLabel() const;
352 383
353 WaveFileModel *getMainModel(); 384 WaveFileModel *getMainModel();
424 virtual void registerLastOpenedFilePath(FileFinder::FileType type, QString path); 455 virtual void registerLastOpenedFilePath(FileFinder::FileType type, QString path);
425 456
426 virtual QString getDefaultSessionTemplate() const; 457 virtual QString getDefaultSessionTemplate() const;
427 virtual void setDefaultSessionTemplate(QString); 458 virtual void setDefaultSessionTemplate(QString);
428 459
429 virtual void createPlayTarget(); 460 virtual void createAudioIO();
430 virtual void openHelpUrl(QString url); 461 virtual void openHelpUrl(QString url);
462 virtual void openLocalFolder(QString path);
431 463
432 virtual void setupMenus() = 0; 464 virtual void setupMenus() = 0;
433 virtual void updateVisibleRangeDisplay(Pane *p) const = 0; 465 virtual void updateVisibleRangeDisplay(Pane *p) const = 0;
434 virtual void updatePositionStatusDisplays() const = 0; 466 virtual void updatePositionStatusDisplays() const = 0;
435 467