/[svn]/qsampler/trunk/src/qsamplerOptions.cpp
ViewVC logotype

Annotation of /qsampler/trunk/src/qsamplerOptions.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3038 - (hide annotations) (download)
Thu Nov 10 16:23:30 2016 UTC (7 years, 5 months ago) by capela
File size: 18153 byte(s)
- This is it! CONFIG_BUILD_VERSION (having git commit sha1/6) has landed.
1 capela 106 // qsamplerOptions.cpp
2     //
3     /****************************************************************************
4 capela 3014 Copyright (C) 2004-2016, rncbc aka Rui Nuno Capela. All rights reserved.
5 capela 2718 Copyright (C) 2007,2015 Christian Schoenebeck
6 capela 106
7     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License
9     as published by the Free Software Foundation; either version 2
10     of the License, or (at your option) any later version.
11    
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     GNU General Public License for more details.
16    
17 capela 920 You should have received a copy of the GNU General Public License along
18     with this program; if not, write to the Free Software Foundation, Inc.,
19     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 capela 106
21     *****************************************************************************/
22    
23 capela 753 #include "qsamplerAbout.h"
24 capela 106 #include "qsamplerOptions.h"
25 schoenebeck 1803 #include "qsamplerMainForm.h"
26 capela 106
27 capela 1499 #include <QTextStream>
28     #include <QComboBox>
29 capela 106
30 capela 264 #include <lscp/client.h>
31 capela 106
32 capela 605 #ifdef CONFIG_LIBGIG
33     #include <gig.h>
34     #endif
35 capela 106
36 capela 605
37 capela 1558 namespace QSampler {
38    
39 capela 106 //-------------------------------------------------------------------------
40 capela 1558 // QSampler::Options - Prototype settings structure.
41 capela 106 //
42    
43     // Constructor.
44 capela 1558 Options::Options (void)
45 capela 1504 : m_settings(QSAMPLER_DOMAIN, QSAMPLER_TITLE)
46 capela 106 {
47 capela 2028 loadOptions();
48     }
49    
50    
51     // Default Destructor.
52     Options::~Options (void)
53     {
54     saveOptions();
55     }
56    
57    
58     // Explicit load method.
59     void Options::loadOptions (void)
60     {
61 capela 1509 // Begin into general options group.
62     m_settings.beginGroup("/Options");
63 capela 106
64 capela 1509 // Load server options...
65     m_settings.beginGroup("/Server");
66     sServerHost = m_settings.value("/ServerHost", "localhost").toString();
67     iServerPort = m_settings.value("/ServerPort", 8888).toInt();
68 capela 2642 #if defined(__APPLE__) // Toshi Nagata 20080105
69 nagata 1643 // TODO: Should this be a configure option?
70     iServerTimeout = m_settings.value("/ServerTimeout", 10000).toInt();
71 capela 2642 #else
72 capela 1509 iServerTimeout = m_settings.value("/ServerTimeout", 1000).toInt();
73 capela 2642 #endif
74 capela 1509 bServerStart = m_settings.value("/ServerStart", true).toBool();
75 schoenebeck 2712 #if defined(__APPLE__)
76     sServerCmdLine = m_settings.value("/ServerCmdLine", "/usr/local/bin/linuxsampler").toString();
77 capela 2642 #else
78 capela 1509 sServerCmdLine = m_settings.value("/ServerCmdLine", "linuxsampler").toString();
79 capela 2642 #endif
80 capela 1509 iStartDelay = m_settings.value("/StartDelay", 3).toInt();
81     m_settings.endGroup();
82 capela 106
83 capela 1738 // Load logging options...
84     m_settings.beginGroup("/Logging");
85     bMessagesLog = m_settings.value("/MessagesLog", false).toBool();
86     sMessagesLogPath = m_settings.value("/MessagesLogPath", "qsampler.log").toString();
87     m_settings.endGroup();
88    
89 capela 1509 // Load display options...
90     m_settings.beginGroup("/Display");
91     sDisplayFont = m_settings.value("/DisplayFont").toString();
92     bDisplayEffect = m_settings.value("/DisplayEffect", true).toBool();
93     bAutoRefresh = m_settings.value("/AutoRefresh", true).toBool();
94     iAutoRefreshTime = m_settings.value("/AutoRefreshTime", 1000).toInt();
95     iMaxVolume = m_settings.value("/MaxVolume", 100).toInt();
96     sMessagesFont = m_settings.value("/MessagesFont").toString();
97     bMessagesLimit = m_settings.value("/MessagesLimit", true).toBool();
98     iMessagesLimitLines = m_settings.value("/MessagesLimitLines", 1000).toInt();
99     bConfirmRemove = m_settings.value("/ConfirmRemove", true).toBool();
100 capela 2722 bConfirmReset = m_settings.value("/ConfirmReset", true).toBool();
101     bConfirmRestart = m_settings.value("/ConfirmRestart", true).toBool();
102     bConfirmError = m_settings.value("/ConfirmError", true).toBool();
103 capela 1509 bKeepOnTop = m_settings.value("/KeepOnTop", true).toBool();
104     bStdoutCapture = m_settings.value("/StdoutCapture", true).toBool();
105     bCompletePath = m_settings.value("/CompletePath", true).toBool();
106     iMaxRecentFiles = m_settings.value("/MaxRecentFiles", 5).toInt();
107 capela 1749 iBaseFontSize = m_settings.value("/BaseFontSize", 0).toInt();
108 schoenebeck 1527 // if libgig provides a fast way to retrieve instrument names even for large
109     // .gig files, then we enable this feature by default
110 capela 2646 #ifdef CONFIG_LIBGIG_SETAUTOLOAD
111 schoenebeck 1527 bInstrumentNames = m_settings.value("/InstrumentNames", true).toBool();
112     #else
113 capela 1509 bInstrumentNames = m_settings.value("/InstrumentNames", false).toBool();
114 schoenebeck 1527 #endif
115 capela 1509 m_settings.endGroup();
116 capela 106
117 capela 1509 // And go into view options group.
118     m_settings.beginGroup("/View");
119     bMenubar = m_settings.value("/Menubar", true).toBool();
120     bToolbar = m_settings.value("/Toolbar", true).toBool();
121     bStatusbar = m_settings.value("/Statusbar", true).toBool();
122     bAutoArrange = m_settings.value("/AutoArrange", true).toBool();
123     m_settings.endGroup();
124 capela 106
125 capela 1509 m_settings.endGroup(); // Options group.
126 capela 106
127 capela 1499 // Recent file list.
128     recentFiles.clear();
129     m_settings.beginGroup("/RecentFiles");
130     for (int iFile = 0; iFile < iMaxRecentFiles; iFile++) {
131     QString sFilename = m_settings.value(
132     "/File" + QString::number(iFile + 1)).toString();
133     if (!sFilename.isEmpty())
134     recentFiles.append(sFilename);
135     }
136     m_settings.endGroup();
137 capela 106
138 schoenebeck 1803 // Sampler fine tuning settings.
139     m_settings.beginGroup("/Tuning");
140     iMaxVoices = m_settings.value("/MaxVoices", -1).toInt();
141     iMaxStreams = m_settings.value("/MaxStreams", -1).toInt();
142     m_settings.endGroup();
143    
144 capela 1509 // Last but not least, get the default directories.
145     m_settings.beginGroup("/Default");
146     sSessionDir = m_settings.value("/SessionDir").toString();
147     sInstrumentDir = m_settings.value("/InstrumentDir").toString();
148     sEngineName = m_settings.value("/EngineName").toString();
149     sAudioDriver = m_settings.value("/AudioDriver").toString();
150     sMidiDriver = m_settings.value("/MidiDriver").toString();
151     iMidiMap = m_settings.value("/MidiMap", 0).toInt();
152     iMidiBank = m_settings.value("/MidiBank", 0).toInt();
153     iMidiProg = m_settings.value("/MidiProg", 0).toInt();
154     iVolume = m_settings.value("/Volume", 100).toInt();
155     iLoadMode = m_settings.value("/Loadmode", 0).toInt();
156     m_settings.endGroup();
157 capela 106 }
158    
159    
160 capela 2028 // Explicit save method.
161     void Options::saveOptions (void)
162 capela 106 {
163 capela 1509 // Make program version available in the future.
164     m_settings.beginGroup("/Program");
165 capela 3038 m_settings.setValue("/Version", CONFIG_BUILD_VERSION);
166 capela 1509 m_settings.endGroup();
167 capela 106
168 capela 1509 // And go into general options group.
169     m_settings.beginGroup("/Options");
170 capela 106
171 capela 1509 // Save server options.
172     m_settings.beginGroup("/Server");
173     m_settings.setValue("/ServerHost", sServerHost);
174     m_settings.setValue("/ServerPort", iServerPort);
175     m_settings.setValue("/ServerTimeout", iServerTimeout);
176     m_settings.setValue("/ServerStart", bServerStart);
177     m_settings.setValue("/ServerCmdLine", sServerCmdLine);
178     m_settings.setValue("/StartDelay", iStartDelay);
179     m_settings.endGroup();
180 capela 106
181 capela 1738 // Save logging options...
182     m_settings.beginGroup("/Logging");
183     m_settings.setValue("/MessagesLog", bMessagesLog);
184     m_settings.setValue("/MessagesLogPath", sMessagesLogPath);
185     m_settings.endGroup();
186    
187 capela 1509 // Save display options.
188     m_settings.beginGroup("/Display");
189     m_settings.setValue("/DisplayFont", sDisplayFont);
190     m_settings.setValue("/DisplayEffect", bDisplayEffect);
191     m_settings.setValue("/AutoRefresh", bAutoRefresh);
192     m_settings.setValue("/AutoRefreshTime", iAutoRefreshTime);
193     m_settings.setValue("/MaxVolume", iMaxVolume);
194     m_settings.setValue("/MessagesFont", sMessagesFont);
195     m_settings.setValue("/MessagesLimit", bMessagesLimit);
196     m_settings.setValue("/MessagesLimitLines", iMessagesLimitLines);
197     m_settings.setValue("/ConfirmRemove", bConfirmRemove);
198 capela 2722 m_settings.setValue("/ConfirmReset", bConfirmReset);
199     m_settings.setValue("/ConfirmRestart", bConfirmRestart);
200     m_settings.setValue("/ConfirmError", bConfirmError);
201 capela 1509 m_settings.setValue("/KeepOnTop", bKeepOnTop);
202     m_settings.setValue("/StdoutCapture", bStdoutCapture);
203     m_settings.setValue("/CompletePath", bCompletePath);
204     m_settings.setValue("/MaxRecentFiles", iMaxRecentFiles);
205 capela 1749 m_settings.setValue("/BaseFontSize", iBaseFontSize);
206 capela 1509 m_settings.setValue("/InstrumentNames", bInstrumentNames);
207     m_settings.endGroup();
208 capela 106
209 capela 1509 // View options group.
210     m_settings.beginGroup("/View");
211     m_settings.setValue("/Menubar", bMenubar);
212     m_settings.setValue("/Toolbar", bToolbar);
213     m_settings.setValue("/Statusbar", bStatusbar);
214     m_settings.setValue("/AutoArrange", bAutoArrange);
215     m_settings.endGroup();
216 capela 106
217 capela 1509 m_settings.endGroup(); // Options group.
218 capela 106
219 capela 1509 // Recent file list.
220 capela 1499 int iFile = 0;
221     m_settings.beginGroup("/RecentFiles");
222     QStringListIterator iter(recentFiles);
223     while (iter.hasNext())
224     m_settings.setValue("/File" + QString::number(++iFile), iter.next());
225     m_settings.endGroup();
226 capela 106
227 schoenebeck 1803 // Sampler fine tuning settings.
228     m_settings.beginGroup("/Tuning");
229     if (iMaxVoices > 0)
230     m_settings.setValue("/MaxVoices", iMaxVoices);
231     if (iMaxStreams >= 0)
232     m_settings.setValue("/MaxStreams", iMaxStreams);
233     m_settings.endGroup();
234    
235 capela 1509 // Default directories.
236     m_settings.beginGroup("/Default");
237     m_settings.setValue("/SessionDir", sSessionDir);
238     m_settings.setValue("/InstrumentDir", sInstrumentDir);
239     m_settings.setValue("/EngineName", sEngineName);
240     m_settings.setValue("/AudioDriver", sAudioDriver);
241     m_settings.setValue("/MidiDriver", sMidiDriver);
242     m_settings.setValue("/MidiMap", iMidiMap);
243     m_settings.setValue("/MidiBank", iMidiBank);
244     m_settings.setValue("/MidiProg", iMidiProg);
245     m_settings.setValue("/Volume", iVolume);
246     m_settings.setValue("/Loadmode", iLoadMode);
247     m_settings.endGroup();
248 capela 2028
249     // Save/commit to disk.
250     m_settings.sync();
251 capela 106 }
252    
253 capela 2028
254 capela 106 //-------------------------------------------------------------------------
255     // Settings accessor.
256     //
257    
258 capela 1558 QSettings& Options::settings (void)
259 capela 106 {
260 capela 1509 return m_settings;
261 capela 106 }
262    
263    
264     //-------------------------------------------------------------------------
265     // Command-line argument stuff.
266     //
267    
268     // Help about command line options.
269 capela 1890 void Options::print_usage ( const QString& arg0 )
270 capela 106 {
271 capela 1499 QTextStream out(stderr);
272     out << QObject::tr("Usage: %1 [options] [session-file]\n\n"
273     QSAMPLER_TITLE " - " QSAMPLER_SUBTITLE "\n\n"
274     "Options:\n\n"
275     " -s, --start\n\tStart linuxsampler server locally\n\n"
276 capela 2642 " -h, --hostname\n\tSpecify linuxsampler server hostname (default = localhost)\n\n"
277     " -p, --port\n\tSpecify linuxsampler server port number (default = 8888)\n\n"
278 capela 1499 " -?, --help\n\tShow help about command line options\n\n"
279     " -v, --version\n\tShow version information\n\n")
280     .arg(arg0);
281 capela 106 }
282    
283    
284     // Parse command line arguments into m_settings.
285 capela 1890 bool Options::parse_args ( const QStringList& args )
286 capela 106 {
287 capela 1499 QTextStream out(stderr);
288 capela 1509 const QString sEol = "\n\n";
289     int iCmdArgs = 0;
290 capela 2642 const int argc = args.count();
291 capela 106
292 capela 1509 for (int i = 1; i < argc; i++) {
293 capela 106
294 capela 1509 if (iCmdArgs > 0) {
295     sSessionFile += " ";
296 capela 1890 sSessionFile += args.at(i);
297 capela 1509 iCmdArgs++;
298     continue;
299     }
300 capela 106
301 capela 1890 QString sArg = args.at(i);
302 capela 1509 QString sVal = QString::null;
303 capela 2642 const int iEqual = sArg.indexOf("=");
304 capela 1509 if (iEqual >= 0) {
305     sVal = sArg.right(sArg.length() - iEqual - 1);
306     sArg = sArg.left(iEqual);
307     }
308 capela 2642 else if (i < argc - 1) {
309 capela 1890 sVal = args.at(i + 1);
310 capela 2642 if (sVal[0] == '-')
311     sVal.clear();
312     }
313 capela 106
314 capela 1509 if (sArg == "-s" || sArg == "--start") {
315     bServerStart = true;
316     }
317     else if (sArg == "-h" || sArg == "--hostname") {
318     if (sVal.isNull()) {
319 capela 2642 out << QObject::tr("Option -h requires an argument (host).") + sEol;
320 capela 1509 return false;
321     }
322     sServerHost = sVal;
323     if (iEqual < 0)
324     i++;
325     }
326     else if (sArg == "-p" || sArg == "--port") {
327     if (sVal.isNull()) {
328     out << QObject::tr("Option -p requires an argument (port).") + sEol;
329     return false;
330     }
331     iServerPort = sVal.toInt();
332     if (iEqual < 0)
333     i++;
334     }
335     else if (sArg == "-?" || sArg == "--help") {
336 capela 1890 print_usage(args.at(0));
337 capela 1509 return false;
338     }
339     else if (sArg == "-v" || sArg == "--version") {
340 capela 3014 out << QObject::tr("Qt: %1\n")
341     .arg(qVersion());
342     out << QObject::tr("%1: %2 (%3)\n")
343     .arg(QSAMPLER_TITLE)
344 capela 3038 .arg(CONFIG_BUILD_VERSION)
345 capela 3014 .arg(CONFIG_BUILD_DATE);
346 capela 2642 #ifdef CONFIG_LIBGIG
347 capela 1499 out << QString("%1: %2\n")
348     .arg(gig::libraryName().c_str())
349     .arg(gig::libraryVersion().c_str());
350 capela 2642 #endif
351 capela 1499 out << QString("%1: %2\n")
352     .arg(::lscp_client_package())
353     .arg(::lscp_client_version());
354 capela 1509 return false;
355     }
356     else {
357     // If we don't have one by now,
358     // this will be the startup sesion file...
359     sSessionFile += sArg;
360     iCmdArgs++;
361     }
362     }
363 capela 106
364 capela 1509 // Alright with argument parsing.
365     return true;
366 capela 106 }
367    
368    
369     //---------------------------------------------------------------------------
370     // Widget geometry persistence helper methods.
371    
372 capela 2077 void Options::loadWidgetGeometry ( QWidget *pWidget, bool bVisible )
373 capela 106 {
374 capela 1499 // Try to restore old form window positioning.
375     if (pWidget) {
376 capela 2847 // if (bVisible) pWidget->show(); -- force initial exposure?
377 capela 1499 m_settings.beginGroup("/Geometry/" + pWidget->objectName());
378 capela 2843 #if QT_VERSION >= 0x050000
379 capela 2779 const QByteArray& geometry
380     = m_settings.value("/geometry").toByteArray();
381 capela 2843 if (!geometry.isEmpty())
382 capela 2779 pWidget->restoreGeometry(geometry);
383 capela 2843 else
384     #else//--LOAD_OLD_GEOMETRY
385     QPoint wpos;
386     QSize wsize;
387     wpos.setX(m_settings.value("/x", -1).toInt());
388     wpos.setY(m_settings.value("/y", -1).toInt());
389     wsize.setWidth(m_settings.value("/width", -1).toInt());
390     wsize.setHeight(m_settings.value("/height", -1).toInt());
391     if (wpos.x() > 0 && wpos.y() > 0)
392     pWidget->move(wpos);
393     if (wsize.width() > 0 && wsize.height() > 0)
394     pWidget->resize(wsize);
395     else
396     #endif
397     pWidget->adjustSize();
398 capela 2779 if (!bVisible)
399     bVisible = m_settings.value("/visible", false).toBool();
400 capela 1499 if (bVisible)
401     pWidget->show();
402 capela 2779 else
403     pWidget->hide();
404     m_settings.endGroup();
405 capela 1499 }
406 capela 106 }
407    
408    
409 capela 2077 void Options::saveWidgetGeometry ( QWidget *pWidget, bool bVisible )
410 capela 106 {
411 capela 1499 // Try to save form window position...
412     // (due to X11 window managers ideossincrasies, we better
413     // only save the form geometry while its up and visible)
414     if (pWidget) {
415     m_settings.beginGroup("/Geometry/" + pWidget->objectName());
416 capela 2843 #if QT_VERSION >= 0x050000
417     m_settings.setValue("/geometry", pWidget->saveGeometry());
418     #else//--SAVE_OLD_GEOMETRY
419 capela 2077 const QPoint& wpos = pWidget->pos();
420     const QSize& wsize = pWidget->size();
421     m_settings.setValue("/x", wpos.x());
422     m_settings.setValue("/y", wpos.y());
423     m_settings.setValue("/width", wsize.width());
424     m_settings.setValue("/height", wsize.height());
425 capela 2779 #endif
426     if (!bVisible) bVisible = pWidget->isVisible();
427 capela 1499 m_settings.setValue("/visible", bVisible);
428     m_settings.endGroup();
429     }
430 capela 106 }
431    
432    
433     //---------------------------------------------------------------------------
434     // Combo box history persistence helper implementation.
435    
436 capela 1558 void Options::loadComboBoxHistory ( QComboBox *pComboBox, int iLimit )
437 capela 106 {
438 capela 2723 const bool bBlockSignals = pComboBox->blockSignals(true);
439    
440 capela 1499 // Load combobox list from configuration settings file...
441     m_settings.beginGroup("/History/" + pComboBox->objectName());
442 capela 106
443 capela 1499 if (m_settings.childKeys().count() > 0) {
444     pComboBox->setUpdatesEnabled(false);
445     pComboBox->setDuplicatesEnabled(false);
446     pComboBox->clear();
447 capela 2723 for (int i = 0; i < iLimit; ++i) {
448 capela 1499 const QString& sText = m_settings.value(
449     "/Item" + QString::number(i + 1)).toString();
450     if (sText.isEmpty())
451     break;
452     pComboBox->addItem(sText);
453     }
454     pComboBox->setUpdatesEnabled(true);
455     }
456 capela 106
457 capela 1499 m_settings.endGroup();
458 capela 2723
459     pComboBox->blockSignals(bBlockSignals);
460 capela 106 }
461    
462    
463 capela 1558 void Options::saveComboBoxHistory ( QComboBox *pComboBox, int iLimit )
464 capela 106 {
465 capela 2723 const bool bBlockSignals = pComboBox->blockSignals(true);
466    
467 capela 1499 // Add current text as latest item...
468 capela 2723 const QString sCurrentText = pComboBox->currentText();
469 capela 1499 int iCount = pComboBox->count();
470     for (int i = 0; i < iCount; i++) {
471     const QString& sText = pComboBox->itemText(i);
472     if (sText == sCurrentText) {
473     pComboBox->removeItem(i);
474 capela 2723 --iCount;
475 capela 1499 break;
476     }
477     }
478     while (iCount >= iLimit)
479     pComboBox->removeItem(--iCount);
480     pComboBox->insertItem(0, sCurrentText);
481 capela 2723 pComboBox->setCurrentIndex(0);
482     ++iCount;
483 capela 106
484 capela 1499 // Save combobox list to configuration settings file...
485     m_settings.beginGroup("/History/" + pComboBox->objectName());
486 capela 2723 for (int i = 0; i < iCount; ++i) {
487 capela 1499 const QString& sText = pComboBox->itemText(i);
488     if (sText.isEmpty())
489     break;
490     m_settings.setValue("/Item" + QString::number(i + 1), sText);
491     }
492     m_settings.endGroup();
493 capela 2723
494     pComboBox->blockSignals(bBlockSignals);
495 capela 106 }
496    
497 capela 2723
498 schoenebeck 1803 int Options::getMaxVoices() {
499     #ifndef CONFIG_MAX_VOICES
500     return -1;
501     #else
502     if (iMaxVoices > 0) return iMaxVoices;
503     return getEffectiveMaxVoices();
504     #endif // CONFIG_MAX_VOICES
505     }
506    
507     int Options::getEffectiveMaxVoices() {
508     #ifndef CONFIG_MAX_VOICES
509     return -1;
510     #else
511     MainForm *pMainForm = MainForm::getInstance();
512     if (!pMainForm || !pMainForm->client())
513     return -1;
514    
515     return ::lscp_get_voices(pMainForm->client());
516     #endif // CONFIG_MAX_VOICES
517     }
518    
519     void Options::setMaxVoices(int iMaxVoices) {
520     #ifdef CONFIG_MAX_VOICES
521     if (iMaxVoices < 1) return;
522    
523     MainForm *pMainForm = MainForm::getInstance();
524     if (!pMainForm || !pMainForm->client())
525     return;
526    
527     lscp_status_t result =
528     ::lscp_set_voices(pMainForm->client(), iMaxVoices);
529    
530     if (result != LSCP_OK) {
531     pMainForm->appendMessagesClient("lscp_set_voices");
532     return;
533     }
534    
535     this->iMaxVoices = iMaxVoices;
536     #endif // CONFIG_MAX_VOICES
537     }
538    
539     int Options::getMaxStreams() {
540     #ifndef CONFIG_MAX_VOICES
541     return -1;
542     #else
543     if (iMaxStreams > 0) return iMaxStreams;
544     return getEffectiveMaxStreams();
545     #endif // CONFIG_MAX_VOICES
546     }
547    
548     int Options::getEffectiveMaxStreams() {
549     #ifndef CONFIG_MAX_VOICES
550     return -1;
551     #else
552     MainForm *pMainForm = MainForm::getInstance();
553     if (!pMainForm || !pMainForm->client())
554     return -1;
555    
556     return ::lscp_get_streams(pMainForm->client());
557     #endif // CONFIG_MAX_VOICES
558     }
559    
560     void Options::setMaxStreams(int iMaxStreams) {
561     #ifdef CONFIG_MAX_VOICES
562     if (iMaxStreams < 0) return;
563    
564     MainForm *pMainForm = MainForm::getInstance();
565     if (!pMainForm || !pMainForm->client())
566     return;
567    
568     lscp_status_t result =
569     ::lscp_set_streams(pMainForm->client(), iMaxStreams);
570    
571     if (result != LSCP_OK) {
572     pMainForm->appendMessagesClient("lscp_set_streams");
573     return;
574     }
575    
576     this->iMaxStreams = iMaxStreams;
577     #endif // CONFIG_MAX_VOICES
578     }
579    
580     void Options::sendFineTuningSettings() {
581     setMaxVoices(iMaxVoices);
582     setMaxStreams(iMaxStreams);
583    
584     MainForm *pMainForm = MainForm::getInstance();
585     if (!pMainForm || !pMainForm->client())
586     return;
587    
588     pMainForm->appendMessages(QObject::tr("Sent fine tuning settings."));
589     }
590    
591 capela 1558 } // namespace QSampler
592 capela 106
593 capela 1558
594 capela 106 // end of qsamplerOptions.cpp

  ViewVC Help
Powered by ViewVC