mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +08:00
Added commands to voice sample. Test successfull refs #36 - Added commands to list input and output devices - Fixed some compiler errors on win - Voice confirmed working on windows and linux
Signed-off-by: Roland Winklmeier <roland.m.winklmeier@gmail.com> refs #81
This commit is contained in:
committed by
Mathew Sutcliffe
parent
45b9f60444
commit
0bae898db8
@@ -13,19 +13,19 @@ Client::Client(QObject *parent) :
|
||||
connect(m_voiceClient, &IVoiceClient::squelchTestFinished, this, &Client::onSquelchTestFinished);
|
||||
connect(m_voiceClient, &IVoiceClient::micTestFinished, this, &Client::onMicTestFinished);
|
||||
connect(m_voiceClient, &IVoiceClient::connected, this, &Client::connectionStatusConnected);
|
||||
|
||||
|
||||
|
||||
connect(m_voiceClient, &IVoiceClient::disconnected, this, &Client::connectionStatusDisconnected);
|
||||
|
||||
using namespace std::placeholders;
|
||||
m_commands["help"] = std::bind(&Client::help, this, _1);
|
||||
m_commands["echo"] = std::bind(&Client::echo, this, _1);
|
||||
m_commands["exit"] = std::bind(&Client::exit, this, _1);
|
||||
m_commands["squelchtest"] = std::bind(&Client::runSquelchTest, this, _1);
|
||||
m_commands["mictest"] = std::bind(&Client::runMicTest, this, _1);
|
||||
m_commands["squelchtest"] = std::bind(&Client::squelchTestCmd, this, _1);
|
||||
m_commands["mictest"] = std::bind(&Client::micTestCmd, this, _1);
|
||||
m_commands["setcallsign"] = std::bind(&Client::setCallsignCmd, this, _1);
|
||||
m_commands["initconnect"] = std::bind(&Client::initiateConnectionCmd, this, _1);
|
||||
m_commands["termconnect"] = std::bind(&Client::terminateConnectionCmd, this, _1);
|
||||
m_commands["inputdevices"] = std::bind(&Client::inputDevicesCmd, this, _1);
|
||||
m_commands["outputdevices"] = std::bind(&Client::outputDevicesCmd, this, _1);
|
||||
|
||||
}
|
||||
|
||||
@@ -80,14 +80,14 @@ void Client::exit(QTextStream &)
|
||||
emit quit();
|
||||
}
|
||||
|
||||
void Client::runSquelchTest(QTextStream &args)
|
||||
void Client::squelchTestCmd(QTextStream &args)
|
||||
{
|
||||
std::cout << "Running squelch test. Please be quiet for 5 seconds..." << std::endl;
|
||||
printLinePrefix();
|
||||
m_voiceClient->runSquelchTest();
|
||||
}
|
||||
|
||||
void Client::runMicTest(QTextStream &args)
|
||||
void Client::micTestCmd(QTextStream &args)
|
||||
{
|
||||
std::cout << "Running mic test. Speak normally for 5 seconds..." << std::endl;
|
||||
printLinePrefix();
|
||||
@@ -118,6 +118,26 @@ void Client::terminateConnectionCmd(QTextStream &args)
|
||||
printLinePrefix();
|
||||
}
|
||||
|
||||
void Client::inputDevicesCmd(QTextStream &args)
|
||||
{
|
||||
QList<BlackMisc::Voice::CInputAudioDevice> devices = m_voiceClient->audioInputDevices();
|
||||
foreach (BlackMisc::Voice::CInputAudioDevice device, devices)
|
||||
{
|
||||
std::cout << device.name().toStdString() << std::endl;
|
||||
}
|
||||
printLinePrefix();
|
||||
}
|
||||
|
||||
void Client::outputDevicesCmd(QTextStream &args)
|
||||
{
|
||||
QList<BlackMisc::Voice::COutputAudioDevice> devices = m_voiceClient->audioOutputDevices();
|
||||
foreach (BlackMisc::Voice::COutputAudioDevice device, devices)
|
||||
{
|
||||
std::cout << " " << device.name().toStdString() << std::endl;
|
||||
}
|
||||
printLinePrefix();
|
||||
}
|
||||
|
||||
void Client::onSquelchTestFinished()
|
||||
{
|
||||
std::cout << "Input squelch: " << m_voiceClient->inputSquelch() << std::endl;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "blackcore/voiceclient.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <functional>
|
||||
#include <QMap>
|
||||
|
||||
class Client : public QObject
|
||||
@@ -27,11 +28,13 @@ private: //commands
|
||||
void help(QTextStream &args);
|
||||
void echo(QTextStream &args);
|
||||
void exit(QTextStream &args);
|
||||
void runSquelchTest(QTextStream &args);
|
||||
void runMicTest(QTextStream &args);
|
||||
void squelchTestCmd(QTextStream &args);
|
||||
void micTestCmd(QTextStream &args);
|
||||
void setCallsignCmd(QTextStream &args);
|
||||
void initiateConnectionCmd(QTextStream &args);
|
||||
void terminateConnectionCmd(QTextStream &args);
|
||||
void inputDevicesCmd(QTextStream &args);
|
||||
void outputDevicesCmd(QTextStream &args);
|
||||
|
||||
void printLinePrefix();
|
||||
|
||||
|
||||
@@ -13,9 +13,7 @@ DEPENDPATH += . ../../src
|
||||
INCLUDEPATH += . ../../src
|
||||
|
||||
SOURCES += *.cpp
|
||||
HEADERS += *.h \
|
||||
client.h \
|
||||
reader.h
|
||||
HEADERS += *.h
|
||||
|
||||
LIBS += -L../../lib -lblackcore -lblackmisc
|
||||
LIBS += -lvatlib
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace BlackCore
|
||||
{
|
||||
CVoiceClientVatlib::CVoiceClientVatlib(QObject *parent) :
|
||||
IVoiceClient(parent),
|
||||
m_voice(Create_Cvatlib_Voice_Simple()),
|
||||
m_voice(Cvatlib_Voice_Simple::Create()),
|
||||
m_inputSquelch(-1),
|
||||
m_queryUserRoomIndex(-1)
|
||||
{
|
||||
@@ -139,7 +139,7 @@ namespace BlackCore
|
||||
try
|
||||
{
|
||||
Q_ASSERT_X (m_voice->IsValid() && m_voice->IsSetup(), "CVoiceClientVatlib", "Cvatlib_Voice_Simple invalid or not setup!");
|
||||
m_voice->IsRoomConnected(comUnit);
|
||||
return m_voice->IsRoomConnected(comUnit);
|
||||
}
|
||||
catch (...) { this->exceptionDispatcher(Q_FUNC_INFO); }
|
||||
}
|
||||
@@ -259,7 +259,7 @@ namespace BlackCore
|
||||
|
||||
const BlackMisc::Voice::CVoiceRoom &CVoiceClientVatlib::voiceRoom(const uint32_t comUnit)
|
||||
{
|
||||
|
||||
return BlackMisc::Voice::CVoiceRoom();
|
||||
}
|
||||
|
||||
void CVoiceClientVatlib::timerEvent(QTimerEvent *)
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef BLACKMISC_AUDIODEVICE_H
|
||||
#define BLACKMISC_AUDIODEVICE_H
|
||||
|
||||
/*!
|
||||
\file
|
||||
*/
|
||||
@@ -11,8 +14,10 @@
|
||||
|
||||
#include <QString>
|
||||
|
||||
#ifndef BLACKMISC_AUDIODEVICE_H
|
||||
#define BLACKMISC_AUDIODEVICE_H
|
||||
#ifdef Q_OS_WIN
|
||||
typedef short int16_t;
|
||||
#endif
|
||||
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -30,7 +35,7 @@ namespace BlackMisc
|
||||
/*!
|
||||
* Default constructor.
|
||||
*/
|
||||
CAudioDevice() : m_deviceIndex(-1), m_deviceName("") {}
|
||||
CAudioDevice() : m_deviceIndex(0), m_deviceName("") {}
|
||||
|
||||
|
||||
/*!
|
||||
|
||||
Reference in New Issue
Block a user