OSDN Git Service

[OSD][SOUND][WIP] QT_MULTIMEDIA: Now enabling sound, but not enabled.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 21 Sep 2022 02:47:17 +0000 (11:47 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 21 Sep 2022 02:47:17 +0000 (11:47 +0900)
source/src/qt/osd_base.cpp
source/src/qt/osd_sound.cpp
source/src/qt/osd_sound_mod_qtmultimedia.cpp
source/src/qt/osd_sound_mod_template.cpp

index 535572c..4d8a468 100644 (file)
@@ -54,29 +54,19 @@ OSD_BASE::OSD_BASE(std::shared_ptr<USING_FLAGS> p, std::shared_ptr<CSP_Logger> l
 {
        using_flags = p;
        locked_vm = false;
-       #if 1  /* Note: Below are new sound driver. */
-       m_sound_driver.reset(
-               new SOUND_OUTPUT_MODULE::M_QT_MULTIMEDIA(this,
-                                                                                                nullptr,
-                                                                                                48000,
-                                                                                                100,
-                                                                                                2,
-                                                                                                nullptr,
-                                                                                                0));
-       #else /* Note: */
+       #if 0  /* Note: Below are new sound driver. */
                #if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
        m_audioOutputDevice = QMediaDevices::defaultAudioOutput();
        m_audioInputDevice  = QMediaDevices::defaultAudioInput();
        //m_audioOutputSink = std::shared_ptr<QAudioSink>(new QAudioSink(m_audioOutputDevice, m_audioOutputDevice.preferredFormat()));
        m_audioOutputSink.reset(new QAudioSink(m_audioOutputDevice, m_audioOutputDevice.preferredFormat()));
-       m_audioInputSource.reset();
                #elif QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
        m_audioOutputDevice = QAudioDeviceInfo::defaultOutputDevice();
        m_audioInputDevice  = QAudioDeviceInfo::defaultInputDevice();
 
        m_audioOutputSink.reset(new QAudioOutput(m_audioOutputDevice, m_audioOutputDevice.preferredFormat()));
-       m_audioInputSource.reset();
                #endif
+       m_audioInputSource.reset();
        //m_audioOutputSink->moveToThread(this->thread());
        m_audioOutput = nullptr;
        m_audioInput = nullptr;
@@ -97,6 +87,17 @@ OSD_BASE::OSD_BASE(std::shared_ptr<USING_FLAGS> p, std::shared_ptr<CSP_Logger> l
        is_glcontext_shared = false;
        glContext = NULL;
 
+       #if 1  /* Note: Below are new sound driver. */
+       m_sound_driver.reset(
+               new SOUND_OUTPUT_MODULE::M_QT_MULTIMEDIA(this,
+                                                                                                nullptr,
+                                                                                                48000,
+                                                                                                100,
+                                                                                                2,
+                                                                                                nullptr,
+                                                                                                0));
+
+       #endif  /* END Note: */
        get_sound_device_list();
 }
 
index 534ceb5..44b7f5b 100644 (file)
@@ -451,6 +451,7 @@ void OSD_BASE::release_sound()
 #else
        #if 1 /* Note: Below are new sound driver. */
        #include "./osd_sound_mod_template.h"
+//#include "./osd_sound_mod_qtmultimedia.h"
 void OSD_BASE::update_sound(int* extra_frames)
 {
        *extra_frames = 0;
index ed402f0..83c181c 100644 (file)
@@ -175,7 +175,7 @@ bool M_QT_MULTIMEDIA::initialize_driver()
        }
        m_fileio.reset(new SOUND_BUFFER_QT(m_samples * (qint64)m_channels * sizeof(int16_t) * 4));
        m_driver_fileio = m_fileio;
-       
+       debug_log(_T("M_QT_MULTIMEDIA::%s status=%s"), __func__ , (m_config_ok) ? _T("OK") : _T("NG"));
        return result;
 }
 
@@ -215,6 +215,8 @@ const std::string M_QT_MULTIMEDIA::set_device_sound(const _TCHAR* driver_name, i
 #endif
                }
        }
+       debug_log(_T("M_QT_MULTIMEDIA::%s desired_driver=%s using=%s"), __func__ , driver_name, dest_device.description().toLocal8Bit().constData());
+       
        bool req_reinit = false;
        if(dest_device != m_audioOutputDevice) {
                req_reinit = true;
@@ -253,6 +255,7 @@ const std::string M_QT_MULTIMEDIA::set_device_sound(const _TCHAR* driver_name, i
                #endif
                        m_device_name = _tmpname.toLocal8Bit().toStdString();
                        m_config_ok = true;
+                       req_restart = true;
                } else {
                        m_device_name.clear();
                        m_config_ok = false;
index 189bb4f..27510ca 100644 (file)
@@ -50,6 +50,7 @@ M_BASE::M_BASE(OSD_BASE *parent,
        
        m_loglevel = CSP_LOG_INFO;
        m_logdomain = CSP_LOG_TYPE_SOUND;
+       debug_log(_T("%s: Initializing"));
        
        initialize_driver();
 }