1 /*
2 * Hydrogen
3 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
4 *
5 * http://www.hydrogen-music.org
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY, without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 *
21 */
22
23 #ifndef PREFERENCES_H
24 #define PREFERENCES_H
25
26 #include <list>
27 #include <vector>
28 #include <cassert>
29
30 #include <hydrogen/midi_action.h>
31 #include <hydrogen/globals.h>
32 #include <hydrogen/object.h>
33
34 #include <QStringList>
35 #include <QDomDocument>
36
37 namespace H2Core
38 {
39
40 const float FALLOFF_SLOW = 1.08f;
41 const float FALLOFF_NORMAL= 1.1f;
42 const float FALLOFF_FAST = 1.5f;
43
44
45 /**
46 \ingroup H2CORE
47 */
48 class WindowProperties : public H2Core::Object
49 {
50 H2_OBJECT
51 public:
52 int x;
53 int y;
54 int width;
55 int height;
56 bool visible;
57
58 WindowProperties();
59 ~WindowProperties();
60
set(int _x,int _y,int _width,int _height,bool _visible)61 void set(int _x, int _y, int _width, int _height, bool _visible) {
62 x = _x; y = _y;
63 width = _width; height = _height;
64 visible = _visible;
65 }
66
67 };
68
69
70 /**
71 \ingroup H2CORE
72 */
73 class H2RGBColor : public H2Core::Object
74 {
75 H2_OBJECT
76 public:
77 H2RGBColor( int r = -1, int g = -1, int b = -1 );
78 H2RGBColor( const QString& sColor );
79 ~H2RGBColor();
80
81 QString toStringFmt();
82
getRed()83 int getRed() const {
84 return m_red;
85 }
getGreen()86 int getGreen() const {
87 return m_green;
88 }
getBlue()89 int getBlue() const {
90 return m_blue;
91 }
92
93 private:
94 int m_red;
95 int m_green;
96 int m_blue;
97
98 };
99
100
101 /**
102 \ingroup H2CORE
103 \brief Colors for hydrogen
104 */
105 class UIStyle : public H2Core::Object
106 {
107 H2_OBJECT
108 public:
109 UIStyle();
110 H2RGBColor m_songEditor_backgroundColor;
111 H2RGBColor m_songEditor_alternateRowColor;
112 H2RGBColor m_songEditor_selectedRowColor;
113 H2RGBColor m_songEditor_lineColor;
114 H2RGBColor m_songEditor_textColor;
115 H2RGBColor m_songEditor_pattern1Color;
116
117 H2RGBColor m_patternEditor_backgroundColor;
118 H2RGBColor m_patternEditor_alternateRowColor;
119 H2RGBColor m_patternEditor_selectedRowColor;
120 H2RGBColor m_patternEditor_textColor;
121 H2RGBColor m_patternEditor_noteColor;
122 H2RGBColor m_patternEditor_noteoffColor;
123 H2RGBColor m_patternEditor_lineColor;
124 H2RGBColor m_patternEditor_line1Color;
125 H2RGBColor m_patternEditor_line2Color;
126 H2RGBColor m_patternEditor_line3Color;
127 H2RGBColor m_patternEditor_line4Color;
128 H2RGBColor m_patternEditor_line5Color;
129 };
130
131
132
133 /**
134 \ingroup H2CORE
135 \brief Manager for User Preferences File (singleton)
136 */
137 class Preferences : public H2Core::Object
138 {
139 H2_OBJECT
140 public:
141 enum {
142 /**
143 * Specifies whether or not to use JACK transport
144 * capabilities. If set, Hydrogen will start playing as
145 * soon as any over JACK client using its transport
146 * system is starting to play. Its counterpart is
147 * #NO_JACK_TRANSPORT.
148 */
149 USE_JACK_TRANSPORT = 0,
150 /**
151 * Specifies that Hydrogen is using in the time master
152 * mode and will thus control specific aspects of the
153 * transport like the overall tempo. Its counterpart is
154 * #NO_JACK_TIME_MASTER.
155 */
156 USE_JACK_TIME_MASTER = 0,
157 POST_FADER = 0,
158 SET_PLAY_ON = 0,
159 BC_ON = 0,/**
160 * Specifies whether or not to use JACK transport
161 * capabilities. If set, Hydrogen can be used
162 * independent of the JACK system while still using the
163 * JackAudioDriver. Its counterpart is
164 * #USE_JACK_TRANSPORT.
165 */
166 NO_JACK_TRANSPORT = 1,
167 /**
168 * Specifies that Hydrogen is note using in the time
169 * master mode. Its counterpart is
170 * #USE_JACK_TIME_MASTER.
171 */
172 NO_JACK_TIME_MASTER = 1,
173 PRE_FADER = 1,
174 SET_PLAY_OFF = 1,
175 BC_OFF = 1
176 };
177
178
179 enum UI_LAYOUT_TYPES {
180 UI_LAYOUT_SINGLE_PANE,
181 UI_LAYOUT_TABBED
182 };
183
184 QString __lastspatternDirectory;
185 QString __lastsampleDirectory; // audio file browser
186 bool __playsamplesonclicking; // audio file browser
187
188 bool __playselectedinstrument; // midi keys and keys play instrument or drumset
189
190 int m_nRecPreDelete; //index of record note pre delete function 0 = off
191 int m_nRecPostDelete;
192
193 bool m_bFollowPlayhead;
194
195 // switch to enable / disable lash, only on h2 startup
196 bool m_brestartLash;
197 bool m_bsetLash;
198
199 //soundlibrarypanel expand song and pattern item
200 bool __expandSongItem;
201 bool __expandPatternItem;
202
203 //beatcounter
204 bool m_bbc;
205 bool m_mmcsetplay;
206
207 int m_countOffset;
208 int m_startOffset;
209 //~ beatcounter
210
211 std::list<QString> sServerList;
212 std::list<QString> m_patternCategories;
213
214 // audio engine properties ___
215 /**
216 * Audio driver
217 *
218 * Used in the audioEngine_startAudioDrivers() to create an
219 * audio driver using createDriver().
220 *
221 * These choices are support:
222 * - "Auto" : audioEngine_startAudioDrivers() will try
223 * different drivers itself.
224 * - "Jack" : createDriver() will create a JackAudioDriver.
225 * - "Alsa" : createDriver() will create a AlsaAudioDriver.
226 * - "CoreAudio" : createDriver() will create a CoreAudioDriver.
227 * - "PortAudio" : createDriver() will create a PortAudioDriver.
228 * - "Oss" : createDriver() will create a OssDriver.
229 * - "PulseAudio" : createDriver() will create a PulseAudioDriver.
230 * - "Fake" : createDriver() will create a FakeDriver.
231 */
232 QString m_sAudioDriver;
233 /** If set to true, samples of the metronome will be added to
234 * #m_songNoteQueue in audioEngine_updateNoteQueue() and thus
235 * played back on a regular basis.*/
236 bool m_bUseMetronome;
237 /// Metronome volume FIXME: remove this volume!!
238 float m_fMetronomeVolume;
239 /// max notes
240 unsigned m_nMaxNotes;
241 /**
242 * Buffer size of the audio.
243 *
244 * It is set e.g. by JackAudioDriver::init() to the buffer
245 * size of the freshly opened JACK client.
246 */
247 unsigned m_nBufferSize;
248 /**
249 * Sample rate of the audio.
250 *
251 * It is set e.g. by JackAudioDriver::init() to the sample
252 * rate of the freshly opened JACK client.
253 */
254 unsigned m_nSampleRate;
255
256 // OSS driver properties ___
257 QString m_sOSSDevice; ///< Device used for output
258
259 // MIDI Driver properties
260 /**
261 * MIDI driver
262 *
263 * Used in the audioEngine_startAudioDrivers() to create an
264 * MIDI driver.
265 *
266 * These choices are support:
267 * - "JackMidi" : A JackMidiDriver will be called.
268 * - "ALSA" : An AlsaMidiDriver will be called.
269 * - "CoreMidi" : A CoreMidiDriver will be called.
270 * - "PortMidi" : A PortMidiDriver will be called.
271 */
272 QString m_sMidiDriver;
273 QString m_sMidiPortName;
274 QString m_sMidiOutputPortName;
275 int m_nMidiChannelFilter;
276 bool m_bMidiNoteOffIgnore;
277 bool m_bMidiFixedMapping;
278 bool m_bMidiDiscardNoteAfterAction;
279 bool m_bEnableMidiFeedback;
280
281 // OSC Server properties
282 /**
283 * Whether to start the OscServer thread.
284 *
285 * If set to true, the OscServer::start() function of the
286 * OscServer singleton will be called in
287 * Hydrogen::Hydrogen(). This will register all OSC message
288 * handlers and makes the server listen to port
289 * #m_nOscServerPort.
290 *
291 * Set by setOscServerEnabled() and queried by
292 * getOscServerEnabled().
293 */
294 bool m_bOscServerEnabled;
295 /**
296 * Whether to send the current state of Hydrogen to the OSC
297 * clients.
298 *
299 * If set to true, the current state of Hydrogen will be sent to
300 * \e all known OSC clients using
301 * CoreActionController::initExternalControlInterfaces() and
302 * OscServer::handleAction() via OSC messages each time it gets
303 * updated..
304
305 * Set by setOscFeedbackEnabled() and queried by
306 * getOscFeedbackEnabled().
307 */
308 bool m_bOscFeedbackEnabled;
309 /**
310 * Port number the OscServer will be started at.
311
312 * Set by setOscServerPort() and queried by
313 * getOscServerPort().
314 */
315 int m_nOscServerPort;
316
317 // alsa audio driver properties ___
318 QString m_sAlsaAudioDevice;
319
320 // jack driver properties ___
321 QString m_sJackPortName1;
322 QString m_sJackPortName2;
323 /**
324 * Specifies whether or not Hydrogen will use the JACK
325 * transport system. It has two different states:
326 * #USE_JACK_TRANSPORT and #NO_JACK_TRANSPORT.
327 */
328 int m_bJackTransportMode;
329 bool m_bJackConnectDefaults;
330 /**
331 * If set to _true_, JackAudioDriver::makeTrackOutputs() will
332 * create two individual left and right output ports for every
333 * component of each instrument. If _false_, one usual stereo
334 * output will be created.
335 */
336 bool m_bJackTrackOuts;
337 int m_nJackTrackOutputMode;
338 //jack time master
339 /**
340 * Specifies if Hydrogen should run as JACK time master. It
341 * has two states: Preferences::USE_JACK_TIME_MASTER and
342 * Preferences::NO_JACK_TIME_MASTER. It is set to
343 * Preferences::NO_JACK_TIME_MASTER by the
344 * JackAudioDriver::initTimebaseMaster() if Hydrogen couldn't be
345 * registered as time master.
346 */
347 int m_bJackMasterMode;
348 //~ jack driver properties
349
350 ///Default text editor (used by Playlisteditor)
351 QString m_sDefaultEditor;
352
353 ///Rubberband CLI
354 QString m_rubberBandCLIexecutable;
355
356 /**
357 * If #__instance equals 0, a new Preferences singleton will
358 * be created and stored in it.
359 *
360 * It is called in Hydrogen::create_instance().
361 */
362 static void create_instance();
363 /**
364 * Returns a pointer to the current Preferences singleton
365 * stored in #__instance.
366 */
get_instance()367 static Preferences* get_instance(){ assert(__instance); return __instance; }
368
369 ~Preferences();
370
371 /// Load the preferences file
372 void loadPreferences( bool bGlobal );
373
374 /// Save the preferences file
375 void savePreferences();
376
377 const QString& getDataDirectory();
378
379 const QString& getDefaultEditor();
380 void setDefaultEditor( QString editor);
381
382 int getDefaultUILayout();
383 void setDefaultUILayout( int layout);
384
385 // General
386 void setRestoreLastSongEnabled( bool restore );
387 void setRestoreLastPlaylistEnabled( bool restore );
388 void setUseRelativeFilenamesForPlaylists( bool value );
389
390 void setShowDevelWarning( bool value );
391 bool getShowDevelWarning();
392
393 bool isRestoreLastSongEnabled();
394 bool isRestoreLastPlaylistEnabled();
395 bool isPlaylistUsingRelativeFilenames();
396
397 void setLastSongFilename( const QString& filename );
398 const QString& getLastSongFilename();
399
400 void setLastPlaylistFilename( const QString& filename );
401 const QString& getLastPlaylistFilename();
402
403 void setHearNewNotes( bool value );
404 bool getHearNewNotes();
405
406 void setRecordEvents( bool value );
407 bool getRecordEvents();
408
409 void setDestructiveRecord ( bool value );
410 bool getDestructiveRecord();
411
412 void setPunchInPos ( unsigned pos );
413 int getPunchInPos();
414
415 void setPunchOutPos ( unsigned pos );
416 int getPunchOutPos();
417
418 bool inPunchArea (int pos);
419 void unsetPunchArea ();
420
421 void setQuantizeEvents( bool value );
422 bool getQuantizeEvents();
423
424 std::vector<QString> getRecentFiles();
425 void setRecentFiles( std::vector<QString> recentFiles );
426
427 QStringList getRecentFX();
428 void setMostRecentFX( QString );
429
430
431 // GUI Properties
432 const QString& getQTStyle();
433 void setQTStyle( const QString& sStyle );
434
435
436 const QString& getApplicationFontFamily();
437 void setApplicationFontFamily( const QString& family );
438
439 int getApplicationFontPointSize();
440 void setApplicationFontPointSize( int size );
441
442 QString getMixerFontFamily();
443 void setMixerFontFamily( const QString& family );
444 int getMixerFontPointSize();
445 void setMixerFontPointSize( int size );
446 float getMixerFalloffSpeed();
447 void setMixerFalloffSpeed( float value );
448 bool showInstrumentPeaks();
449 void setInstrumentPeaks( bool value );
450
451 int getPatternEditorGridResolution();
452 void setPatternEditorGridResolution( int value );
453
454 bool isPatternEditorUsingTriplets();
455 void setPatternEditorUsingTriplets( bool value );
456
457 bool isFXTabVisible();
458 void setFXTabVisible( bool value );
459
460 bool getShowAutomationArea();
461 void setShowAutomationArea( bool value );
462
463 unsigned getPatternEditorGridHeight();
464 void setPatternEditorGridHeight( unsigned value );
465
466 unsigned getPatternEditorGridWidth();
467 void setPatternEditorGridWidth( unsigned value );
468
469 void setColoringMethodAuxValue( int value );
470 int getColoringMethodAuxValue() const;
471
472 void setColoringMethod( int value );
473 int getColoringMethod() const;
474
475 WindowProperties getMainFormProperties();
476 void setMainFormProperties( const WindowProperties& prop );
477
478 WindowProperties getMixerProperties();
479 void setMixerProperties( const WindowProperties& prop );
480
481 WindowProperties getPatternEditorProperties();
482 void setPatternEditorProperties( const WindowProperties& prop );
483
484 WindowProperties getSongEditorProperties();
485 void setSongEditorProperties( const WindowProperties& prop );
486
487 WindowProperties getAudioEngineInfoProperties();
488 void setAudioEngineInfoProperties( const WindowProperties& prop );
489
490 WindowProperties getLadspaProperties( unsigned nFX );
491 void setLadspaProperties( unsigned nFX, const WindowProperties& prop );
492
493 UIStyle* getDefaultUIStyle();
494
495 /** \return #m_bPatternModePlaysSelected*/
496 bool patternModePlaysSelected();
497 /** \param b Sets #m_bPatternModePlaysSelected*/
498 void setPatternModePlaysSelected( bool b );
499 bool useLash();
500 void setUseLash( bool b );
501
502 /** @param bars Sets #m_nMaxBars.*/
503 void setMaxBars( const int bars );
504 /** @return #m_nMaxBars.*/
505 int getMaxBars() const;
506
507 /** @param layers Sets #m_nMaxLayers.*/
508 void setMaxLayers( const int layers );
509 /** @return #m_nMaxLayers.*/
510 int getMaxLayers() const;
511
512 void setWaitForSessionHandler(bool value);
513 bool getWaitForSessionHandler();
514
515 #if defined(H2CORE_HAVE_JACKSESSION) || _DOXYGEN_
516 QString getJackSessionUUID();
517 void setJackSessionUUID( QString uuid );
518
519 QString getJackSessionApplicationPath();
520 void setJackSessionApplicationPath( QString path );
521 #endif
522
523
524 #if defined(H2CORE_HAVE_OSC) || _DOXYGEN_
525 void setNsmClientId(const QString& nsmClientId);
526 QString getNsmClientId(void);
527
528 void setNsmSongName(const QString& nsmSongName);
529 QString getNsmSongName(void);
530 #endif
531
532 /** \return #m_bOscServerEnabled*/
533 bool getOscServerEnabled();
534 /** \param val Sets #m_bOscServerEnabled*/
535 void setOscServerEnabled( bool val );
536 /** \return #m_bOscFeedbackEnabled*/
537 bool getOscFeedbackEnabled();
538 /** \param val Sets #m_bOscFeedbackEnabled*/
539 void setOscFeedbackEnabled( bool val );
540 /** \return #m_nOscServerPort*/
541 int getOscServerPort();
542 /** \param oscPort Sets #m_nOscServerPort*/
543 void setOscServerPort( int oscPort );
544
545 /** Whether to use the bpm of the timeline.
546 * \return #__useTimelineBpm */
547 bool getUseTimelineBpm();
548 /** Setting #__useTimelineBpm.
549 * \param val New choice. */
550 void setUseTimelineBpm( bool val );
551
552 void setShowPlaybackTrack( bool val);
553 bool getShowPlaybackTrack() const;
554
555 int getRubberBandCalcTime();
556 void setRubberBandCalcTime( int val );
557
558 int getRubberBandBatchMode();
559 void setRubberBandBatchMode( int val );
560
561 int getLastOpenTab();
562 void setLastOpenTab(int n);
563
564 void setH2ProcessName(const QString& processName);
565
566 QString getH2ProcessName();
567
568 int getExportSampleDepthIdx() const;
569 void setExportSampleDepthIdx( int nExportSampleDepthIdx );
570
571 int getExportSampleRateIdx() const;
572 void setExportSampleRateIdx( int nExportSampleRateIdx );
573
574 int getExportModeIdx() const;
575 void setExportModeIdx(int nExportMode);
576
577 QString getExportDirectory() const;
578 void setExportDirectory( const QString &sExportDirectory );
579
580 int getExportTemplateIdx() const;
581 void setExportTemplateIdx( int nExportTemplateIdx );
582
583 int getMidiExportMode() const;
584 void setMidiExportMode(int nExportMode);
585
586 QString getMidiExportDirectory() const;
587 void setMidiExportDirectory( const QString &sExportDirectory );
588
589 private:
590 /**
591 * Object holding the current Preferences singleton. It is
592 * initialized with NULL, set with create_instance(), and
593 * accessed with get_instance().
594 */
595 static Preferences * __instance;
596
597 //___ General properties ___
598 QString m_sH2ProcessName; //Name of hydrogen's main process
599 int __rubberBandCalcTime;
600 ///rubberband bpm change queue
601 bool m_useTheRubberbandBpmChangeEvent;
602 /**
603 * When transport is in Song::PATTERN_MODE and this variable is
604 * set to true, the currently focused Pattern will be used for
605 * playback.
606 *
607 * It is set by setPatternModePlaysSelected() and queried by
608 * patternModePlaysSelected().
609 */
610 bool m_bPatternModePlaysSelected;
611 ///< Restore last song?
612 bool m_brestoreLastSong;
613 bool m_brestoreLastPlaylist;
614 bool m_bUseLash;
615 ///< Show development version warning?
616 bool m_bShowDevelWarning;
617 ///< Last song used
618 QString m_lastSongFilename;
619 QString m_lastPlaylistFilename;
620
621 bool quantizeEvents;
622 bool recordEvents;
623 bool destructiveRecord;
624 bool readPrefFileforotherplaces;
625 int punchInPos;
626 int punchOutPos;
627 /** Maximum number of bars shown in the Song Editor at
628 * once.
629 *
630 * It is set by setMaxBars() and queried by
631 * getMaxBars(). In order to change this value, you have to
632 * manually edit the \<maxBars\> tag in the configuration file
633 * of Hydrogen in your home folder. Default value assigned in
634 * constructor: 400.*/
635 int m_nMaxBars;
636 /** Maximum number of layers to be used in the Instrument
637 * editor.
638 *
639 * It is set by setMaxLayers() and queried by
640 * getMaxLayers(). It is setIn order to change this value, you
641 * have to manually edit the \<maxLayers\> tag in the
642 * configuration file of Hydrogen in your home folder. Default
643 * value assigned in constructor: 16. */
644 int m_nMaxLayers;
645 bool hearNewNotes;
646
647 QStringList m_recentFX;
648 std::vector<QString> m_recentFiles;
649
650 #if defined(H2CORE_HAVE_JACKSESSION) || _DOXYGEN_
651 QString jackSessionUUID;
652 QString jackSessionApplicationPath;
653 #endif
654
655 #if defined(H2CORE_HAVE_OSC) || _DOXYGEN_
656 QString m_sNsmClientId;
657 QString m_sNsmSongName;
658 #endif
659
660 bool waitingForSessionHandler;
661 /**
662 * Whether to use local speeds specified along the Timeline or
663 * a constant tempo for the whole Song in
664 * Hydrogen::getTimelineBpm() and Hydrogen::getTimelineBpm().
665 *
666 * It is set using setUseTimelineBpm() and accessed via
667 * getUseTimelineBpm().
668 */
669 bool __useTimelineBpm;
670
671 //___ GUI properties ___
672 QString m_sQTStyle;
673 int m_nLastOpenTab;
674 int m_nDefaultUILayout;
675 bool m_bShowPlaybackTrack;
676
677 QString applicationFontFamily;
678 int applicationFontPointSize;
679 QString mixerFontFamily;
680 int mixerFontPointSize;
681 float mixerFalloffSpeed;
682 int m_nPatternEditorGridResolution;
683 bool m_bPatternEditorUsingTriplets;
684 bool m_bShowInstrumentPeaks;
685 bool m_bIsFXTabVisible;
686 bool m_bShowAutomationArea;
687 bool m_bUseRelativeFilenamesForPlaylists;
688 unsigned m_nPatternEditorGridHeight;
689 unsigned m_nPatternEditorGridWidth;
690 WindowProperties mainFormProperties;
691 WindowProperties mixerProperties;
692 WindowProperties patternEditorProperties;
693 WindowProperties songEditorProperties;
694 WindowProperties drumkitManagerProperties;
695 WindowProperties audioEngineInfoProperties;
696 WindowProperties m_ladspaProperties[MAX_FX];
697
698 UIStyle* m_pDefaultUIStyle;
699
700 //Appearance: SongEditor coloring
701 int m_nColoringMethod;
702 int m_nColoringMethodAuxValue;
703
704 //Export dialog
705 QString m_sExportDirectory;
706 int m_nExportModeIdx;
707 int m_nExportSampleRateIdx;
708 int m_nExportSampleDepthIdx;
709 int m_nExportTemplateIdx;
710 //~ Export dialog
711
712 // Export midi dialog
713 QString m_sMidiExportDirectory;
714 int m_nMidiExportMode;
715 //~ Export midi dialog
716
717 Preferences();
718
719 WindowProperties readWindowProperties( QDomNode parent, const QString& windowName, WindowProperties defaultProp );
720 void writeWindowProperties( QDomNode parent, const QString& windowName, const WindowProperties& prop );
721
722 void writeUIStyle( QDomNode parent );
723 void readUIStyle( QDomNode parent );
724 };
725
getMidiExportDirectory()726 inline QString Preferences::getMidiExportDirectory() const
727 {
728 return m_sMidiExportDirectory;
729 }
730
setMidiExportDirectory(const QString & ExportDirectory)731 inline void Preferences::setMidiExportDirectory(const QString &ExportDirectory)
732 {
733 m_sMidiExportDirectory = ExportDirectory;
734 }
735
getMidiExportMode()736 inline int Preferences::getMidiExportMode() const
737 {
738 return m_nMidiExportMode;
739 }
740
setMidiExportMode(int ExportMode)741 inline void Preferences::setMidiExportMode(int ExportMode)
742 {
743 m_nMidiExportMode = ExportMode;
744 }
745
getExportSampleDepthIdx()746 inline int Preferences::getExportSampleDepthIdx() const
747 {
748 return m_nExportSampleDepthIdx;
749 }
750
setExportSampleDepthIdx(int ExportSampleDepth)751 inline void Preferences::setExportSampleDepthIdx(int ExportSampleDepth)
752 {
753 m_nExportSampleDepthIdx = ExportSampleDepth;
754 }
755
getExportSampleRateIdx()756 inline int Preferences::getExportSampleRateIdx() const
757 {
758 return m_nExportSampleRateIdx;
759 }
760
getExportModeIdx()761 inline int Preferences::getExportModeIdx() const
762 {
763 return m_nExportModeIdx;
764 }
765
setExportModeIdx(int ExportModeIdx)766 inline void Preferences::setExportModeIdx(int ExportModeIdx)
767 {
768 m_nExportModeIdx = ExportModeIdx;
769 }
770
getExportDirectory()771 inline QString Preferences::getExportDirectory() const
772 {
773 return m_sExportDirectory;
774 }
775
setExportDirectory(const QString & ExportDirectory)776 inline void Preferences::setExportDirectory(const QString &ExportDirectory)
777 {
778 m_sExportDirectory = ExportDirectory;
779 }
780
setExportSampleRateIdx(int ExportSampleRate)781 inline void Preferences::setExportSampleRateIdx(int ExportSampleRate)
782 {
783 m_nExportSampleRateIdx = ExportSampleRate;
784 }
785
getExportTemplateIdx()786 inline int Preferences::getExportTemplateIdx() const
787 {
788 return m_nExportTemplateIdx;
789 }
790
setExportTemplateIdx(int ExportTemplateIdx)791 inline void Preferences::setExportTemplateIdx(int ExportTemplateIdx)
792 {
793 m_nExportTemplateIdx = ExportTemplateIdx;
794 }
795
getDefaultEditor()796 inline const QString& Preferences::getDefaultEditor() {
797 return m_sDefaultEditor;
798 }
799
setDefaultEditor(QString editor)800 inline void Preferences::setDefaultEditor( QString editor){
801 m_sDefaultEditor = editor;
802 }
803
getDefaultUILayout()804 inline int Preferences::getDefaultUILayout(){
805 return m_nDefaultUILayout;
806 }
807
setDefaultUILayout(int layout)808 inline void Preferences::setDefaultUILayout( int layout){
809 m_nDefaultUILayout = layout;
810 }
811
812
813 // General
setRestoreLastSongEnabled(bool restore)814 inline void Preferences::setRestoreLastSongEnabled( bool restore ) {
815 m_brestoreLastSong = restore;
816 }
817
setRestoreLastPlaylistEnabled(bool restore)818 inline void Preferences::setRestoreLastPlaylistEnabled( bool restore ) {
819 m_brestoreLastPlaylist = restore;
820 }
821
setUseRelativeFilenamesForPlaylists(bool value)822 inline void Preferences::setUseRelativeFilenamesForPlaylists( bool value ) {
823 m_bUseRelativeFilenamesForPlaylists= value;
824 }
825
setShowDevelWarning(bool value)826 inline void Preferences::setShowDevelWarning( bool value ) {
827 m_bShowDevelWarning = value;
828 }
829
getShowDevelWarning()830 inline bool Preferences::getShowDevelWarning() {
831 return m_bShowDevelWarning;
832 }
833
isRestoreLastSongEnabled()834 inline bool Preferences::isRestoreLastSongEnabled() {
835 return m_brestoreLastSong;
836 }
837
isRestoreLastPlaylistEnabled()838 inline bool Preferences::isRestoreLastPlaylistEnabled() {
839 return m_brestoreLastPlaylist;
840 }
841
isPlaylistUsingRelativeFilenames()842 inline bool Preferences::isPlaylistUsingRelativeFilenames() {
843 return m_bUseRelativeFilenamesForPlaylists;
844 }
845
setLastSongFilename(const QString & filename)846 inline void Preferences::setLastSongFilename( const QString& filename ) {
847 m_lastSongFilename = filename;
848 }
getLastSongFilename()849 inline const QString& Preferences::getLastSongFilename() {
850 return m_lastSongFilename;
851 }
852
setLastPlaylistFilename(const QString & filename)853 inline void Preferences::setLastPlaylistFilename( const QString& filename ) {
854 m_lastPlaylistFilename = filename;
855 }
getLastPlaylistFilename()856 inline const QString& Preferences::getLastPlaylistFilename() {
857 return m_lastPlaylistFilename;
858 }
859
setHearNewNotes(bool value)860 inline void Preferences::setHearNewNotes( bool value ) {
861 hearNewNotes = value;
862 }
getHearNewNotes()863 inline bool Preferences::getHearNewNotes() {
864 return hearNewNotes;
865 }
866
setRecordEvents(bool value)867 inline void Preferences::setRecordEvents( bool value ) {
868 recordEvents = value;
869 }
getRecordEvents()870 inline bool Preferences::getRecordEvents() {
871 return recordEvents;
872 }
873
setDestructiveRecord(bool value)874 inline void Preferences::setDestructiveRecord ( bool value ) {
875 destructiveRecord = value;
876 }
getDestructiveRecord()877 inline bool Preferences::getDestructiveRecord() {
878 return destructiveRecord;
879 }
880
setPunchInPos(unsigned pos)881 inline void Preferences::setPunchInPos ( unsigned pos ) {
882 punchInPos = pos;
883 }
getPunchInPos()884 inline int Preferences::getPunchInPos() {
885 return punchInPos;
886 }
887
setPunchOutPos(unsigned pos)888 inline void Preferences::setPunchOutPos ( unsigned pos ) {
889 punchOutPos = pos;
890 }
getPunchOutPos()891 inline int Preferences::getPunchOutPos() {
892 return punchOutPos;
893 }
894
inPunchArea(int pos)895 inline bool Preferences::inPunchArea (int pos) {
896 // Return true if punch area not defined
897 if ( punchInPos <= punchOutPos ) {
898 if ( pos < punchInPos || punchOutPos < pos ) {
899 return false;
900 }
901 }
902 return true;
903 }
904
unsetPunchArea()905 inline void Preferences::unsetPunchArea () {
906 punchInPos = 0;
907 punchOutPos = -1;
908 }
909
setQuantizeEvents(bool value)910 inline void Preferences::setQuantizeEvents( bool value ) {
911 quantizeEvents = value;
912 }
getQuantizeEvents()913 inline bool Preferences::getQuantizeEvents() {
914 return quantizeEvents;
915 }
916
getRecentFiles()917 inline std::vector<QString> Preferences::getRecentFiles() {
918 return m_recentFiles;
919 }
920
getRecentFX()921 inline QStringList Preferences::getRecentFX() {
922 return m_recentFX;
923 }
924
925
926 // GUI Properties
getQTStyle()927 inline const QString& Preferences::getQTStyle() {
928 return m_sQTStyle;
929 }
setQTStyle(const QString & sStyle)930 inline void Preferences::setQTStyle( const QString& sStyle ) {
931 m_sQTStyle = sStyle;
932 }
933
934
getApplicationFontFamily()935 inline const QString& Preferences::getApplicationFontFamily() {
936 return applicationFontFamily;
937 }
setApplicationFontFamily(const QString & family)938 inline void Preferences::setApplicationFontFamily( const QString& family ) {
939 applicationFontFamily = family;
940 }
941
getApplicationFontPointSize()942 inline int Preferences::getApplicationFontPointSize() {
943 return applicationFontPointSize;
944 }
setApplicationFontPointSize(int size)945 inline void Preferences::setApplicationFontPointSize( int size ) {
946 applicationFontPointSize = size;
947 }
948
getMixerFontFamily()949 inline QString Preferences::getMixerFontFamily() {
950 return mixerFontFamily;
951 }
setMixerFontFamily(const QString & family)952 inline void Preferences::setMixerFontFamily( const QString& family ) {
953 mixerFontFamily = family;
954 }
getMixerFontPointSize()955 inline int Preferences::getMixerFontPointSize() {
956 return mixerFontPointSize;
957 }
setMixerFontPointSize(int size)958 inline void Preferences::setMixerFontPointSize( int size ) {
959 mixerFontPointSize = size;
960 }
getMixerFalloffSpeed()961 inline float Preferences::getMixerFalloffSpeed() {
962 return mixerFalloffSpeed;
963 }
setMixerFalloffSpeed(float value)964 inline void Preferences::setMixerFalloffSpeed( float value ) {
965 mixerFalloffSpeed = value;
966 }
showInstrumentPeaks()967 inline bool Preferences::showInstrumentPeaks() {
968 return m_bShowInstrumentPeaks;
969 }
setInstrumentPeaks(bool value)970 inline void Preferences::setInstrumentPeaks( bool value ) {
971 m_bShowInstrumentPeaks = value;
972 }
973
getPatternEditorGridResolution()974 inline int Preferences::getPatternEditorGridResolution() {
975 return m_nPatternEditorGridResolution;
976 }
setPatternEditorGridResolution(int value)977 inline void Preferences::setPatternEditorGridResolution( int value ) {
978 m_nPatternEditorGridResolution = value;
979 }
980
isPatternEditorUsingTriplets()981 inline bool Preferences::isPatternEditorUsingTriplets() {
982 return m_bPatternEditorUsingTriplets;
983 }
setPatternEditorUsingTriplets(bool value)984 inline void Preferences::setPatternEditorUsingTriplets( bool value ) {
985 m_bPatternEditorUsingTriplets = value;
986 }
987
isFXTabVisible()988 inline bool Preferences::isFXTabVisible() {
989 return m_bIsFXTabVisible;
990 }
setFXTabVisible(bool value)991 inline void Preferences::setFXTabVisible( bool value ) {
992 m_bIsFXTabVisible = value;
993 }
994
getShowAutomationArea()995 inline bool Preferences::getShowAutomationArea() {
996 return m_bShowAutomationArea;
997 }
setShowAutomationArea(bool value)998 inline void Preferences::setShowAutomationArea( bool value ) {
999 m_bShowAutomationArea = value;
1000 }
1001
1002
getPatternEditorGridHeight()1003 inline unsigned Preferences::getPatternEditorGridHeight() {
1004 return m_nPatternEditorGridHeight;
1005 }
setPatternEditorGridHeight(unsigned value)1006 inline void Preferences::setPatternEditorGridHeight( unsigned value ) {
1007 m_nPatternEditorGridHeight = value;
1008 }
1009
getPatternEditorGridWidth()1010 inline unsigned Preferences::getPatternEditorGridWidth() {
1011 return m_nPatternEditorGridWidth;
1012 }
setPatternEditorGridWidth(unsigned value)1013 inline void Preferences::setPatternEditorGridWidth( unsigned value ) {
1014 m_nPatternEditorGridWidth = value;
1015 }
1016
setColoringMethodAuxValue(int value)1017 inline void Preferences::setColoringMethodAuxValue( int value ){
1018 m_nColoringMethodAuxValue = value;
1019 }
1020
getColoringMethodAuxValue()1021 inline int Preferences::getColoringMethodAuxValue() const{
1022 return m_nColoringMethodAuxValue;
1023 }
1024
setColoringMethod(int value)1025 inline void Preferences::setColoringMethod( int value ){
1026 m_nColoringMethod = value;
1027 }
1028
getColoringMethod()1029 inline int Preferences::getColoringMethod() const{
1030 return m_nColoringMethod;
1031 }
1032
getMainFormProperties()1033 inline WindowProperties Preferences::getMainFormProperties() {
1034 return mainFormProperties;
1035 }
setMainFormProperties(const WindowProperties & prop)1036 inline void Preferences::setMainFormProperties( const WindowProperties& prop ) {
1037 mainFormProperties = prop;
1038 }
1039
getMixerProperties()1040 inline WindowProperties Preferences::getMixerProperties() {
1041 return mixerProperties;
1042 }
setMixerProperties(const WindowProperties & prop)1043 inline void Preferences::setMixerProperties( const WindowProperties& prop ) {
1044 mixerProperties = prop;
1045 }
1046
getPatternEditorProperties()1047 inline WindowProperties Preferences::getPatternEditorProperties() {
1048 return patternEditorProperties;
1049 }
setPatternEditorProperties(const WindowProperties & prop)1050 inline void Preferences::setPatternEditorProperties( const WindowProperties& prop ) {
1051 patternEditorProperties = prop;
1052 }
1053
getSongEditorProperties()1054 inline WindowProperties Preferences::getSongEditorProperties() {
1055 return songEditorProperties;
1056 }
setSongEditorProperties(const WindowProperties & prop)1057 inline void Preferences::setSongEditorProperties( const WindowProperties& prop ) {
1058 songEditorProperties = prop;
1059 }
1060
1061
getAudioEngineInfoProperties()1062 inline WindowProperties Preferences::getAudioEngineInfoProperties() {
1063 return audioEngineInfoProperties;
1064 }
setAudioEngineInfoProperties(const WindowProperties & prop)1065 inline void Preferences::setAudioEngineInfoProperties( const WindowProperties& prop ) {
1066 audioEngineInfoProperties = prop;
1067 }
1068
getLadspaProperties(unsigned nFX)1069 inline WindowProperties Preferences::getLadspaProperties( unsigned nFX ) {
1070 return m_ladspaProperties[nFX];
1071 }
setLadspaProperties(unsigned nFX,const WindowProperties & prop)1072 inline void Preferences::setLadspaProperties( unsigned nFX, const WindowProperties& prop ) {
1073 m_ladspaProperties[nFX] = prop;
1074 }
1075
getDefaultUIStyle()1076 inline UIStyle* Preferences::getDefaultUIStyle() {
1077 return m_pDefaultUIStyle;
1078 }
1079
patternModePlaysSelected()1080 inline bool Preferences::patternModePlaysSelected() {
1081 return m_bPatternModePlaysSelected;
1082 }
setPatternModePlaysSelected(bool b)1083 inline void Preferences::setPatternModePlaysSelected( bool b ) {
1084 m_bPatternModePlaysSelected = b;
1085 }
1086
useLash()1087 inline bool Preferences::useLash(){
1088 return m_bUseLash;
1089 }
setUseLash(bool b)1090 inline void Preferences::setUseLash( bool b ){
1091 m_bUseLash = b;
1092 }
1093
setMaxBars(const int bars)1094 inline void Preferences::setMaxBars( const int bars ){
1095 m_nMaxBars = bars;
1096 }
1097
getMaxBars()1098 inline int Preferences::getMaxBars() const {
1099 return m_nMaxBars;
1100 }
1101
setMaxLayers(const int layers)1102 inline void Preferences::setMaxLayers( const int layers ){
1103 m_nMaxLayers = layers;
1104 }
1105
getMaxLayers()1106 inline int Preferences::getMaxLayers() const {
1107 return m_nMaxLayers;
1108 }
1109
setWaitForSessionHandler(bool value)1110 inline void Preferences::setWaitForSessionHandler(bool value){
1111 waitingForSessionHandler = value;
1112 }
1113
getWaitForSessionHandler()1114 inline bool Preferences::getWaitForSessionHandler(){
1115 return waitingForSessionHandler;
1116 }
1117
1118 #if defined(H2CORE_HAVE_JACKSESSION) || _DOXYGEN_
getJackSessionUUID()1119 inline QString Preferences::getJackSessionUUID(){
1120 return jackSessionUUID;
1121 }
1122
setJackSessionUUID(QString uuid)1123 inline void Preferences::setJackSessionUUID( QString uuid ){
1124 jackSessionUUID = uuid;
1125 }
1126
getJackSessionApplicationPath()1127 inline QString Preferences::getJackSessionApplicationPath(){
1128 return jackSessionApplicationPath;
1129 }
1130
setJackSessionApplicationPath(QString path)1131 inline void Preferences::setJackSessionApplicationPath( QString path ){
1132 jackSessionApplicationPath = path;
1133 }
1134
1135 #endif
1136
1137
1138 #if defined(H2CORE_HAVE_OSC) || _DOXYGEN_
setNsmClientId(const QString & nsmClientId)1139 inline void Preferences::setNsmClientId(const QString& nsmClientId){
1140 m_sNsmClientId = nsmClientId;
1141 }
1142
getNsmClientId(void)1143 inline QString Preferences::getNsmClientId(void){
1144 return m_sNsmClientId;
1145 }
1146
setNsmSongName(const QString & nsmSongName)1147 inline void Preferences::setNsmSongName(const QString& nsmSongName){
1148 m_sNsmSongName = nsmSongName;
1149 }
1150
getNsmSongName(void)1151 inline QString Preferences::getNsmSongName(void){
1152 return m_sNsmSongName;
1153 }
1154
1155 #endif
1156
getOscServerEnabled()1157 inline bool Preferences::getOscServerEnabled(){
1158 return m_bOscServerEnabled;
1159 }
setOscServerEnabled(bool val)1160 inline void Preferences::setOscServerEnabled( bool val ){
1161 m_bOscServerEnabled = val;
1162 }
1163
getOscFeedbackEnabled()1164 inline bool Preferences::getOscFeedbackEnabled(){
1165 return m_bOscFeedbackEnabled;
1166 }
setOscFeedbackEnabled(bool val)1167 inline void Preferences::setOscFeedbackEnabled( bool val ){
1168 m_bOscFeedbackEnabled = val;
1169 }
1170
getOscServerPort()1171 inline int Preferences::getOscServerPort(){
1172 return m_nOscServerPort;
1173 }
setOscServerPort(int oscPort)1174 inline void Preferences::setOscServerPort( int oscPort ){
1175 m_nOscServerPort = oscPort;
1176 }
1177
getUseTimelineBpm()1178 inline bool Preferences::getUseTimelineBpm(){
1179 return __useTimelineBpm;
1180 }
setUseTimelineBpm(bool val)1181 inline void Preferences::setUseTimelineBpm( bool val ){
1182 __useTimelineBpm = val;
1183 }
1184
setShowPlaybackTrack(bool val)1185 inline void Preferences::setShowPlaybackTrack( bool val ) {
1186 m_bShowPlaybackTrack = val;
1187 }
getShowPlaybackTrack()1188 inline bool Preferences::getShowPlaybackTrack() const {
1189 return m_bShowPlaybackTrack;
1190 }
1191
getRubberBandCalcTime()1192 inline int Preferences::getRubberBandCalcTime(){
1193 return __rubberBandCalcTime;
1194 }
setRubberBandCalcTime(int val)1195 inline void Preferences::setRubberBandCalcTime( int val ){
1196 __rubberBandCalcTime = val;
1197 }
1198
getRubberBandBatchMode()1199 inline int Preferences::getRubberBandBatchMode(){
1200 return m_useTheRubberbandBpmChangeEvent;
1201 }
setRubberBandBatchMode(int val)1202 inline void Preferences::setRubberBandBatchMode( int val ){
1203 m_useTheRubberbandBpmChangeEvent = val;
1204 }
1205
getLastOpenTab()1206 inline int Preferences::getLastOpenTab(){
1207 return m_nLastOpenTab;
1208 }
setLastOpenTab(int n)1209 inline void Preferences::setLastOpenTab(int n){
1210 m_nLastOpenTab = n;
1211 }
1212
setH2ProcessName(const QString & processName)1213 inline void Preferences::setH2ProcessName(const QString& processName){
1214 m_sH2ProcessName = processName;
1215 }
1216
getH2ProcessName()1217 inline QString Preferences::getH2ProcessName() {
1218 return m_sH2ProcessName;
1219 }
1220
1221
1222
1223 };
1224
1225 #endif
1226
1227