本文整理汇总了C++中MainForm::client方法的典型用法代码示例。如果您正苦于以下问题:C++ MainForm::client方法的具体用法?C++ MainForm::client怎么用?C++ MainForm::client使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MainForm
的用法示例。
在下文中一共展示了MainForm::client方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getMapNames
// Instrument map name enumerator.
QStringList Instrument::getMapNames (void)
{
QStringList maps;
MainForm *pMainForm = MainForm::getInstance();
if (pMainForm == NULL)
return maps;
if (pMainForm->client() == NULL)
return maps;
#ifdef CONFIG_MIDI_INSTRUMENT
int *piMaps = ::lscp_list_midi_instrument_maps(pMainForm->client());
if (piMaps == NULL) {
if (::lscp_client_get_errno(pMainForm->client()))
pMainForm->appendMessagesClient("lscp_list_midi_instruments");
} else {
for (int iMap = 0; piMaps[iMap] >= 0; iMap++) {
const QString& sMapName = getMapName(piMaps[iMap]);
if (!sMapName.isEmpty())
maps.append(sMapName);
}
}
#endif
return maps;
}
示例2: unmapInstrument
bool Instrument::unmapInstrument (void)
{
#ifdef CONFIG_MIDI_INSTRUMENT
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
return false;
MainForm *pMainForm = MainForm::getInstance();
if (pMainForm == NULL)
return false;
if (pMainForm->client() == NULL)
return false;
lscp_midi_instrument_t instr;
instr.map = m_iMap;
instr.bank = (m_iBank & 0x0fff);
instr.prog = (m_iProg & 0x7f);
if (::lscp_unmap_midi_instrument(pMainForm->client(), &instr) != LSCP_OK) {
pMainForm->appendMessagesClient("lscp_unmap_midi_instrument");
return false;
}
return true;
#else
return false;
#endif
}
示例3: loadInstrument
// 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);
}
示例4: updateChannelUsage
// Update whole channel usage state.
bool ChannelStrip::updateChannelUsage (void)
{
if (m_pChannel == NULL)
return false;
MainForm *pMainForm = MainForm::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(
pMainForm->client(), m_pChannel->channelID());
// Get current stream count.
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(
pMainForm->client(), m_pChannel->channelID());;
// Update the GUI elements...
m_ui.StreamUsageProgressBar->setValue(iStreamUsage);
m_ui.StreamVoiceCountTextLabel->setText(
QString("%1 / %2").arg(iStreamCount).arg(iVoiceCount));
// We're clean.
return true;
}
示例5: getEffectiveMaxStreams
int Options::getEffectiveMaxStreams() {
#ifndef CONFIG_MAX_VOICES
return -1;
#else
MainForm *pMainForm = MainForm::getInstance();
if (!pMainForm || !pMainForm->client())
return -1;
return ::lscp_get_streams(pMainForm->client());
#endif // CONFIG_MAX_VOICES
}
示例6: mapInstrument
// Sync methods.
bool Instrument::mapInstrument (void)
{
#ifdef CONFIG_MIDI_INSTRUMENT
MainForm *pMainForm = MainForm::getInstance();
if (pMainForm == NULL)
return false;
if (pMainForm->client() == NULL)
return false;
if (m_iMap < 0 || m_iBank < 0 || m_iProg < 0)
return false;
lscp_midi_instrument_t instr;
instr.map = m_iMap;
instr.bank = (m_iBank & 0x0fff);
instr.prog = (m_iProg & 0x7f);
lscp_load_mode_t load_mode;
switch (m_iLoadMode) {
case 3:
load_mode = LSCP_LOAD_PERSISTENT;
break;
case 2:
load_mode = LSCP_LOAD_ON_DEMAND_HOLD;
break;
case 1:
load_mode = LSCP_LOAD_ON_DEMAND;
break;
case 0:
default:
load_mode = LSCP_LOAD_DEFAULT;
break;
}
if (::lscp_map_midi_instrument(pMainForm->client(), &instr,
m_sEngineName.toUtf8().constData(),
qsamplerUtilities::lscpEscapePath(
m_sInstrumentFile).toUtf8().constData(),
m_iInstrumentNr, m_fVolume, load_mode,
m_sName.toUtf8().constData()) != LSCP_OK) {
pMainForm->appendMessagesClient("lscp_map_midi_instrument");
return false;
}
return true;
#else
return false;
#endif
}
示例7: openInstrumentFile
// Browse and open an instrument file.
void ChannelForm::openInstrumentFile (void)
{
MainForm *pMainForm = MainForm::getInstance();
if (pMainForm == NULL)
return;
if (pMainForm->client() == NULL)
return;
Options *pOptions = pMainForm->options();
if (pOptions == NULL)
return;
// FIXME: the instrument file filters should be restricted,
// depending on the current engine.
QString sInstrumentFile = QFileDialog::getOpenFileName(this,
QSAMPLER_TITLE ": " + tr("Instrument files"), // Caption.
pOptions->sInstrumentDir, // Start here.
tr("Instrument files") + " (*.gig *.dls)" // Filter (GIG and DLS files)
);
if (sInstrumentFile.isEmpty())
return;
m_ui.InstrumentFileComboBox->setEditText(sInstrumentFile);
updateInstrumentName();
}
示例8: setupDevice
// Show device options dialog.
void ChannelForm::setupDevice ( Device *pDevice,
Device::DeviceType deviceTypeMode,
const QString& sDriverName )
{
MainForm *pMainForm = MainForm::getInstance();
if (pMainForm == NULL)
return;
if (pMainForm->client() == NULL)
return;
// Create the device form if not already...
if (m_pDeviceForm == NULL) {
m_pDeviceForm = new DeviceForm(this, Qt::Dialog);
m_pDeviceForm->setAttribute(Qt::WA_ShowModal);
QObject::connect(m_pDeviceForm, SIGNAL(devicesChanged()),
this, SLOT(updateDevices()));
}
// Refresh the device form with selected data.
if (m_pDeviceForm) {
m_pDeviceForm->setDeviceTypeMode(deviceTypeMode);
m_pDeviceForm->refreshDevices();
m_pDeviceForm->setDevice(pDevice);
m_pDeviceForm->setDriverName(sDriverName);
m_pDeviceForm->show();
}
}
示例9: channelReset
// Reset channel method.
bool Channel::channelReset (void)
{
MainForm *pMainForm = MainForm::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;
}
示例10: setMaxStreams
void Options::setMaxStreams(int iMaxStreams) {
#ifdef CONFIG_MAX_VOICES
if (iMaxStreams < 0) return;
MainForm *pMainForm = MainForm::getInstance();
if (!pMainForm || !pMainForm->client())
return;
lscp_status_t result =
::lscp_set_streams(pMainForm->client(), iMaxStreams);
if (result != LSCP_OK) {
pMainForm->appendMessagesClient("lscp_set_streams");
return;
}
this->iMaxStreams = iMaxStreams;
#endif // CONFIG_MAX_VOICES
}
示例11: sendFineTuningSettings
void Options::sendFineTuningSettings() {
setMaxVoices(iMaxVoices);
setMaxStreams(iMaxStreams);
MainForm *pMainForm = MainForm::getInstance();
if (!pMainForm || !pMainForm->client())
return;
pMainForm->appendMessages(QObject::tr("Sent fine tuning settings."));
}
示例12: setAudioDevice
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;
}
示例13: setMidiChannel
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;
}
示例14: setMidiMap
bool Channel::setMidiMap ( int iMidiMap )
{
MainForm *pMainForm = MainForm::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;
}
示例15: setVolume
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;
}