--- qsampler/trunk/src/qsamplerChannelStrip.ui.h 2005/02/24 12:10:54 409 +++ qsampler/trunk/src/qsamplerChannelStrip.ui.h 2007/10/01 18:26:06 1366 @@ -2,7 +2,7 @@ // // ui.h extension file, included from the uic-generated form implementation. /**************************************************************************** - Copyright (C) 2004-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 @@ -14,9 +14,9 @@ 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. *****************************************************************************/ @@ -117,7 +117,7 @@ // Set the new one... m_pChannel = pChannel; - + // Stabilize this around. updateChannelInfo(); @@ -171,7 +171,7 @@ pLabel->setPaletteBackgroundPixmap(pm); delete pList; } - + // And this standalone too. StreamVoiceCountTextLabel->setPaletteBackgroundPixmap(pm); } @@ -195,7 +195,23 @@ // Invoke the channel setup dialog. bool bResult = m_pChannel->channelSetup(this); - // Notify that thie channel has changed. + // Notify that this channel has changed. + if (bResult) + emit channelChanged(this); + + return bResult; +} + + +// Channel mute slot. +bool qsamplerChannelStrip::channelMute ( bool bMute ) +{ + if (m_pChannel == NULL) + return false; + + // Invoke the channel mute method. + bool bResult = m_pChannel->setChannelMute(bMute); + // Notify that this channel has changed. if (bResult) emit channelChanged(this); @@ -203,6 +219,32 @@ } +// Channel solo slot. +bool qsamplerChannelStrip::channelSolo ( bool bSolo ) +{ + if (m_pChannel == NULL) + return false; + + // Invoke the channel solo method. + bool bResult = m_pChannel->setChannelSolo(bSolo); + // Notify that this channel has changed. + if (bResult) + emit channelChanged(this); + + return bResult; +} + + +// Channel edit slot. +void qsamplerChannelStrip::channelEdit() +{ + if (m_pChannel == NULL) + return; + + m_pChannel->editChannel(); +} + + // Channel reset slot. bool qsamplerChannelStrip::channelReset (void) { @@ -211,7 +253,7 @@ // Invoke the channel reset method. bool bResult = m_pChannel->channelReset(); - // Notify that thie channel has changed. + // Notify that this channel has changed. if (bResult) emit channelChanged(this); @@ -225,14 +267,17 @@ if (m_pChannel == NULL) return false; - // Do we refersh the actual name? + // Do we refresh the actual name? if (bForce) m_pChannel->updateInstrumentName(); // Instrument name... - if (m_pChannel->instrumentName().isEmpty()) - InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName()); - else + if (m_pChannel->instrumentName().isEmpty()) { + if (m_pChannel->instrumentStatus() >= 0) + InstrumentNameTextLabel->setText(' ' + qsamplerChannel::loadingInstrument()); + else + InstrumentNameTextLabel->setText(' ' + qsamplerChannel::noInstrumentName()); + } else InstrumentNameTextLabel->setText(' ' + m_pChannel->instrumentName()); return true; @@ -278,7 +323,7 @@ { if (m_pChannel == NULL) return false; - + // Check for error limit/recycle... if (m_iErrorCount > QSAMPLER_ERROR_LIMIT) return true; @@ -289,8 +334,9 @@ ChannelSetupPushButton->setText(sText); // Check if we're up and connected. - if (m_pChannel->client() == NULL) - return false; + qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); + if (pMainForm->client() == NULL) + return false; // Read actual channel information. m_pChannel->updateChannelInfo(); @@ -305,10 +351,12 @@ updateInstrumentName(false); // MIDI Port/Channel... - if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) - MidiPortChannelTextLabel->setText(QString("%1 / *").arg(m_pChannel->midiPort())); - else - MidiPortChannelTextLabel->setText(QString("%1 / %2").arg(m_pChannel->midiPort()).arg(m_pChannel->midiChannel() + 1)); + QString sMidiPortChannel = QString::number(m_pChannel->midiPort()) + " / "; + if (m_pChannel->midiChannel() == LSCP_MIDI_CHANNEL_ALL) + sMidiPortChannel += tr("All"); + else + sMidiPortChannel += QString::number(m_pChannel->midiChannel() + 1); + MidiPortChannelTextLabel->setText(sMidiPortChannel); // Instrument status... int iInstrumentStatus = m_pChannel->instrumentStatus(); @@ -323,6 +371,20 @@ InstrumentStatusTextLabel->setText(QString::number(iInstrumentStatus) + '%'); m_iErrorCount = 0; +#ifdef CONFIG_MUTE_SOLO + // Mute/Solo button state coloring... + const QColor& rgbNormal = ChannelSetupPushButton->paletteBackgroundColor(); + bool bMute = m_pChannel->channelMute(); + ChannelMutePushButton->setPaletteBackgroundColor(bMute ? Qt::yellow : rgbNormal); + ChannelMutePushButton->setDown(bMute); + bool bSolo = m_pChannel->channelSolo(); + ChannelSoloPushButton->setPaletteBackgroundColor(bSolo ? Qt::cyan : rgbNormal); + ChannelSoloPushButton->setDown(bSolo); +#else + ChannelMutePushButton->setEnabled(false); + ChannelSoloPushButton->setEnabled(false); +#endif + // And update the both GUI volume elements; // return success if, and only if, intrument is fully loaded... return updateChannelVolume() && (iInstrumentStatus == 100); @@ -334,26 +396,28 @@ { if (m_pChannel == NULL) return false; - if (m_pChannel->client() == NULL) - return false; + + qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); + if (pMainForm->client() == NULL) + return false; // This only makes sense on fully loaded channels... if (m_pChannel->instrumentStatus() < 100) return false; - + // Get current channel voice count. - int iVoiceCount = ::lscp_get_channel_voice_count(m_pChannel->client(), m_pChannel->channelID()); + int iVoiceCount = ::lscp_get_channel_voice_count(pMainForm->client(), m_pChannel->channelID()); // Get current stream count. - int iStreamCount = ::lscp_get_channel_stream_count(m_pChannel->client(), m_pChannel->channelID()); + int iStreamCount = ::lscp_get_channel_stream_count(pMainForm->client(), m_pChannel->channelID()); // Get current channel buffer fill usage. // As benno has suggested this is the percentage usage // of the least filled buffer stream... - int iStreamUsage = ::lscp_get_channel_stream_usage(m_pChannel->client(), m_pChannel->channelID());; + int iStreamUsage = ::lscp_get_channel_stream_usage(pMainForm->client(), m_pChannel->channelID());; // Update the GUI elements... StreamUsageProgressBar->setProgress(iStreamUsage); StreamVoiceCountTextLabel->setText(QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount)); - + // We're clean. return true; } @@ -387,10 +451,17 @@ { if (m_pChannel == NULL) return; - + // We'll just show up the main form's edit menu (thru qsamplerChannel). m_pChannel->contextMenuEvent(pEvent); } +// Error count hackish accessors. +void qsamplerChannelStrip::resetErrorCount (void) +{ + m_iErrorCount = 0; +} + + // end of qsamplerChannelStrip.ui.h