// Instrument file loader. bool Channel::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (!isInstrumentFile(sInstrumentFile)) return false; if (m_iInstrumentStatus == 100 && m_sInstrumentFile == sInstrumentFile && m_iInstrumentNr == iInstrumentNr) return true; if ( ::lscp_load_instrument_non_modal( pMainForm->client(), qsamplerUtilities::lscpEscapePath( sInstrumentFile).toUtf8().constData(), iInstrumentNr, m_iChannelID ) != LSCP_OK ) { appendMessagesClient("lscp_load_instrument"); return false; } appendMessages(QObject::tr("Instrument: \"%1\" (%2).") .arg(sInstrumentFile).arg(iInstrumentNr)); return setInstrument(sInstrumentFile, iInstrumentNr); }
void Messages::setLogging ( bool bEnabled, const QString& sFilename ) { if (m_pMessagesLog) { appendMessages(tr("Logging stopped --- %1 ---") .arg(QDateTime::currentDateTime().toString())); m_pMessagesLog->close(); delete m_pMessagesLog; m_pMessagesLog = NULL; } if (bEnabled) { m_pMessagesLog = new QFile(sFilename); if (m_pMessagesLog->open(QIODevice::Text | QIODevice::Append)) { appendMessages(tr("Logging started --- %1 ---") .arg(QDateTime::currentDateTime().toString())); } else { delete m_pMessagesLog; m_pMessagesLog = NULL; } } }
// Reset channel method. bool qsamplerChannel::channelReset (void) { if (client() == NULL || m_iChannelID < 0) return false; if (::lscp_reset_channel(client(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_reset_channel"); return false; } appendMessages(QObject::tr("reset.")); return true; }
// Channel setup dialog form. bool qsamplerChannel::channelSetup ( QWidget *pParent ) { bool bResult = false; appendMessages(QObject::tr("setup...")); qsamplerChannelForm *pChannelForm = new qsamplerChannelForm(pParent); if (pChannelForm) { pChannelForm->setup(this); bResult = pChannelForm->exec(); delete pChannelForm; } return bResult; }
bool qsamplerChannel::loadEngine ( const QString& sEngineName ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName) return true; if (::lscp_load_engine(client(), sEngineName.latin1(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_load_engine"); return false; } appendMessages(QObject::tr("Engine: %1.").arg(sEngineName)); m_sEngineName = sEngineName; return true; }
// Reset channel method. bool qsamplerChannel::channelReset (void) { qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (::lscp_reset_channel(pMainForm->client(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_reset_channel"); return false; } appendMessages(QObject::tr("reset.")); return true; }
void ValgrindPart::receivedString( const QString& str ) { QString rmsg = lastPiece + str; QStringList lines = QStringList::split( "\n", rmsg ); // kdDebug() << "got: " << QString::fromLocal8Bit( msg, len ) << endl; if ( !rmsg.endsWith( "\n" ) ) { // the last message is trucated, we'll receive // the rest in the next call lastPiece = lines.back(); lines.pop_back(); } else { lastPiece = QString::null; } appendMessages( lines ); }
bool qsamplerChannel::setVolume ( float fVolume ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_fVolume == fVolume) return true; if (::lscp_set_channel_volume(client(), m_iChannelID, fVolume) != LSCP_OK) { appendMessagesClient("lscp_set_channel_volume"); return false; } appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); m_fVolume = fVolume; return true; }
bool qsamplerChannel::setAudioDriver ( const QString& sAudioDriver ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver) return true; if (::lscp_set_channel_audio_type(client(), m_iChannelID, sAudioDriver.latin1()) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_type"); return false; } appendMessages(QObject::tr("Audio driver: %1.").arg(sAudioDriver)); m_sAudioDriver = sAudioDriver; return true; }
bool qsamplerChannel::setAudioDevice ( int iAudioDevice ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iAudioDevice == iAudioDevice) return true; if (::lscp_set_channel_audio_device(client(), m_iChannelID, iAudioDevice) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_device"); return false; } appendMessages(QObject::tr("Audio device: %1.").arg(iAudioDevice)); m_iAudioDevice = iAudioDevice; return true; }
bool qsamplerChannel::setMidiChannel ( int iMidiChannel ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iMidiChannel == iMidiChannel) return true; if (::lscp_set_channel_midi_channel(client(), m_iChannelID, iMidiChannel) != LSCP_OK) { appendMessagesClient("lscp_set_channel_midi_channel"); return false; } appendMessages(QObject::tr("MIDI channel: %1.").arg(iMidiChannel)); m_iMidiChannel = iMidiChannel; return true; }
// Create a new sampler channel, if not already. bool qsamplerChannel::addChannel (void) { if (client() == NULL) return false; // Are we a new channel? if (m_iChannelID < 0) { m_iChannelID = ::lscp_add_channel(client()); if (m_iChannelID < 0) { appendMessagesClient("lscp_add_channel"); appendMessagesError(QObject::tr("Could not add channel.\n\nSorry.")); } // Otherwise it's created... else appendMessages(QObject::tr("added.")); } // Return whether we're a valid channel... return (m_iChannelID >= 0); }
// Channel setup dialog form. bool Channel::channelSetup ( QWidget *pParent ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; bool bResult = false; appendMessages(QObject::tr("setup...")); ChannelForm *pChannelForm = new ChannelForm(pParent); if (pChannelForm) { pChannelForm->setup(this); bResult = pChannelForm->exec(); delete pChannelForm; } return bResult; }
bool qsamplerChannel::setChannelMute ( bool bMute ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && ((m_bMute && bMute) || (!m_bMute && !bMute))) return true; #ifdef CONFIG_MUTE_SOLO if (::lscp_set_channel_mute(client(), m_iChannelID, bMute) != LSCP_OK) { appendMessagesClient("lscp_set_channel_mute"); return false; } appendMessages(QObject::tr("Mute: %1.").arg((int) bMute)); m_bMute = bMute; return true; #else return false; #endif }
// Instrument file loader. bool qsamplerChannel::loadInstrument ( const QString& sInstrumentFile, int iInstrumentNr ) { if (client() == NULL || m_iChannelID < 0) return false; if (!isInstrumentFile(sInstrumentFile)) return false; if (m_iInstrumentStatus == 100 && m_sInstrumentFile == sInstrumentFile && m_iInstrumentNr == iInstrumentNr) return true; if (::lscp_load_instrument_non_modal(client(), sInstrumentFile.latin1(), iInstrumentNr, m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_load_instrument"); return false; } appendMessages(QObject::tr("Instrument: \"%1\" (%2).") .arg(sInstrumentFile).arg(iInstrumentNr)); return setInstrument(sInstrumentFile, iInstrumentNr); }
bool qsamplerChannel::setChannelSolo ( bool bSolo ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && ((m_bSolo && bSolo) || (!m_bSolo && !bSolo))) return true; #ifdef CONFIG_MUTE_SOLO if (::lscp_set_channel_solo(client(), m_iChannelID, bSolo) != LSCP_OK) { appendMessagesClient("lscp_set_channel_solo"); return false; } appendMessages(QObject::tr("Solo: %1.").arg((int) bSolo)); m_bSolo = bSolo; return true; #else return false; #endif }
bool Channel::setAudioDevice ( int iAudioDevice ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iAudioDevice == iAudioDevice) return true; if (::lscp_set_channel_audio_device(pMainForm->client(), m_iChannelID, iAudioDevice) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_device"); return false; } appendMessages(QObject::tr("Audio device: %1.").arg(iAudioDevice)); m_iAudioDevice = iAudioDevice; return true; }
bool Channel::setVolume ( float fVolume ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_fVolume == fVolume) return true; if (::lscp_set_channel_volume(pMainForm->client(), m_iChannelID, fVolume) != LSCP_OK) { appendMessagesClient("lscp_set_channel_volume"); return false; } appendMessages(QObject::tr("Volume: %1.").arg(fVolume)); m_fVolume = fVolume; return true; }
bool qsamplerChannel::setAudioChannel ( int iAudioOut, int iAudioIn ) { if (client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_audioRouting[iAudioOut] == iAudioIn) return true; if (::lscp_set_channel_audio_channel(client(), m_iChannelID, iAudioOut, iAudioIn) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_channel"); return false; } appendMessages(QObject::tr("Audio Channel: %1 -> %2.") .arg(iAudioOut).arg(iAudioIn)); m_audioRouting[iAudioOut] = iAudioIn; return true; }
bool Channel::setMidiChannel ( int iMidiChannel ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iMidiChannel == iMidiChannel) return true; if (::lscp_set_channel_midi_channel(pMainForm->client(), m_iChannelID, iMidiChannel) != LSCP_OK) { appendMessagesClient("lscp_set_channel_midi_channel"); return false; } appendMessages(QObject::tr("MIDI channel: %1.").arg(iMidiChannel)); m_iMidiChannel = iMidiChannel; return true; }
// Remove sampler channel. bool qsamplerChannel::removeChannel (void) { if (client() == NULL) return false; // Are we an existing channel? if (m_iChannelID >= 0) { if (::lscp_remove_channel(client(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_remove_channel"); appendMessagesError(QObject::tr("Could not remove channel.\n\nSorry.")); } else { // Otherwise it's removed. appendMessages(QObject::tr("removed.")); m_iChannelID = -1; } } // Return whether we've removed the channel... return (m_iChannelID < 0); }
bool qsamplerChannel::setMidiMap ( int iMidiMap ) { qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iMidiMap == iMidiMap) return true; #ifdef CONFIG_MIDI_INSTRUMENT if (::lscp_set_channel_midi_map(pMainForm->client(), m_iChannelID, iMidiMap) != LSCP_OK) { appendMessagesClient("lscp_set_channel_midi_map"); return false; } #endif appendMessages(QObject::tr("MIDI map: %1.").arg(iMidiMap)); m_iMidiMap = iMidiMap; return true; }
bool qsamplerChannel::setMidiDriver ( const QString& sMidiDriver ) { qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_sMidiDriver == sMidiDriver) return true; if (::lscp_set_channel_midi_type(pMainForm->client(), m_iChannelID, sMidiDriver.latin1()) != LSCP_OK) { appendMessagesClient("lscp_set_channel_midi_type"); return false; } appendMessages(QObject::tr("MIDI driver: %1.").arg(sMidiDriver)); m_sMidiDriver = sMidiDriver; return true; }
bool qsamplerChannel::setMidiPort ( int iMidiPort ) { qsamplerMainForm *pMainForm = qsamplerMainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_iMidiPort == iMidiPort) return true; if (::lscp_set_channel_midi_port(pMainForm->client(), m_iChannelID, iMidiPort) != LSCP_OK) { appendMessagesClient("lscp_set_channel_midi_port"); return false; } appendMessages(QObject::tr("MIDI port: %1.").arg(iMidiPort)); m_iMidiPort = iMidiPort; return true; }
bool Channel::loadEngine ( const QString& sEngineName ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_sEngineName == sEngineName) return true; if (::lscp_load_engine(pMainForm->client(), sEngineName.toUtf8().constData(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_load_engine"); return false; } appendMessages(QObject::tr("Engine: %1.").arg(sEngineName)); m_sEngineName = sEngineName; return true; }
bool Channel::setAudioDriver ( const QString& sAudioDriver ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_sAudioDriver == sAudioDriver) return true; if (::lscp_set_channel_audio_type(pMainForm->client(), m_iChannelID, sAudioDriver.toUtf8().constData()) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_type"); return false; } appendMessages(QObject::tr("Audio driver: %1.").arg(sAudioDriver)); m_sAudioDriver = sAudioDriver; return true; }
// Spawn instrument editor method. bool Channel::editChannel (void) { #ifdef CONFIG_EDIT_INSTRUMENT MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (::lscp_edit_channel_instrument(pMainForm->client(), m_iChannelID) != LSCP_OK) { appendMessagesClient("lscp_edit_channel_instrument"); appendMessagesError(QObject::tr( "Could not launch an appropriate instrument editor " "for the given instrument!\n\n" "Make sure you have an appropriate " "instrument editor like 'gigedit' installed " "and that it placed its mandatory DLL file " "into the sampler's plugin directory.") ); return false; } appendMessages(QObject::tr("edit instrument.")); return true; #else appendMessagesError(QObject::tr( "Sorry, QSampler was compiled for a version of liblscp " "which lacks this feature.\n\n" "You may want to update liblscp and recompile QSampler afterwards.") ); return false; #endif }
bool Channel::setAudioChannel ( int iAudioOut, int iAudioIn ) { MainForm *pMainForm = MainForm::getInstance(); if (pMainForm == NULL) return false; if (pMainForm->client() == NULL || m_iChannelID < 0) return false; if (m_iInstrumentStatus == 100 && m_audioRouting[iAudioOut] == iAudioIn) return true; if (::lscp_set_channel_audio_channel(pMainForm->client(), m_iChannelID, iAudioOut, iAudioIn) != LSCP_OK) { appendMessagesClient("lscp_set_channel_audio_channel"); return false; } appendMessages(QObject::tr("Audio Channel: %1 -> %2.") .arg(iAudioOut).arg(iAudioIn)); m_audioRouting[iAudioOut] = iAudioIn; return true; }
void LogMessagesViewer::onTimer( wxTimerEvent& event ) { appendMessages(); }
void MailModelManager::replaceMessages (const QList<Message_ptr>& messages) { clear (); appendMessages (messages); }