19 |
|
|
20 |
*****************************************************************************/ |
*****************************************************************************/ |
21 |
|
|
22 |
|
#include "qsamplerAbout.h" |
23 |
#include "qsamplerDevice.h" |
#include "qsamplerDevice.h" |
24 |
|
|
|
#include <qspinbox.h> |
|
|
#include <qlineedit.h> |
|
|
|
|
25 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
26 |
#include "qsamplerDeviceForm.h" |
#include "qsamplerDeviceForm.h" |
27 |
|
|
28 |
#include "config.h" |
#include <qspinbox.h> |
29 |
|
#include <qlineedit.h> |
30 |
|
|
31 |
|
|
32 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
53 |
{ |
{ |
54 |
if (pParamInfo == NULL) |
if (pParamInfo == NULL) |
55 |
return; |
return; |
56 |
|
|
57 |
// Info structure field members. |
// Info structure field members. |
58 |
|
|
59 |
type = pParamInfo->type; |
type = pParamInfo->type; |
60 |
|
|
61 |
if (pParamInfo->description) |
if (pParamInfo->description) |
62 |
description = pParamInfo->description; |
description = pParamInfo->description; |
63 |
else |
else |
64 |
description = QString::null; |
description = QString::null; |
65 |
|
|
66 |
mandatory = (bool) pParamInfo->mandatory; |
mandatory = (bool) pParamInfo->mandatory; |
67 |
fix = (bool) pParamInfo->fix; |
fix = (bool) pParamInfo->fix; |
68 |
multiplicity = (bool) pParamInfo->multiplicity; |
multiplicity = (bool) pParamInfo->multiplicity; |
69 |
|
|
70 |
depends.clear(); |
depends.clear(); |
71 |
for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++) |
for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++) |
72 |
depends.append(pParamInfo->depends[i]); |
depends.append(pParamInfo->depends[i]); |
73 |
|
|
74 |
if (pParamInfo->defaultv) |
if (pParamInfo->defaultv) |
75 |
defaultv = pParamInfo->defaultv; |
defaultv = pParamInfo->defaultv; |
76 |
else |
else |
77 |
defaultv = QString::null; |
defaultv = QString::null; |
78 |
|
|
79 |
if (pParamInfo->range_min) |
if (pParamInfo->range_min) |
80 |
range_min = pParamInfo->range_min; |
range_min = pParamInfo->range_min; |
81 |
else |
else |
82 |
range_min = QString::null; |
range_min = QString::null; |
83 |
|
|
84 |
if (pParamInfo->range_max) |
if (pParamInfo->range_max) |
85 |
range_max = pParamInfo->range_max; |
range_max = pParamInfo->range_max; |
86 |
else |
else |
87 |
range_max = QString::null; |
range_max = QString::null; |
88 |
|
|
89 |
possibilities.clear(); |
possibilities.clear(); |
90 |
for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++) |
for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++) |
91 |
possibilities.append(pParamInfo->possibilities[i]); |
possibilities.append(pParamInfo->possibilities[i]); |
92 |
|
|
93 |
// The current parameter value. |
// The current parameter value. |
94 |
if (pszValue) |
if (pszValue) |
95 |
value = pszValue; |
value = pszValue; |
109 |
m_pMainForm = pMainForm; |
m_pMainForm = pMainForm; |
110 |
|
|
111 |
m_ports.setAutoDelete(true); |
m_ports.setAutoDelete(true); |
112 |
|
|
113 |
setDevice(deviceType, iDeviceID); |
setDevice(deviceType, iDeviceID); |
114 |
} |
} |
115 |
|
|
137 |
// Device id and type should be always set. |
// Device id and type should be always set. |
138 |
m_iDeviceID = iDeviceID; |
m_iDeviceID = iDeviceID; |
139 |
m_deviceType = deviceType; |
m_deviceType = deviceType; |
140 |
|
|
141 |
// Reset device parameters and ports anyway. |
// Reset device parameters and ports anyway. |
142 |
m_params.clear(); |
m_params.clear(); |
143 |
m_ports.clear(); |
m_ports.clear(); |
317 |
{ |
{ |
318 |
// Set proper device parameter. |
// Set proper device parameter. |
319 |
m_params[sParam.upper()].value = sValue; |
m_params[sParam.upper()].value = sValue; |
320 |
|
|
321 |
// If the device already exists, things get immediate... |
// If the device already exists, things get immediate... |
322 |
int iRefresh = 0; |
int iRefresh = 0; |
323 |
if (m_iDeviceID >= 0) { |
if (m_iDeviceID >= 0) { |
356 |
QObject::tr("Could not set device parameter value.\n\nSorry.")); |
QObject::tr("Could not set device parameter value.\n\nSorry.")); |
357 |
} |
} |
358 |
} |
} |
359 |
|
|
360 |
// Return whether we're need a view refresh. |
// Return whether we're need a view refresh. |
361 |
return (iRefresh > 0); |
return (iRefresh > 0); |
362 |
} |
} |
416 |
|
|
417 |
// Show result. |
// Show result. |
418 |
if (m_iDeviceID >= 0) { |
if (m_iDeviceID >= 0) { |
419 |
|
// Refresh our own stuff... |
420 |
|
setDevice(m_deviceType, m_iDeviceID); |
421 |
appendMessages(QObject::tr("created.")); |
appendMessages(QObject::tr("created.")); |
422 |
} else { |
} else { |
423 |
appendMessagesError(QObject::tr("Could not create device.\n\nSorry.")); |
appendMessagesError(QObject::tr("Could not create device.\n\nSorry.")); |
424 |
} |
} |
425 |
|
|
426 |
// Return whether we're a valid device... |
// Return whether we're a valid device... |
427 |
return (m_iDeviceID >= 0); |
return (m_iDeviceID >= 0); |
428 |
} |
} |
455 |
} else { |
} else { |
456 |
appendMessagesError(QObject::tr("Could not delete device.\n\nSorry.")); |
appendMessagesError(QObject::tr("Could not delete device.\n\nSorry.")); |
457 |
} |
} |
458 |
|
|
459 |
// Return whether we've done it.. |
// Return whether we've done it.. |
460 |
return (ret == LSCP_OK); |
return (ret == LSCP_OK); |
461 |
} |
} |
638 |
qsamplerDeviceType deviceType ) |
qsamplerDeviceType deviceType ) |
639 |
{ |
{ |
640 |
QStringList drivers; |
QStringList drivers; |
641 |
|
|
642 |
const char **ppszDrivers = NULL; |
const char **ppszDrivers = NULL; |
643 |
switch (deviceType) { |
switch (deviceType) { |
644 |
case qsamplerDevice::Audio: |
case qsamplerDevice::Audio: |
645 |
ppszDrivers = ::lscp_get_available_audio_drivers(pClient); |
ppszDrivers = ::lscp_list_available_audio_drivers(pClient); |
646 |
break; |
break; |
647 |
case qsamplerDevice::Midi: |
case qsamplerDevice::Midi: |
648 |
ppszDrivers = ::lscp_get_available_midi_drivers(pClient); |
ppszDrivers = ::lscp_list_available_midi_drivers(pClient); |
649 |
break; |
break; |
650 |
case qsamplerDevice::None: |
case qsamplerDevice::None: |
651 |
break; |
break; |
652 |
} |
} |
653 |
|
|
654 |
for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++) |
for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++) |
655 |
drivers.append(ppszDrivers[iDriver]); |
drivers.append(ppszDrivers[iDriver]); |
656 |
|
|
927 |
pComboItem->setEnabled(bEnabled); |
pComboItem->setEnabled(bEnabled); |
928 |
QTable::setItem(iRow, 2, pComboItem); |
QTable::setItem(iRow, 2, pComboItem); |
929 |
} else if (param.possibilities.count() > 0 && bEnabled) { |
} else if (param.possibilities.count() > 0 && bEnabled) { |
930 |
QComboTableItem *pComboItem = new QComboTableItem(this, |
QStringList opts = param.possibilities; |
931 |
param.possibilities); |
if (param.multiplicity) |
932 |
pComboItem->setCurrentItem(param.value); |
opts.prepend(tr("(none)")); |
933 |
|
QComboTableItem *pComboItem = new QComboTableItem(this, opts); |
934 |
|
if (param.value.isEmpty()) |
935 |
|
pComboItem->setCurrentItem(0); |
936 |
|
else |
937 |
|
pComboItem->setCurrentItem(param.value); |
938 |
pComboItem->setEnabled(bEnabled); |
pComboItem->setEnabled(bEnabled); |
|
// pComboItem->setEditable(bEnabled && param.multiplicity); |
|
939 |
QTable::setItem(iRow, 2, pComboItem); |
QTable::setItem(iRow, 2, pComboItem); |
940 |
} else if (param.type == LSCP_TYPE_INT && bEnabled |
} else if (param.type == LSCP_TYPE_INT && bEnabled |
941 |
&& !param.range_min.isEmpty() |
&& !param.range_min.isEmpty() |
1050 |
|
|
1051 |
|
|
1052 |
// end of qsamplerDevice.cpp |
// end of qsamplerDevice.cpp |
1053 |
|
|