Commit 60e0f0ff authored by pixhawk's avatar pixhawk

Added windows audio

parent 3385b837
DEPENDPATH += src DEPENDPATH += src
INCLUDEPATH += src INCLUDEPATH += src
MOC_DIR = tmp
OBJECTS_DIR = obj
# Input # Input
HEADERS += curve.h \ HEADERS += curve.h \
...@@ -52,5 +50,3 @@ SOURCES += curve.cpp \ ...@@ -52,5 +50,3 @@ SOURCES += curve.cpp \
openaerialmapadapter.cpp \ openaerialmapadapter.cpp \
fixedimageoverlay.cpp \ fixedimageoverlay.cpp \
emptymapadapter.cpp emptymapadapter.cpp
QT += network
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
QT += network opengl svg xml phonon QT += network opengl svg xml phonon
TEMPLATE = app TEMPLATE = app
TARGET = opengroundcontrol TARGET = qgroundcontrol
BASEDIR = . BASEDIR = .
BUILDDIR = build BUILDDIR = build
...@@ -38,6 +38,7 @@ LANGUAGE = C++ ...@@ -38,6 +38,7 @@ LANGUAGE = C++
#CONFIG += static release console #CONFIG += static release console
CONFIG += static debug_and_release console CONFIG += static debug_and_release console
QMAKE_CFLAGS += -j8 QMAKE_CFLAGS += -j8
QMAKE_CXXFLAGS += -j8
OBJECTS_DIR = $$BUILDDIR/obj OBJECTS_DIR = $$BUILDDIR/obj
MOC_DIR = $$BUILDDIR/moc MOC_DIR = $$BUILDDIR/moc
...@@ -60,14 +61,11 @@ message(Qt version> $$[QMAKESPEC]) ...@@ -60,14 +61,11 @@ message(Qt version> $$[QMAKESPEC])
# MAC OS X # MAC OS X
macx { macx {
message(Building for Mac OS X) message(Building for Mac OS X 32/64bit)
CONFIG += x86 #CONFIG += x86
CONFIG += x86_64 cocoa
contains ( DEFINES, QT_MAC_USE_COCOA ) { CONFIG -= static
CONFIG += x86_64 cocoa
CONFIG -= static
}
DESTDIR = $$BASEDIR/bin/mac DESTDIR = $$BASEDIR/bin/mac
...@@ -79,7 +77,11 @@ macx { ...@@ -79,7 +77,11 @@ macx {
-framework ApplicationServices \ -framework ApplicationServices \
-lm -lm
DEFINES += _TTY_POSIX_ # Enable function-profiling with the OS X saturn tool
debug {
#QMAKE_CXXFLAGS += -finstrument-functions
#LIBS += -lSaturn
}
#ICON = $$BASEDIR/img/icons/empty.png #ICON = $$BASEDIR/img/icons/empty.png
} }
...@@ -98,8 +100,6 @@ linux-g++ { ...@@ -98,8 +100,6 @@ linux-g++ {
} }
INCLUDEPATH += /usr/include/SDL INCLUDEPATH += /usr/include/SDL
DEFINES += _TTY_POSIX_
HARDWARE_PLATFORM = $$system(uname -a) HARDWARE_PLATFORM = $$system(uname -a)
contains( HARDWARE_PLATFORM, x86_64 ) { contains( HARDWARE_PLATFORM, x86_64 ) {
# 64-bit Linux # 64-bit Linux
...@@ -142,8 +142,6 @@ win32 { ...@@ -142,8 +142,6 @@ win32 {
-lmingw32 -lSDLmain -lSDL -mwindows -lmingw32 -lSDLmain -lSDL -mwindows
INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL INCLUDEPATH += $$BASEDIR/lib/sdl/include/SDL
DEFINES += _TTY_WIN_
debug { debug {
DESTDIR = $$BASEDIR/bin DESTDIR = $$BASEDIR/bin
......
...@@ -11,7 +11,9 @@ include(src/lib/qwt/qwt.pri) ...@@ -11,7 +11,9 @@ include(src/lib/qwt/qwt.pri)
#include(src/lib/flite/flite.pri) #include(src/lib/flite/flite.pri)
# Include QMapControl map library # Include QMapControl map library
include(lib/QMapControl/QMapControl.pri) include(src/lib/qmapcontrol/qmapcontrol.pri)
#include(lib/QMapControl/QMapControl.pri)
DEPENDPATH += . \ DEPENDPATH += . \
lib/QMapControl \ lib/QMapControl \
lib/QMapControl/src lib/QMapControl/src
......
...@@ -30,16 +30,21 @@ This file is part of the PIXHAWK project ...@@ -30,16 +30,21 @@ This file is part of the PIXHAWK project
*/ */
#include <QApplication> #include <QApplication>
#include <QTemporaryFile>
#include "GAudioOutput.h" #include "GAudioOutput.h"
#include "MG.h" #include "MG.h"
#include <QDebug>
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include <ApplicationServices/ApplicationServices.h> #include <ApplicationServices/ApplicationServices.h>
#endif #endif
#include <QTemporaryFile> #ifdef Q_OS_WINDOWS
#include <windows.h>
#include <QDebug> using System;
using System.Speech.Synthesis;
#endif
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
extern "C" { extern "C" {
...@@ -110,7 +115,13 @@ bool GAudioOutput::say(QString text, int severity) ...@@ -110,7 +115,13 @@ bool GAudioOutput::say(QString text, int severity)
bool res = false; bool res = false;
if (!emergency) if (!emergency)
{ {
// Only give speech output on Linux and MacOS
#ifdef Q_OS_WINDOWS
SpeechSynthesizer synth = new SpeechSynthesizer();
synth.SelectVoice("Microsoft Anna");
synth.SpeakText("Hello, world!");
#endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
QTemporaryFile file; QTemporaryFile file;
file.setFileTemplate("XXXXXX.wav"); file.setFileTemplate("XXXXXX.wav");
......
DEPENDPATH += src
INCLUDEPATH += src
# Input
HEADERS += curve.h \
geometry.h \
imagemanager.h \
layer.h \
layermanager.h \
linestring.h \
mapadapter.h \
mapcontrol.h \
mapnetwork.h \
point.h \
tilemapadapter.h \
wmsmapadapter.h \
circlepoint.h \
imagepoint.h \
gps_position.h \
osmmapadapter.h \
maplayer.h \
geometrylayer.h \
yahoomapadapter.h \
googlemapadapter.h \
googlesatmapadapter.h \
openaerialmapadapter.h \
fixedimageoverlay.h \
emptymapadapter.h
SOURCES += curve.cpp \
geometry.cpp \
imagemanager.cpp \
layer.cpp \
layermanager.cpp \
linestring.cpp \
mapadapter.cpp \
mapcontrol.cpp \
mapnetwork.cpp \
point.cpp \
tilemapadapter.cpp \
wmsmapadapter.cpp \
circlepoint.cpp \
imagepoint.cpp \
gps_position.cpp \
osmmapadapter.cpp \
maplayer.cpp \
geometrylayer.cpp \
yahoomapadapter.cpp \
googlemapadapter.cpp \
googlesatmapadapter.cpp \
openaerialmapadapter.cpp \
fixedimageoverlay.cpp \
emptymapadapter.cpp
...@@ -27,7 +27,9 @@ void JoystickWidget::updateJoystick(double roll, double pitch, double yaw, doubl ...@@ -27,7 +27,9 @@ void JoystickWidget::updateJoystick(double roll, double pitch, double yaw, doubl
{ {
setX(roll); setX(roll);
setY(pitch); setY(pitch);
setZ(yaw);
setThrottle(thrust); setThrottle(thrust);
setHat(xHat, yHat);
} }
void JoystickWidget::changeEvent(QEvent *e) void JoystickWidget::changeEvent(QEvent *e)
...@@ -46,16 +48,29 @@ void JoystickWidget::setThrottle(float thrust) ...@@ -46,16 +48,29 @@ void JoystickWidget::setThrottle(float thrust)
{ {
m_ui->thrust->setValue(thrust*100); m_ui->thrust->setValue(thrust*100);
} }
void JoystickWidget::setX(float x) void JoystickWidget::setX(float x)
{ {
m_ui->xSlider->setValue(x*100); m_ui->xSlider->setValue(x*100);
m_ui->xValue->display(x*100); m_ui->xValue->display(x*100);
} }
void JoystickWidget::setY(float y) void JoystickWidget::setY(float y)
{ {
m_ui->ySlider->setValue(y*100); m_ui->ySlider->setValue(y*100);
m_ui->yValue->display(y*100); m_ui->yValue->display(y*100);
} }
void JoystickWidget::setZ(float z)
{
m_ui->dial->setValue(z*100);
}
void JoystickWidget::setHat(float x, float y)
{
qDebug() << __FILE__ << __LINE__ << "HAT X:" << x << "HAT Y:" << y;
}
void JoystickWidget::pressKey(int key) void JoystickWidget::pressKey(int key)
{ {
QString colorstyle; QString colorstyle;
...@@ -64,5 +79,5 @@ void JoystickWidget::pressKey(int key) ...@@ -64,5 +79,5 @@ void JoystickWidget::pressKey(int key)
heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue()); heartbeatColor.red(), heartbeatColor.green(), heartbeatColor.blue());
m_ui->button0Label->setStyleSheet(colorstyle); m_ui->button0Label->setStyleSheet(colorstyle);
m_ui->button0Label->setAutoFillBackground(true); m_ui->button0Label->setAutoFillBackground(true);
qDebug() << "KEY" << key << " pressed on joystick"; qDebug() << __FILE__ << __LINE__ << "KEY" << key << " pressed on joystick";
} }
...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project ...@@ -23,7 +23,7 @@ This file is part of the PIXHAWK project
/** /**
* @file * @file
* @brief Definition of joystick interface * @brief Definition of joystick widget
* @author Lorenz Meier <mavteam@student.ethz.ch> * @author Lorenz Meier <mavteam@student.ethz.ch>
* *
*/ */
...@@ -57,14 +57,23 @@ public: ...@@ -57,14 +57,23 @@ public:
* @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right * @param yHat hat vector in left-right direction, -1 left, 0 center, +1 right
*/ */
void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat); void updateJoystick(double roll, double pitch, double yaw, double thrust, int xHat, int yHat);
/** @brief Throttle lever */
void setThrottle(float thrust); void setThrottle(float thrust);
/** @brief Back/forth movement */
void setX(float x); void setX(float x);
/** @brief Left/right movement */
void setY(float y); void setY(float y);
/** @brief Wrist rotation */
void setZ(float z);
/** @brief Hat switch position */
void setHat(float x, float y);
/** @brief Joystick keys, as labeled on the joystick */
void pressKey(int key); void pressKey(int key);
protected: protected:
/** @brief UI change event */
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
JoystickInput* joystick; JoystickInput* joystick; ///< Reference to the joystick
private: private:
Ui::JoystickWidget *m_ui; Ui::JoystickWidget *m_ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment