/*
 * Hydrogen
 * Copyright(c) 2002-2008 by Alex >Comix< Cominu [comix@users.sourceforge.net]
 *
 * http://www.hydrogen-music.org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY, without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef PREFERENCES_H
#define PREFERENCES_H

#include <list>
#include <vector>
#include <cassert>

#include <hydrogen/midi_action.h>
#include <hydrogen/globals.h>
#include <hydrogen/object.h>

#include <QStringList>
#include <QDomDocument>

namespace H2Core
{

const float FALLOFF_SLOW = 	1.08f;
const float FALLOFF_NORMAL=	1.1f;
const float FALLOFF_FAST =	1.5f;


/**
\ingroup H2CORE
*/
class WindowProperties : public H2Core::Object
{
	H2_OBJECT
public:
	int x;
	int y;
	int width;
	int height;
	bool visible;

	WindowProperties();
	~WindowProperties();

	void set(int _x, int _y, int _width, int _height, bool _visible) {
		x = _x; y = _y;
		width = _width; height = _height;
		visible = _visible;
	}

};


/**
\ingroup H2CORE
*/
class H2RGBColor : public H2Core::Object
{
	H2_OBJECT
public:
	H2RGBColor( int r = -1, int g = -1, int b = -1 );
	H2RGBColor( const QString& sColor );
	~H2RGBColor();

	QString toStringFmt();

	int getRed() const {
		return m_red;
	}
	int getGreen() const {
		return m_green;
	}
	int getBlue() const {
		return m_blue;
	}

private:
	int m_red;
	int m_green;
	int m_blue;

};


/**
\ingroup H2CORE
\brief	Colors for hydrogen
*/
class UIStyle : public H2Core::Object
{
	H2_OBJECT
public:
	UIStyle();
	H2RGBColor m_songEditor_backgroundColor;
	H2RGBColor m_songEditor_alternateRowColor;
	H2RGBColor m_songEditor_selectedRowColor;
	H2RGBColor m_songEditor_lineColor;
	H2RGBColor m_songEditor_textColor;
	H2RGBColor m_songEditor_pattern1Color;

	H2RGBColor m_patternEditor_backgroundColor;
	H2RGBColor m_patternEditor_alternateRowColor;
	H2RGBColor m_patternEditor_selectedRowColor;
	H2RGBColor m_patternEditor_textColor;
	H2RGBColor m_patternEditor_noteColor;
	H2RGBColor m_patternEditor_noteoffColor;
	H2RGBColor m_patternEditor_lineColor;
	H2RGBColor m_patternEditor_line1Color;
	H2RGBColor m_patternEditor_line2Color;
	H2RGBColor m_patternEditor_line3Color;
	H2RGBColor m_patternEditor_line4Color;
	H2RGBColor m_patternEditor_line5Color;
};



/**
\ingroup H2CORE
\brief	Manager for User Preferences File (singleton)
*/
class Preferences : public H2Core::Object
{
	H2_OBJECT
public:
	enum {
		USE_JACK_TRANSPORT = 0,
		USE_JACK_TIME_MASTER = 0,
		POST_FADER = 0,
		SET_PLAY_ON = 0,
		BC_ON = 0,
		NO_JACK_TRANSPORT = 1,
		NO_JACK_TIME_MASTER = 1,
		PRE_FADER = 1,
		SET_PLAY_OFF = 1,
		BC_OFF = 1
	};


	enum UI_LAYOUT_TYPES {
			UI_LAYOUT_SINGLE_PANE,
			UI_LAYOUT_TABBED
	};


	QString				m_sPreferencesFilename;
	QString				m_sPreferencesDirectory;

	QString				__lastspatternDirectory;
	QString				__lastsampleDirectory; // audio file browser
	bool				__playsamplesonclicking; // audio file browser

	bool				__playselectedinstrument; // midi keys and keys play instrument or drumset

	int					m_nRecPreDelete; //index of record note pre delete function 0 = off
	int					m_nRecPostDelete;

	bool				m_bFollowPlayhead;

	// switch to enable / disable lash, only on h2 startup
	bool				m_brestartLash;
	bool				m_bsetLash;

	//soundlibrarypanel expand song and pattern item
	bool				__expandSongItem;
	bool				__expandPatternItem;

	//beatcounter
	bool				m_bbc;
	bool				m_mmcsetplay;

	int					m_countOffset;
	int					m_startOffset;
	//~ beatcounter

	std::list<QString> sServerList;
	std::list<QString> m_patternCategories;

	//	audio engine properties ___
	QString				m_sAudioDriver;		///< Audio Driver
	bool				m_bUseMetronome;		///< Use metronome?
	float				m_fMetronomeVolume;	///< Metronome volume FIXME: remove this volume!!
	unsigned			m_nMaxNotes;		///< max notes
	unsigned			m_nBufferSize;		///< Audio buffer size
	unsigned			m_nSampleRate;		///< Audio sample rate

	//	OSS driver properties ___
	QString				m_sOSSDevice;		///< Device used for output

	//	MIDI Driver properties
	QString				m_sMidiDriver;
	QString				m_sMidiPortName;
	int					m_nMidiChannelFilter;
	bool				m_bMidiNoteOffIgnore;
	bool				m_bMidiFixedMapping;
	bool				m_bMidiDiscardNoteAfterAction;
	bool				m_bEnableMidiFeedback;
	
	// OSC Server properties
	bool				m_bOscServerEnabled;
	bool				m_bOscFeedbackEnabled;
	int					m_nOscServerPort;

	//	alsa audio driver properties ___
	QString				m_sAlsaAudioDevice;

	//	jack driver properties ___
	QString				m_sJackPortName1;
	QString				m_sJackPortName2;
	int					m_bJackTransportMode;
	bool				m_bJackConnectDefaults;
	bool				m_bJackTrackOuts;
	int					m_nJackTrackOutputMode;
	//jack time master
	int					m_bJackMasterMode ;
	//~ jack driver properties

	///Default text editor (used by Playlisteditor)
	QString				m_sDefaultEditor;

	///Rubberband CLI
	QString				m_rubberBandCLIexecutable;

	/// Returns an instance of PreferencesMng class
	static void			create_instance();
	static Preferences* get_instance() { assert(__instance); return __instance; }

	~Preferences();

	/// Load the preferences file
	void				loadPreferences( bool bGlobal );

	/// Save the preferences file
	void				savePreferences();

	const QString&		getDemoPath();
	const QString&		getDataDirectory();
	const QString&		getTmpDirectory();

	const QString&		getDefaultEditor();
	void				setDefaultEditor( QString editor);

	int					getDefaultUILayout();
	void				setDefaultUILayout( int layout);

	// General
	void				setRestoreLastSongEnabled( bool restore );
	void				setRestoreLastPlaylistEnabled( bool restore );
	void				setUseRelativeFilenamesForPlaylists( bool value );

	void				setShowDevelWarning( bool value );
	bool				getShowDevelWarning();

	bool				isRestoreLastSongEnabled();
	bool				isRestoreLastPlaylistEnabled();
	bool				isPlaylistUsingRelativeFilenames();

	void				setLastSongFilename( const QString& filename );
	const QString&		getLastSongFilename();

	void				setLastPlaylistFilename( const QString& filename );
	const QString&		getLastPlaylistFilename();

	void				setHearNewNotes( bool value );
	bool				getHearNewNotes();

	void				setRecordEvents( bool value );
	bool				getRecordEvents();

	void				setDestructiveRecord ( bool value );
	bool				getDestructiveRecord();

	void				setPunchInPos ( unsigned pos );
	int					getPunchInPos();

	void				setPunchOutPos ( unsigned pos );
	int					getPunchOutPos();

	bool				inPunchArea (int pos);
	void				unsetPunchArea ();

	void				setQuantizeEvents( bool value );
	bool				getQuantizeEvents();

	std::vector<QString> getRecentFiles();
	void				setRecentFiles( std::vector<QString> recentFiles );

	QStringList			getRecentFX();
	void				setMostRecentFX( QString );

	std::vector<QString> getLadspaPath();
	void				setLadspaPath( std::vector<QString> pathVect );


	// GUI Properties
	const QString&		getQTStyle();
	void				setQTStyle( const QString& sStyle );


	const QString&		getApplicationFontFamily();
	void				setApplicationFontFamily( const QString& family );

	int					getApplicationFontPointSize();
	void				setApplicationFontPointSize( int size );

	QString				getMixerFontFamily();
	void				setMixerFontFamily( const QString& family );
	int					getMixerFontPointSize();
	void				setMixerFontPointSize( int size );
	float				getMixerFalloffSpeed();
	void				setMixerFalloffSpeed( float value );
	bool				showInstrumentPeaks();
	void				setInstrumentPeaks( bool value );

	int					getPatternEditorGridResolution();
	void				setPatternEditorGridResolution( int value );

	bool				isPatternEditorUsingTriplets();
	void				setPatternEditorUsingTriplets( bool value );

	bool				isFXTabVisible();
	void				setFXTabVisible( bool value );
	
	bool				getShowAutomationArea();
	void				setShowAutomationArea( bool value );

	unsigned			getPatternEditorGridHeight();
	void				setPatternEditorGridHeight( unsigned value );

	unsigned			getPatternEditorGridWidth();
	void				setPatternEditorGridWidth( unsigned value );

	void				setColoringMethodAuxValue( int value );
	int					getColoringMethodAuxValue() const;

	void				setColoringMethod( int value );
	int					getColoringMethod() const;

	WindowProperties	getMainFormProperties();
	void				setMainFormProperties( const WindowProperties& prop );

	WindowProperties	getMixerProperties();
	void				setMixerProperties( const WindowProperties& prop );

	WindowProperties	getPatternEditorProperties();
	void				setPatternEditorProperties( const WindowProperties& prop );

	WindowProperties	getSongEditorProperties();
	void				setSongEditorProperties( const WindowProperties& prop );

	WindowProperties	getAudioEngineInfoProperties();
	void				setAudioEngineInfoProperties( const WindowProperties& prop );

	WindowProperties	getLadspaProperties( unsigned nFX );
	void				setLadspaProperties( unsigned nFX, const WindowProperties& prop );

	UIStyle*			getDefaultUIStyle();

	bool				patternModePlaysSelected();
	void				setPatternModePlaysSelected( bool b );
	bool				useLash();
	void				setUseLash( bool b );

	void				setMaxBars( int bars );
	int					getMaxBars();

	void				setWaitForSessionHandler(bool value);
	bool				getWaitForSessionHandler();

#ifdef H2CORE_HAVE_JACKSESSION
	QString				getJackSessionUUID();
	void				setJackSessionUUID( QString uuid );

	QString				getJackSessionApplicationPath();
	void				setJackSessionApplicationPath( QString path );
#endif


#ifdef H2CORE_HAVE_OSC
	void				setNsmClientId(const QString& nsmClientId);
	QString				getNsmClientId(void);

	void				setNsmSongName(const QString& nsmSongName);
	QString				getNsmSongName(void);
#endif

	bool				getOscServerEnabled();
	void				setOscServerEnabled( bool val );
	
	bool				getOscFeedbackEnabled();
	void				setOscFeedbackEnabled( bool val );
	
	int					getOscServerPort();
	void				setOscServerPort( int oscPort );

	bool				getUseTimelineBpm();
	void				setUseTimelineBpm( bool val );

	int					getRubberBandCalcTime();
	void				setRubberBandCalcTime( int val );

	int					getRubberBandBatchMode();
	void				setRubberBandBatchMode( int val );

	int					getLastOpenTab();
	void				setLastOpenTab(int n);

	void				setH2ProcessName(const QString& processName);

	QString				getH2ProcessName();

	int					getExportSampleDepth() const;
	void				setExportSampleDepth( int nExportSampleDepth );
	
	int					getExportSampleRate() const;
	void				setExportSampleRate( int nExportSampleRate );

	
	int					getExportMode() const;
	void				setExportMode(int nExportMode);
	
	QString				getExportDirectory() const;
	void				setExportDirectory( const QString &sExportDirectory );
	
	int					getExportTemplate() const;
	void				setExportTemplate( int nExportTemplate );
	
private:
	static Preferences *	__instance;
	
	QString				m_sDataDirectory;
	QString				m_sTmpDirectory;

	/** directory of demo songs */
	QString				demoPath;

	//___ General properties ___
	QString				m_sH2ProcessName; //Name of hydrogen's main process
	int					__rubberBandCalcTime;
	bool				m_useTheRubberbandBpmChangeEvent; ///rubberband bpm change queue
	bool				m_bPatternModePlaysSelected; /// Behaviour of Pattern Mode
	bool				m_brestoreLastSong;		///< Restore last song?
	bool				m_brestoreLastPlaylist;
	bool				m_bUseLash;
	bool				m_bShowDevelWarning;	///< Show development version warning?
	QString				m_lastSongFilename;	///< Last song used
	QString				m_lastPlaylistFilename;

	bool				quantizeEvents;
	bool				recordEvents;
	bool				destructiveRecord;
	bool				readPrefFileforotherplaces;
	int					punchInPos;
	int					punchOutPos;
	int					maxBars;
	bool				hearNewNotes;

	QStringList			m_recentFX;
	std::vector<QString> m_recentFiles;
	std::vector<QString> m_ladspaPathVect;

#ifdef H2CORE_HAVE_JACKSESSION
		QString			jackSessionUUID;
		QString			jackSessionApplicationPath;
#endif

#ifdef H2CORE_HAVE_OSC
		QString			m_sNsmClientId;
		QString			m_sNsmSongName;
#endif

	bool				waitingForSessionHandler;
	bool				__useTimelineBpm;

	//___ GUI properties ___
	QString				m_sQTStyle;
	int					m_nLastOpenTab;
	int					m_nDefaultUILayout;


	QString				applicationFontFamily;
	int					applicationFontPointSize;
	QString				mixerFontFamily;
	int					mixerFontPointSize;
	float				mixerFalloffSpeed;
	int					m_nPatternEditorGridResolution;
	bool				m_bPatternEditorUsingTriplets;
	bool				m_bShowInstrumentPeaks;
	bool				m_bIsFXTabVisible;
	bool				m_bShowAutomationArea;
	bool				m_bUseRelativeFilenamesForPlaylists;
	unsigned			m_nPatternEditorGridHeight;
	unsigned			m_nPatternEditorGridWidth;
	WindowProperties	mainFormProperties;
	WindowProperties	mixerProperties;
	WindowProperties	patternEditorProperties;
	WindowProperties	songEditorProperties;
	WindowProperties	drumkitManagerProperties;
	WindowProperties	audioEngineInfoProperties;
	WindowProperties	m_ladspaProperties[MAX_FX];

	UIStyle*			 m_pDefaultUIStyle;

	//Appearence: SongEditor coloring
	int					m_nColoringMethod;
	int					m_nColoringMethodAuxValue;

	//Export dialog
	QString				m_sExportDirectory;
	int					m_nExportMode;
	int					m_nExportSampleRate;
	int					m_nExportSampleDepth;
	int					m_nExportTemplate;
	//~ Export dialog 
	
	Preferences();

	/// Create preferences directory
	void createPreferencesDirectory();

	/// Create data directory
	void createDataDirectory();

	/// Create soundLibrary directory
	void createSoundLibraryDirectories();

	WindowProperties readWindowProperties( QDomNode parent, const QString& windowName, WindowProperties defaultProp );
	void writeWindowProperties( QDomNode parent, const QString& windowName, const WindowProperties& prop );

	void writeUIStyle( QDomNode parent );
	void readUIStyle( QDomNode parent );
};


inline int Preferences::getExportSampleDepth() const
{
	return m_nExportSampleDepth;
}

inline void Preferences::setExportSampleDepth(int ExportSampleDepth)
{
	m_nExportSampleDepth = ExportSampleDepth;
}

inline int Preferences::getExportSampleRate() const
{
	return m_nExportSampleRate;
}

inline int Preferences::getExportMode() const
{
	return m_nExportMode;
}

inline void Preferences::setExportMode(int ExportMode)
{
	m_nExportMode = ExportMode;
}

inline QString Preferences::getExportDirectory() const
{
	return m_sExportDirectory;
}

inline void Preferences::setExportDirectory(const QString &ExportDirectory)
{
	m_sExportDirectory = ExportDirectory;
}

inline void Preferences::setExportSampleRate(int ExportSampleRate)
{
	m_nExportSampleRate = ExportSampleRate;
}

inline int Preferences::getExportTemplate() const
{
	return m_nExportTemplate;
}

inline void Preferences::setExportTemplate(int ExportTemplate)
{
	m_nExportTemplate = ExportTemplate;
}

inline const QString& Preferences::getDemoPath() {
	return demoPath;
}
inline const QString& Preferences::getDataDirectory(){
	return m_sDataDirectory;
}

inline const QString& Preferences::getTmpDirectory(){
	return m_sTmpDirectory;
}

inline const QString& Preferences::getDefaultEditor() {
	return m_sDefaultEditor;
}

inline void Preferences::setDefaultEditor( QString editor){
	m_sDefaultEditor = editor;
}

inline int Preferences::getDefaultUILayout(){
	return m_nDefaultUILayout;
}

inline void Preferences::setDefaultUILayout( int layout){
	m_nDefaultUILayout = layout;
}


// General
inline void Preferences::setRestoreLastSongEnabled( bool restore ) {
	m_brestoreLastSong = restore;
}

inline void Preferences::setRestoreLastPlaylistEnabled( bool restore ) {
	m_brestoreLastPlaylist = restore;
}

inline void Preferences::setUseRelativeFilenamesForPlaylists( bool value ) {
	m_bUseRelativeFilenamesForPlaylists= value;
}

inline void Preferences::setShowDevelWarning( bool value ) {
	m_bShowDevelWarning = value;
}

inline bool Preferences::getShowDevelWarning() {
	return m_bShowDevelWarning;
}

inline bool Preferences::isRestoreLastSongEnabled() {
	return m_brestoreLastSong;
}

inline bool Preferences::isRestoreLastPlaylistEnabled() {
	return m_brestoreLastPlaylist;
}

inline bool Preferences::isPlaylistUsingRelativeFilenames() {
	return m_bUseRelativeFilenamesForPlaylists;
}

inline void Preferences::setLastSongFilename( const QString& filename ) {
	m_lastSongFilename = filename;
}
inline const QString& Preferences::getLastSongFilename() {
	return m_lastSongFilename;
}

inline void Preferences::setLastPlaylistFilename( const QString& filename ) {
	m_lastPlaylistFilename = filename;
}
inline const QString& Preferences::getLastPlaylistFilename() {
	return m_lastPlaylistFilename;
}

inline void Preferences::setHearNewNotes( bool value ) {
	hearNewNotes = value;
}
inline bool Preferences::getHearNewNotes() {
	return hearNewNotes;
}

inline void Preferences::setRecordEvents( bool value ) {
	recordEvents = value;
}
inline bool Preferences::getRecordEvents() {
	return recordEvents;
}

inline void Preferences::setDestructiveRecord ( bool value ) {
	destructiveRecord = value;
}
inline bool Preferences::getDestructiveRecord() {
	return destructiveRecord;
}

inline void Preferences::setPunchInPos ( unsigned pos ) {
	punchInPos = pos;
}
inline int Preferences::getPunchInPos() {
	return punchInPos;
}

inline void Preferences::setPunchOutPos ( unsigned pos ) {
	punchOutPos = pos;
}
inline int Preferences::getPunchOutPos() {
	return punchOutPos;
}

inline bool Preferences::inPunchArea (int pos) {
	// Return true if punch area not defined
	if ( punchInPos <= punchOutPos ) {
		if ( pos < punchInPos || punchOutPos < pos ) {
			return false;
		}
	}
	return true;
}

inline void Preferences::unsetPunchArea () {
	punchInPos = 0;
	punchOutPos = -1;
}

inline void Preferences::setQuantizeEvents( bool value ) {
	quantizeEvents = value;
}
inline bool Preferences::getQuantizeEvents() {
	return quantizeEvents;
}

inline std::vector<QString> Preferences::getRecentFiles() {
	return m_recentFiles;
}

inline QStringList Preferences::getRecentFX() {
	return m_recentFX;
}

inline std::vector<QString> Preferences::getLadspaPath() {
	return m_ladspaPathVect;
}
inline void Preferences::setLadspaPath( std::vector<QString> pathVect ) {
	m_ladspaPathVect = pathVect;
}


// GUI Properties
inline const QString& Preferences::getQTStyle() {
	return m_sQTStyle;
}
inline void Preferences::setQTStyle( const QString& sStyle ) {
	m_sQTStyle = sStyle;
}


inline const QString& Preferences::getApplicationFontFamily() {
	return applicationFontFamily;
}
inline void Preferences::setApplicationFontFamily( const QString& family ) {
	applicationFontFamily = family;
}

inline int Preferences::getApplicationFontPointSize() {
	return applicationFontPointSize;
}
inline void Preferences::setApplicationFontPointSize( int size ) {
	applicationFontPointSize = size;
}

inline QString Preferences::getMixerFontFamily() {
	return mixerFontFamily;
}
inline void Preferences::setMixerFontFamily( const QString& family ) {
	mixerFontFamily = family;
}
inline int Preferences::getMixerFontPointSize() {
	return mixerFontPointSize;
}
inline void Preferences::setMixerFontPointSize( int size ) {
	mixerFontPointSize = size;
}
inline float Preferences::getMixerFalloffSpeed() {
	return mixerFalloffSpeed;
}
inline void Preferences::setMixerFalloffSpeed( float value ) {
	mixerFalloffSpeed = value;
}
inline bool Preferences::showInstrumentPeaks() {
	return m_bShowInstrumentPeaks;
}
inline void Preferences::setInstrumentPeaks( bool value ) {
	m_bShowInstrumentPeaks = value;
}

inline int Preferences::getPatternEditorGridResolution() {
	return m_nPatternEditorGridResolution;
}
inline void Preferences::setPatternEditorGridResolution( int value ) {
	m_nPatternEditorGridResolution = value;
}

inline bool Preferences::isPatternEditorUsingTriplets() {
	return m_bPatternEditorUsingTriplets;
}
inline void Preferences::setPatternEditorUsingTriplets( bool value ) {
	m_bPatternEditorUsingTriplets = value;
}

inline bool Preferences::isFXTabVisible() {
	return m_bIsFXTabVisible;
}
inline void Preferences::setFXTabVisible( bool value ) {
	m_bIsFXTabVisible = value;
}

inline bool Preferences::getShowAutomationArea() {
	return m_bShowAutomationArea;
}
inline void Preferences::setShowAutomationArea( bool value ) {
	m_bShowAutomationArea = value;
}


inline unsigned Preferences::getPatternEditorGridHeight() {
	return m_nPatternEditorGridHeight;
}
inline void Preferences::setPatternEditorGridHeight( unsigned value ) {
	m_nPatternEditorGridHeight = value;
}

inline unsigned Preferences::getPatternEditorGridWidth() {
	return m_nPatternEditorGridWidth;
}
inline void Preferences::setPatternEditorGridWidth( unsigned value ) {
	m_nPatternEditorGridWidth = value;
}

inline void Preferences::setColoringMethodAuxValue( int value ){
	m_nColoringMethodAuxValue = value;
}

inline int Preferences::getColoringMethodAuxValue() const{
	return m_nColoringMethodAuxValue;
}

inline void Preferences::setColoringMethod( int value ){
	m_nColoringMethod = value;
}

inline int Preferences::getColoringMethod() const{
	return m_nColoringMethod;
}

inline WindowProperties Preferences::getMainFormProperties() {
	return mainFormProperties;
}
inline void Preferences::setMainFormProperties( const WindowProperties& prop ) {
	mainFormProperties = prop;
}

inline WindowProperties Preferences::getMixerProperties() {
	return mixerProperties;
}
inline void Preferences::setMixerProperties( const WindowProperties& prop ) {
	mixerProperties = prop;
}

inline WindowProperties Preferences::getPatternEditorProperties() {
	return patternEditorProperties;
}
inline void Preferences::setPatternEditorProperties( const WindowProperties& prop ) {
	patternEditorProperties = prop;
}

inline WindowProperties Preferences::getSongEditorProperties() {
	return songEditorProperties;
}
inline void Preferences::setSongEditorProperties( const WindowProperties& prop ) {
	songEditorProperties = prop;
}


inline WindowProperties Preferences::getAudioEngineInfoProperties() {
	return audioEngineInfoProperties;
}
inline void Preferences::setAudioEngineInfoProperties( const WindowProperties& prop ) {
	audioEngineInfoProperties = prop;
}

inline WindowProperties Preferences::getLadspaProperties( unsigned nFX ) {
	return m_ladspaProperties[nFX];
}
inline void Preferences::setLadspaProperties( unsigned nFX, const WindowProperties& prop ) {
	m_ladspaProperties[nFX] = prop;
}

inline UIStyle* Preferences::getDefaultUIStyle() {
	return m_pDefaultUIStyle;
}

inline bool Preferences::patternModePlaysSelected() {
	return m_bPatternModePlaysSelected;
}
inline void Preferences::setPatternModePlaysSelected( bool b ) {
	m_bPatternModePlaysSelected = b;
}

inline bool Preferences::useLash(){
	return m_bUseLash;
}
inline void Preferences::setUseLash( bool b ){
	m_bUseLash = b;
}

inline void Preferences::setMaxBars( int bars ){
	maxBars = bars;
}

inline int Preferences::getMaxBars(){
	return maxBars;
}

inline void Preferences::setWaitForSessionHandler(bool value){
	waitingForSessionHandler = value;
}

inline bool Preferences::getWaitForSessionHandler(){
		return waitingForSessionHandler;
}

#ifdef H2CORE_HAVE_JACKSESSION
inline QString Preferences::getJackSessionUUID(){
	return jackSessionUUID;
}

inline void Preferences::setJackSessionUUID( QString uuid ){
	jackSessionUUID = uuid;
}

inline QString Preferences::getJackSessionApplicationPath(){
	return jackSessionApplicationPath;
}

inline void Preferences::setJackSessionApplicationPath( QString path ){
	jackSessionApplicationPath = path;
}

#endif


#ifdef H2CORE_HAVE_OSC
inline void Preferences::setNsmClientId(const QString& nsmClientId){
	m_sNsmClientId = nsmClientId;
}

inline QString Preferences::getNsmClientId(void){
	return m_sNsmClientId;
}

inline void Preferences::setNsmSongName(const QString& nsmSongName){
	m_sNsmSongName = nsmSongName;
}

inline QString Preferences::getNsmSongName(void){
	return m_sNsmSongName;
}

#endif

inline bool Preferences::getOscServerEnabled(){
	return m_bOscServerEnabled;
}

inline void Preferences::setOscServerEnabled( bool val ){
	m_bOscServerEnabled = val;
}
inline bool Preferences::getOscFeedbackEnabled(){
	return m_bOscFeedbackEnabled;
}

inline void Preferences::setOscFeedbackEnabled( bool val ){
	m_bOscFeedbackEnabled = val;
}

inline int Preferences::getOscServerPort(){
	return m_nOscServerPort;
}

inline void Preferences::setOscServerPort( int oscPort ){
	m_nOscServerPort = oscPort;
}

inline bool Preferences::getUseTimelineBpm(){
	return __useTimelineBpm;
}
inline void Preferences::setUseTimelineBpm( bool val ){
	__useTimelineBpm = val;
}

inline int Preferences::getRubberBandCalcTime(){
	return __rubberBandCalcTime;
}
inline void Preferences::setRubberBandCalcTime( int val ){
	__rubberBandCalcTime = val;
}

inline int Preferences::getRubberBandBatchMode(){
	return m_useTheRubberbandBpmChangeEvent;
}
inline void Preferences::setRubberBandBatchMode( int val ){
	m_useTheRubberbandBpmChangeEvent = val;
}

inline int Preferences::getLastOpenTab(){
	return m_nLastOpenTab;
}
inline void Preferences::setLastOpenTab(int n){
	m_nLastOpenTab = n;
}

inline void Preferences::setH2ProcessName(const QString& processName){
	m_sH2ProcessName = processName;
}

inline QString Preferences::getH2ProcessName() {
	return m_sH2ProcessName;
}



};

#endif

