54 |
{ |
{ |
55 |
if (pParamInfo == NULL) |
if (pParamInfo == NULL) |
56 |
return; |
return; |
57 |
|
|
58 |
// Info structure field members. |
// Info structure field members. |
59 |
|
|
60 |
type = pParamInfo->type; |
type = pParamInfo->type; |
61 |
|
|
62 |
if (pParamInfo->description) |
if (pParamInfo->description) |
63 |
description = pParamInfo->description; |
description = pParamInfo->description; |
64 |
else |
else |
65 |
description = QString::null; |
description = QString::null; |
66 |
|
|
67 |
mandatory = (bool) pParamInfo->mandatory; |
mandatory = (bool) pParamInfo->mandatory; |
68 |
fix = (bool) pParamInfo->fix; |
fix = (bool) pParamInfo->fix; |
69 |
multiplicity = (bool) pParamInfo->multiplicity; |
multiplicity = (bool) pParamInfo->multiplicity; |
70 |
|
|
71 |
depends.clear(); |
depends.clear(); |
72 |
for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++) |
for (int i = 0; pParamInfo->depends && pParamInfo->depends[i]; i++) |
73 |
depends.append(pParamInfo->depends[i]); |
depends.append(pParamInfo->depends[i]); |
74 |
|
|
75 |
if (pParamInfo->defaultv) |
if (pParamInfo->defaultv) |
76 |
defaultv = pParamInfo->defaultv; |
defaultv = pParamInfo->defaultv; |
77 |
else |
else |
78 |
defaultv = QString::null; |
defaultv = QString::null; |
79 |
|
|
80 |
if (pParamInfo->range_min) |
if (pParamInfo->range_min) |
81 |
range_min = pParamInfo->range_min; |
range_min = pParamInfo->range_min; |
82 |
else |
else |
83 |
range_min = QString::null; |
range_min = QString::null; |
84 |
|
|
85 |
if (pParamInfo->range_max) |
if (pParamInfo->range_max) |
86 |
range_max = pParamInfo->range_max; |
range_max = pParamInfo->range_max; |
87 |
else |
else |
88 |
range_max = QString::null; |
range_max = QString::null; |
89 |
|
|
90 |
possibilities.clear(); |
possibilities.clear(); |
91 |
for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++) |
for (int i = 0; pParamInfo->possibilities && pParamInfo->possibilities[i]; i++) |
92 |
possibilities.append(pParamInfo->possibilities[i]); |
possibilities.append(pParamInfo->possibilities[i]); |
93 |
|
|
94 |
// The current parameter value. |
// The current parameter value. |
95 |
if (pszValue) |
if (pszValue) |
96 |
value = pszValue; |
value = pszValue; |
110 |
m_pMainForm = pMainForm; |
m_pMainForm = pMainForm; |
111 |
|
|
112 |
m_ports.setAutoDelete(true); |
m_ports.setAutoDelete(true); |
113 |
|
|
114 |
setDevice(deviceType, iDeviceID); |
setDevice(deviceType, iDeviceID); |
115 |
} |
} |
116 |
|
|
138 |
// Device id and type should be always set. |
// Device id and type should be always set. |
139 |
m_iDeviceID = iDeviceID; |
m_iDeviceID = iDeviceID; |
140 |
m_deviceType = deviceType; |
m_deviceType = deviceType; |
141 |
|
|
142 |
// Reset device parameters and ports anyway. |
// Reset device parameters and ports anyway. |
143 |
m_params.clear(); |
m_params.clear(); |
144 |
m_ports.clear(); |
m_ports.clear(); |
318 |
{ |
{ |
319 |
// Set proper device parameter. |
// Set proper device parameter. |
320 |
m_params[sParam.upper()].value = sValue; |
m_params[sParam.upper()].value = sValue; |
321 |
|
|
322 |
// If the device already exists, things get immediate... |
// If the device already exists, things get immediate... |
323 |
int iRefresh = 0; |
int iRefresh = 0; |
324 |
if (m_iDeviceID >= 0) { |
if (m_iDeviceID >= 0) { |
357 |
QObject::tr("Could not set device parameter value.\n\nSorry.")); |
QObject::tr("Could not set device parameter value.\n\nSorry.")); |
358 |
} |
} |
359 |
} |
} |
360 |
|
|
361 |
// Return whether we're need a view refresh. |
// Return whether we're need a view refresh. |
362 |
return (iRefresh > 0); |
return (iRefresh > 0); |
363 |
} |
} |
417 |
|
|
418 |
// Show result. |
// Show result. |
419 |
if (m_iDeviceID >= 0) { |
if (m_iDeviceID >= 0) { |
420 |
|
// Refresh our own stuff... |
421 |
|
setDevice(m_deviceType, m_iDeviceID); |
422 |
appendMessages(QObject::tr("created.")); |
appendMessages(QObject::tr("created.")); |
423 |
} else { |
} else { |
424 |
appendMessagesError(QObject::tr("Could not create device.\n\nSorry.")); |
appendMessagesError(QObject::tr("Could not create device.\n\nSorry.")); |
425 |
} |
} |
426 |
|
|
427 |
// Return whether we're a valid device... |
// Return whether we're a valid device... |
428 |
return (m_iDeviceID >= 0); |
return (m_iDeviceID >= 0); |
429 |
} |
} |
456 |
} else { |
} else { |
457 |
appendMessagesError(QObject::tr("Could not delete device.\n\nSorry.")); |
appendMessagesError(QObject::tr("Could not delete device.\n\nSorry.")); |
458 |
} |
} |
459 |
|
|
460 |
// Return whether we've done it.. |
// Return whether we've done it.. |
461 |
return (ret == LSCP_OK); |
return (ret == LSCP_OK); |
462 |
} |
} |
639 |
qsamplerDeviceType deviceType ) |
qsamplerDeviceType deviceType ) |
640 |
{ |
{ |
641 |
QStringList drivers; |
QStringList drivers; |
642 |
|
|
643 |
const char **ppszDrivers = NULL; |
const char **ppszDrivers = NULL; |
644 |
switch (deviceType) { |
switch (deviceType) { |
645 |
case qsamplerDevice::Audio: |
case qsamplerDevice::Audio: |
651 |
case qsamplerDevice::None: |
case qsamplerDevice::None: |
652 |
break; |
break; |
653 |
} |
} |
654 |
|
|
655 |
for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++) |
for (int iDriver = 0; ppszDrivers[iDriver]; iDriver++) |
656 |
drivers.append(ppszDrivers[iDriver]); |
drivers.append(ppszDrivers[iDriver]); |
657 |
|
|