--- qsampler/trunk/src/qsamplerChannel.h 2005/04/01 00:34:58 490 +++ qsampler/trunk/src/qsamplerChannel.h 2007/10/01 18:26:06 1366 @@ -1,7 +1,7 @@ // qsamplerChannel.h // /**************************************************************************** - Copyright (C) 2003-2005, rncbc aka Rui Nuno Capela. All rights reserved. + Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -13,23 +13,27 @@ 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. + 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., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *****************************************************************************/ #ifndef __qsamplerChannel_h #define __qsamplerChannel_h -#include +#include #include #include #include "qsamplerOptions.h" -class qsamplerMainForm; +class qsamplerDevice; + + +// Typedef'd QMap. +typedef QMap qsamplerChannelRoutingMap; //------------------------------------------------------------------------- @@ -41,19 +45,10 @@ public: // Constructor. - qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); + qsamplerChannel(int iChannelID = -1); // Default destructor. ~qsamplerChannel(); - // Main application form accessor. - qsamplerMainForm *mainForm() const; - - // Main application options accessor. - qsamplerOptions *options() const; - - // LSCP client descriptor accessor. - lscp_client_t * client() const; - // Add/remove sampler channel methods. bool addChannel(); bool removeChannel(); @@ -96,6 +91,10 @@ int midiChannel() const; bool setMidiChannel(int iMidiChannel); + // MIDI instrument map. + int midiMap() const; + bool setMidiMap(int iMidiMap); + // Audio output driver (DEPRECATED). const QString& audioDriver() const; bool setAudioDriver(const QString& sAudioDriver); @@ -108,6 +107,20 @@ float volume() const; bool setVolume(float fVolume); + // Sampler channel mute state. + bool channelMute() const; + bool setChannelMute(bool bMute); + + // Sampler channel solo state. + bool channelSolo() const; + bool setChannelSolo(bool bSolo); + + // Audio routing accessors. + int audioChannel(int iAudioOut) const; + bool setAudioChannel(int iAudioOut, int iAudioIn); + // The audio routing map itself. + const qsamplerChannelRoutingMap& audioRouting() const; + // Istrument name remapper. void updateInstrumentName(); @@ -120,6 +133,9 @@ // Reset channel method. bool channelReset(); + // Spawn instrument editor method. + bool editChannel(); + // Message logging methods (brainlessly mapped to main form's). void appendMessages (const QString & s) const; void appendMessagesColor (const QString & s, const QString & c) const; @@ -133,6 +149,7 @@ // Common (invalid) name-helpers. static QString noEngineName(); static QString noInstrumentName(); + static QString loadingInstrument(); // Check whether a given file is an instrument file. static bool isInstrumentFile (const QString& sInstrumentFile); @@ -145,9 +162,6 @@ private: - // Main application form reference. - qsamplerMainForm *m_pMainForm; - // Unique channel identifier. int m_iChannelID; @@ -161,11 +175,72 @@ int m_iMidiDevice; int m_iMidiPort; int m_iMidiChannel; + int m_iMidiMap; QString m_sAudioDriver; int m_iAudioDevice; float m_fVolume; + bool m_bMute; + bool m_bSolo; + + // The audio routing mapping. + qsamplerChannelRoutingMap m_audioRouting; }; + +//------------------------------------------------------------------------- +// qsamplerChannelRoutingTable - Channel routing table widget. +// + +class qsamplerChannelRoutingTable : public QTable +{ + Q_OBJECT + +public: + + // Constructor. + qsamplerChannelRoutingTable(QWidget *pParent = 0, const char *pszName = 0); + // Default destructor. + ~qsamplerChannelRoutingTable(); + + // Common parameter table renderer. + void refresh(qsamplerDevice *pDevice, + const qsamplerChannelRoutingMap& routing); + + // Commit any pending editing. + void flush(); +}; + + +//------------------------------------------------------------------------- +// qsamplerChannelRoutingComboBox - Custom combo box for routing table. +// + +class qsamplerChannelRoutingComboBox : public QTableItem +{ +public: + + // Constructor. + qsamplerChannelRoutingComboBox(QTable *pTable, + const QStringList& list, const QPixmap& pixmap); + + // Public accessors. + void setCurrentItem(int iCurrentItem); + int currentItem() const; + +protected: + + // Virtual implemetations. + QWidget *createEditor() const; + void setContentFromEditor(QWidget *pWidget); + +private: + + // Initial value holders + QStringList m_list; + int m_iCurrentItem; +}; + + #endif // __qsamplerChannel_h