Move AudioDeviceInfo singleton

pull/2038/head
mxi-box 2024-03-30 14:24:05 +08:00
rodzic ce3e78322b
commit 556cc8ad45
4 zmienionych plików z 12 dodań i 12 usunięć

Wyświetl plik

@ -174,7 +174,7 @@ void FCDProInput::closeDevice()
bool FCDProInput::openFCDAudio(const char* cardname)
{
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
const QList<AudioDeviceInfo>& audioList = audioDeviceManager->getInputDevices();
const QList<AudioDeviceInfo>& audioList = AudioDeviceInfo::availableInputDevices();
for (const auto &itAudio : audioList)
{

Wyświetl plik

@ -176,7 +176,7 @@ void FCDProPlusInput::closeDevice()
bool FCDProPlusInput::openFCDAudio(const char* cardname)
{
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
const QList<AudioDeviceInfo>& audioList = audioDeviceManager->getInputDevices();
const QList<AudioDeviceInfo>& audioList = AudioDeviceInfo::availableInputDevices();
for (const auto &itAudio : audioList)
{

Wyświetl plik

@ -73,28 +73,28 @@ QString AudioDeviceInfo::realm() const
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableInputDevices()
{
if (!m_inputDevicesEnumerated) {
if (!inputDevicesEnumerated) {
QList<QAudioDevice> devInfos = QMediaDevices::audioInputs();
for (auto devInfo : devInfos) {
m_inputDevices.append(AudioDeviceInfo(devInfo));
inputDevices.append(AudioDeviceInfo(devInfo));
}
m_inputDevicesEnumerated = true;
inputDevicesEnumerated = true;
}
return m_inputDevices;
return inputDevices;
}
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableOutputDevices()
{
if (!m_outputDevicesEnumerated) {
if (!outputDevicesEnumerated) {
QList<QAudioDevice> devInfos = QMediaDevices::audioOutputs();
for (auto devInfo : devInfos) {
m_outputDevices.append(AudioDeviceInfo(devInfo));
outputDevices.append(AudioDeviceInfo(devInfo));
}
m_outputDevicesEnumerated = true;
outputDevicesEnumerated = true;
}
return m_outputDevices;
return outputDevices;
}
#else
const QList<AudioDeviceInfo> &AudioDeviceInfo::availableInputDevices()

Wyświetl plik

@ -454,8 +454,8 @@ int WebAPIAdapter::instanceAudioGet(
{
(void) error;
DSPEngine *dspEngine = DSPEngine::instance();
const QList<AudioDeviceInfo>& audioInputDevices = dspEngine->getAudioDeviceManager()->getInputDevices();
const QList<AudioDeviceInfo>& audioOutputDevices = dspEngine->getAudioDeviceManager()->getOutputDevices();
const QList<AudioDeviceInfo>& audioInputDevices = AudioDeviceInfo::availableInputDevices();
const QList<AudioDeviceInfo>& audioOutputDevices = AudioDeviceInfo::availableOutputDevices();
int nbInputDevices = audioInputDevices.size();
int nbOutputDevices = audioOutputDevices.size();