mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
refs #320 Audio device handlers
This commit is contained in:
@@ -20,6 +20,8 @@ Client::Client(QObject *parent) :
|
||||
m_voice(new BlackCore::CVoiceVatlib())
|
||||
{
|
||||
m_channelCom1 = m_voice->getVoiceChannel(0);
|
||||
m_inputDevice = m_voice->createInputDevice();
|
||||
m_outputDevice = m_voice->createOutputDevice();
|
||||
|
||||
using namespace BlackCore;
|
||||
connect(m_channelCom1.data(), &IVoiceChannel::connectionStatusChanged, this, &Client::connectionStatusChanged);
|
||||
@@ -42,6 +44,11 @@ Client::Client(QObject *parent) :
|
||||
m_commands["disableloopback"] = std::bind(&Client::disableLoopbackCmd, this, _1);
|
||||
}
|
||||
|
||||
Client::~Client()
|
||||
{
|
||||
if(m_voice) m_voice->deleteLater();
|
||||
}
|
||||
|
||||
void Client::command(QString line)
|
||||
{
|
||||
QTextStream stream(&line, QIODevice::ReadOnly);
|
||||
@@ -120,7 +127,7 @@ void Client::terminateConnectionCmd(QTextStream & /** args **/)
|
||||
|
||||
void Client::inputDevicesCmd(QTextStream & /** args **/)
|
||||
{
|
||||
for(auto &device : m_voice->audioDevices().getInputDevices())
|
||||
for(const auto &device : m_inputDevice->getInputDevices())
|
||||
{
|
||||
std::cout << device.getName().toStdString() << std::endl;
|
||||
}
|
||||
@@ -132,7 +139,7 @@ void Client::inputDevicesCmd(QTextStream & /** args **/)
|
||||
*/
|
||||
void Client::outputDevicesCmd(QTextStream & /** args **/)
|
||||
{
|
||||
for(auto &device : m_voice->audioDevices().getOutputDevices())
|
||||
for(const auto &device : m_outputDevice->getOutputDevices())
|
||||
{
|
||||
std::cout << device.getName().toStdString() << std::endl;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class Client : public QObject
|
||||
|
||||
public:
|
||||
Client(QObject *parent = nullptr);
|
||||
~Client() { if(m_voice) m_voice->deleteLater(); }
|
||||
~Client();
|
||||
|
||||
signals:
|
||||
void quit();
|
||||
@@ -56,6 +56,8 @@ private slots:
|
||||
private:
|
||||
QMap<QString, std::function<void(QTextStream &)>> m_commands;
|
||||
BlackCore::IVoice *m_voice;
|
||||
std::unique_ptr<BlackCore::IAudioInputDevice> m_inputDevice;
|
||||
std::unique_ptr<BlackCore::IAudioOutputDevice> m_outputDevice;
|
||||
QPointer<BlackCore::IVoiceChannel> m_channelCom1;
|
||||
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user