--- qsampler/trunk/src/qsamplerChannel.h 2005/03/15 23:54:14 467 +++ qsampler/trunk/src/qsamplerChannel.h 2007/01/11 16:14:31 1022 @@ -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,68 +45,82 @@ public: // Constructor. - qsamplerChannel(qsamplerMainForm *pMainForm, int iChannelID = -1); + qsamplerChannel(int iChannelID = -1); // Default destructor. ~qsamplerChannel(); - // Main application options accessor. - qsamplerOptions *options(); - - // LSCP client descriptor accessor. - lscp_client_t * client(); - // Add/remove sampler channel methods. bool addChannel(); bool removeChannel(); // Sampler channel ID accessors. - int channelID(); + int channelID() const; void setChannelID(int iChannelID); // Readable channel name. - QString channelName(); + QString channelName() const; // Engine name property. - QString& engineName(); + const QString& engineName() const; bool loadEngine(const QString& sEngineName); // Instrument file and index. - QString& instrumentFile(); - int instrumentNr(); - QString& instrumentName(); - int instrumentStatus(); + const QString& instrumentFile() const; + int instrumentNr() const; + const QString& instrumentName() const; + int instrumentStatus() const; + + // Instrument file loader. bool loadInstrument(const QString& sInstrumentFile, int iInstrumentNr); // Special instrument file/name/number settler. bool setInstrument(const QString& sInstrumentFile, int iInstrumentNr); // MIDI input driver (DEPRECATED). - QString& midiDriver(); + const QString& midiDriver() const; bool setMidiDriver(const QString& sMidiDriver); // MIDI input device. - int midiDevice(); + int midiDevice() const; bool setMidiDevice(int iMidiDevice); // MIDI input port. - int midiPort(); + int midiPort() const; bool setMidiPort(int iMidiPort); // MIDI input channel. - int midiChannel(); + int midiChannel() const; bool setMidiChannel(int iMidiChannel); + // MIDI instrument map. + int midiMap() const; + bool setMidiMap(int iMidiMap); + // Audio output driver (DEPRECATED). - QString& audioDriver(); + const QString& audioDriver() const; bool setAudioDriver(const QString& sAudioDriver); // Audio output device. - int audioDevice(); + int audioDevice() const; bool setAudioDevice(int iAudioDevice); // Sampler channel volume. - float volume(); + 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(); @@ -116,11 +134,11 @@ bool channelReset(); // Message logging methods (brainlessly mapped to main form's). - void appendMessages (const QString & s); - void appendMessagesColor (const QString & s, const QString & c); - void appendMessagesText (const QString & s); - void appendMessagesError (const QString & s); - void appendMessagesClient (const QString & s); + void appendMessages (const QString & s) const; + void appendMessagesColor (const QString & s, const QString & c) const; + void appendMessagesText (const QString & s) const; + void appendMessagesError (const QString & s) const; + void appendMessagesClient (const QString & s) const; // Context menu event handler. void contextMenuEvent(QContextMenuEvent *pEvent); @@ -128,6 +146,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); @@ -140,9 +159,6 @@ private: - // Main application form reference. - qsamplerMainForm *m_pMainForm; - // Unique channel identifier. int m_iChannelID; @@ -152,15 +168,76 @@ QString m_sInstrumentFile; int m_iInstrumentNr; int m_iInstrumentStatus; - QString m_sMidiDriver; // DEPRECATED. + QString m_sMidiDriver; int m_iMidiDevice; int m_iMidiPort; int m_iMidiChannel; - QString m_sAudioDriver; // DEPRECATED. + 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