598 |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
if (::lscp_client_query(m_pClient, sCommand.latin1()) != LSCP_OK) { |
599 |
appendMessagesClient("lscp_client_query"); |
appendMessagesClient("lscp_client_query"); |
600 |
iErrors++; |
iErrors++; |
|
break; |
|
601 |
} |
} |
602 |
} |
} |
603 |
// Try to make it snappy :) |
// Try to make it snappy :) |
607 |
// Ok. we've read it. |
// Ok. we've read it. |
608 |
file.close(); |
file.close(); |
609 |
|
|
|
// Have we any errors? |
|
|
if (iErrors > 0) |
|
|
appendMessagesError(tr("Session could not be loaded\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
|
|
|
|
610 |
// Now we'll try to create (update) the whole GUI session. |
// Now we'll try to create (update) the whole GUI session. |
611 |
updateSession(); |
updateSession(); |
612 |
|
|
613 |
|
// Have we any errors? |
614 |
|
if (iErrors > 0) |
615 |
|
appendMessagesError(tr("Session loaded with errors\nfrom \"%1\".\n\nSorry.").arg(sFilename)); |
616 |
|
|
617 |
// Save as default session directory. |
// Save as default session directory. |
618 |
if (m_pOptions) |
if (m_pOptions) |
619 |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
m_pOptions->sSessionDir = QFileInfo(sFilename).dirPath(true); |
620 |
// We're not dirty anymore. |
// We're not dirty anymore, if loaded without errors, |
621 |
m_iDirtyCount = 0; |
m_iDirtyCount = iErrors; |
622 |
// Stabilize form... |
// Stabilize form... |
623 |
m_sFilename = sFilename; |
m_sFilename = sFilename; |
624 |
updateRecentFiles(sFilename); |
updateRecentFiles(sFilename); |
665 |
QMap<int, int> audioDeviceMap; |
QMap<int, int> audioDeviceMap; |
666 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Audio); |
667 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
|
668 |
ts << endl; |
ts << endl; |
669 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
qsamplerDevice device(m_pClient, qsamplerDevice::Audio, piDeviceIDs[iDevice]); |
670 |
|
// Audio device specification... |
671 |
|
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
672 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
673 |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
ts << "CREATE AUDIO_OUTPUT_DEVICE " << device.driverName(); |
674 |
const qsamplerDeviceParamMap& params = device.params(); |
qsamplerDeviceParamMap::ConstIterator deviceParam; |
675 |
qsamplerDeviceParamMap::ConstIterator iter; |
for (deviceParam = device.params().begin(); |
676 |
for (iter = params.begin(); iter != params.end(); ++iter) |
deviceParam != device.params().end(); |
677 |
ts << " " << iter.key() << "='" << iter.data().value << "'"; |
++deviceParam) { |
678 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
679 |
|
if (param.value.isEmpty()) ts << "# "; |
680 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
681 |
|
} |
682 |
ts << endl; |
ts << endl; |
683 |
|
// Audio channel parameters... |
684 |
|
int iPort = 0; |
685 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
686 |
|
pPort; |
687 |
|
pPort = device.ports().next(), ++iPort) { |
688 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
689 |
|
for (portParam = pPort->params().begin(); |
690 |
|
portParam != pPort->params().end(); |
691 |
|
++portParam) { |
692 |
|
const qsamplerDeviceParam& param = portParam.data(); |
693 |
|
if (param.fix || param.value.isEmpty()) ts << "# "; |
694 |
|
ts << "SET AUDIO_OUTPUT_CHANNEL_PARAMETER " << iDevice |
695 |
|
<< " " << iPort << " " << portParam.key() |
696 |
|
<< "='" << param.value << "'" << endl; |
697 |
|
} |
698 |
|
} |
699 |
|
// Audio device index/id mapping. |
700 |
audioDeviceMap[device.deviceID()] = iDevice; |
audioDeviceMap[device.deviceID()] = iDevice; |
701 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
702 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
705 |
QMap<int, int> midiDeviceMap; |
QMap<int, int> midiDeviceMap; |
706 |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
piDeviceIDs = qsamplerDevice::getDevices(m_pClient, qsamplerDevice::Midi); |
707 |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
for (iDevice = 0; piDeviceIDs && piDeviceIDs[iDevice] >= 0; iDevice++) { |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
|
708 |
ts << endl; |
ts << endl; |
709 |
|
qsamplerDevice device(m_pClient, qsamplerDevice::Midi, piDeviceIDs[iDevice]); |
710 |
|
// MIDI device specification... |
711 |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
ts << "# " << device.deviceTypeName() << " " << device.driverName() |
712 |
<< " " << tr("Device") << " " << iDevice << endl; |
<< " " << tr("Device") << " " << iDevice << endl; |
713 |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
ts << "CREATE MIDI_INPUT_DEVICE " << device.driverName(); |
714 |
const qsamplerDeviceParamMap& params = device.params(); |
qsamplerDeviceParamMap::ConstIterator deviceParam; |
715 |
qsamplerDeviceParamMap::ConstIterator iter; |
for (deviceParam = device.params().begin(); |
716 |
for (iter = params.begin(); iter != params.end(); ++iter) |
deviceParam != device.params().end(); |
717 |
ts << " " << iter.key() << "='" << iter.data().value << "'"; |
++deviceParam) { |
718 |
|
const qsamplerDeviceParam& param = deviceParam.data(); |
719 |
|
if (param.value.isEmpty()) ts << "# "; |
720 |
|
ts << " " << deviceParam.key() << "='" << param.value << "'"; |
721 |
|
} |
722 |
ts << endl; |
ts << endl; |
723 |
|
// MIDI port parameters... |
724 |
|
int iPort = 0; |
725 |
|
for (qsamplerDevicePort *pPort = device.ports().first(); |
726 |
|
pPort; |
727 |
|
pPort = device.ports().next(), ++iPort) { |
728 |
|
qsamplerDeviceParamMap::ConstIterator portParam; |
729 |
|
for (portParam = pPort->params().begin(); |
730 |
|
portParam != pPort->params().end(); |
731 |
|
++portParam) { |
732 |
|
const qsamplerDeviceParam& param = portParam.data(); |
733 |
|
if (param.fix || param.value.isEmpty()) ts << "# "; |
734 |
|
ts << "SET MIDI_INPUT_PORT_PARAMETER " << iDevice |
735 |
|
<< " " << iPort << " " << portParam.key() |
736 |
|
<< "='" << param.value << "'" << endl; |
737 |
|
} |
738 |
|
} |
739 |
|
// MIDI device index/id mapping. |
740 |
midiDeviceMap[device.deviceID()] = iDevice; |
midiDeviceMap[device.deviceID()] = iDevice; |
741 |
// Try to keep it snappy :) |
// Try to keep it snappy :) |
742 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1406 |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
QApplication::eventLoop()->processEvents(QEventLoop::ExcludeUserInput); |
1407 |
} |
} |
1408 |
m_pWorkspace->setUpdatesEnabled(true); |
m_pWorkspace->setUpdatesEnabled(true); |
1409 |
|
|
1410 |
|
// Remember to refresh devices |
1411 |
|
if (m_pDeviceForm) |
1412 |
|
m_pDeviceForm->refreshDevices(); |
1413 |
} |
} |
1414 |
|
|
1415 |
|
|