mirror of
https://github.com/lubosz/overte.git
synced 2025-08-08 02:48:12 +02:00
have Application pass audio pos/orientation to AudioClient
This commit is contained in:
parent
e28ca27ccd
commit
d2af9a2911
5 changed files with 17 additions and 11 deletions
|
@ -279,6 +279,10 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
QThread* audioThread = new QThread(this);
|
QThread* audioThread = new QThread(this);
|
||||||
|
|
||||||
auto audioIO = DependencyManager::get<AudioClient>();
|
auto audioIO = DependencyManager::get<AudioClient>();
|
||||||
|
|
||||||
|
audioIO->setPositionGetter(getPositionForAudio);
|
||||||
|
audioIO->setOrientationGetter(getOrientationForAudio);
|
||||||
|
|
||||||
audioIO->moveToThread(audioThread);
|
audioIO->moveToThread(audioThread);
|
||||||
connect(audioThread, &QThread::started, audioIO.data(), &AudioClient::start);
|
connect(audioThread, &QThread::started, audioIO.data(), &AudioClient::start);
|
||||||
|
|
||||||
|
|
|
@ -132,6 +132,8 @@ public:
|
||||||
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
||||||
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
||||||
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
static glm::quat getOrientationForPath() { return getInstance()->_myAvatar->getOrientation(); }
|
||||||
|
static glm::vec3 getPositionForAudio() { return getInstance()->_myAvatar->getHead()->getPosition(); }
|
||||||
|
static glm::quat getOrientationForAudio() { return getInstance()->_myAvatar->getHead()->getFinalOrientationInWorldFrame(); }
|
||||||
|
|
||||||
Application(int& argc, char** argv, QElapsedTimer &startup_time);
|
Application(int& argc, char** argv, QElapsedTimer &startup_time);
|
||||||
~Application();
|
~Application();
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
|
|
||||||
#include <AccountManager.h>
|
#include <AccountManager.h>
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
|
#include <AudioClient.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
#include <MainWindow.h>
|
#include <MainWindow.h>
|
||||||
#include <GlowEffect.h>
|
#include <GlowEffect.h>
|
||||||
|
@ -41,7 +42,6 @@
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "AccountManager.h"
|
#include "AccountManager.h"
|
||||||
#include "Audio.h"
|
|
||||||
#include "audio/AudioIOStatsRenderer.h"
|
#include "audio/AudioIOStatsRenderer.h"
|
||||||
#include "audio/AudioScope.h"
|
#include "audio/AudioScope.h"
|
||||||
#include "devices/RealSense.h"
|
#include "devices/RealSense.h"
|
||||||
|
|
|
@ -5,17 +5,17 @@ setup_hifi_library(Network)
|
||||||
|
|
||||||
link_hifi_libraries(audio)
|
link_hifi_libraries(audio)
|
||||||
|
|
||||||
# call macro to include our dependency includes and bubble them up via a property on our target
|
|
||||||
include_dependency_includes()
|
|
||||||
|
|
||||||
set(GVERB_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/gverb")
|
set(GVERB_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/gverb")
|
||||||
|
|
||||||
# As Gverb is currently the only reverb library, it's required.
|
# As Gverb is currently the only reverb library, it's required.
|
||||||
find_package(Gverb REQUIRED)
|
find_package(Gverb REQUIRED)
|
||||||
|
|
||||||
if (GVERB_FOUND)
|
file(GLOB GVERB_SRCS ${GVERB_SRC_DIRS}/*.c)
|
||||||
file(GLOB GVERB_SRCS ${GVERB_SRC_DIRS}/*.c)
|
add_library(gverb STATIC ${GVERB_SRCS})
|
||||||
include_directories(${GVERB_INCLUDE_DIRS})
|
target_link_libraries(${TARGET_NAME} gverb)
|
||||||
add_library(gverb STATIC ${GVERB_SRCS})
|
|
||||||
target_link_libraries(${TARGET_NAME} gverb)
|
# append gverb includes to our list of includes to bubble
|
||||||
endif (GVERB_FOUND)
|
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES "${GVERB_INCLUDE_DIRS}")
|
||||||
|
|
||||||
|
# call macro to include our dependency includes and bubble them up via a property on our target
|
||||||
|
include_dependency_includes()
|
|
@ -68,7 +68,7 @@ class QAudioInput;
|
||||||
class QAudioOutput;
|
class QAudioOutput;
|
||||||
class QIODevice;
|
class QIODevice;
|
||||||
|
|
||||||
typedef const glm::vec3& (*PositionGetter)();
|
typedef glm::vec3 (*PositionGetter)();
|
||||||
typedef glm::quat (*OrientationGetter)();
|
typedef glm::quat (*OrientationGetter)();
|
||||||
|
|
||||||
class AudioClient : public AbstractAudioInterface, public Dependency {
|
class AudioClient : public AbstractAudioInterface, public Dependency {
|
||||||
|
|
Loading…
Reference in a new issue