mirror of
https://github.com/overte-org/overte.git
synced 2025-04-25 18:35:32 +02:00
Merge branch 'android' of https://github.com/birarda/hifi into android
This commit is contained in:
commit
38e7bddc73
65 changed files with 4651 additions and 211 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -38,3 +38,5 @@ interface/resources/visage/*
|
|||
|
||||
# Ignore interfaceCache for Linux users
|
||||
interface/interfaceCache/
|
||||
|
||||
gvr-interface/assets/oculussig*
|
86
BUILD_ANDROID.md
Normal file
86
BUILD_ANDROID.md
Normal file
|
@ -0,0 +1,86 @@
|
|||
Please read the [general build guide](BUILD.md) for information on dependencies required for all platforms. Only Android specific instructions are found in this file.
|
||||
|
||||
###Android Dependencies
|
||||
|
||||
You will need the following tools to build our Android targets.
|
||||
|
||||
* [Android NDK](https://developer.android.com/tools/sdk/ndk/index.html) ~> r10c
|
||||
* [Android SDK](http://developer.android.com/sdk/installing/index.html) = 4.4.2 (API Level 19)
|
||||
|
||||
You will also need to cross-compile the dependencies required for all platforms for Android, and help CMake find these compiled libraries on your machine.
|
||||
|
||||
####ANDROID_LIB_DIR
|
||||
|
||||
Since you won't be installing Android dependencies to system paths on your development machine, CMake will need a little help tracking down your Android dependencies.
|
||||
|
||||
This is most easily accomplished by installing all Android dependencies in the same folder. You can place this folder wherever you like on your machine. In this build guide and across our CMakeLists files this folder is referred to as `ANDROID_LIB_DIR`. You can set `ANDROID_LIB_DIR` in your environment or by passing when you run CMake.
|
||||
|
||||
####Qt
|
||||
|
||||
Install Qt 5.3 for Android for your host environment from the [Qt downloads page](http://www.qt.io/download/). Install Qt to ``$ANDROID_LIB_DIR/Qt``. This is required so that our root CMakeLists file can help CMake find your Android Qt installation.
|
||||
|
||||
If you would like to install Qt to a different location, or attempt to build with a different Qt version, you can pass `ANDROID_QT_CMAKE_PREFIX_PATH` to CMake. Point to the `cmake` folder inside `$VERSION_NUMBER/android_armv7/lib`. Otherwise, our root CMakeLists will set it to `$ANDROID_LIB_DIR/Qt/5.3/android_armv7/lib/cmake`.
|
||||
|
||||
####OpenSSL
|
||||
|
||||
Cross-compilation of OpenSSL has only been tested from an OS X machine running 10.10 compiling OpenSSL 1.0.1j. It is likely that the steps below will work for other OpenSSL versions than 1.0.1j.
|
||||
|
||||
The full instructions to compile OpenSSL for Android from your host environment can be found [here](http://wiki.openssl.org/index.php/Android).
|
||||
|
||||
Download the [OpenSSL source](https://www.openssl.org/source/) and extract the tarball inside your `ANDROID_LIB_DIR`. Rename the extracted folder to `openssl`.
|
||||
|
||||
You will need the [setenv-android.sh script](http://wiki.openssl.org/index.php/File:Setenv-android.sh) from the OpenSSL wiki.
|
||||
|
||||
First, make sure `ANDROID_NDK_ROOT` is set in your env. This should be the path to the root of your Android NDK install. If you've configured your machine to build the Android client using the instructions below, you can set it to the value of $ANDROID_NDK. `setenv-android.sh` needs `ANDROID_NDK_ROOT` to set the environment variables required for building OpenSSL.
|
||||
|
||||
Execute the `setenv-android.sh` script so it can set environment variables that OpenSSL will use while compiling.
|
||||
|
||||
Then, from the OpenSSL directory, run the following commands.
|
||||
|
||||
```
|
||||
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org
|
||||
./config shared -no-ssl2 -no-ssl3 -no-comp -no-hw -no-engine --openssldir=/usr/local/ssl/$ANDROID_API
|
||||
make depend
|
||||
make all
|
||||
```
|
||||
|
||||
This should generate libcrypto and libssl in the root of the OpenSSL directory. YOU MUST remove the `libssl.so` and `libcrypto.so` files that are generated. They are symlinks to `libssl.so.VER` and `libcrypto.so.VER` which Android does not know how to handle. By removing `libssl.so` and `libcrypto.so` the FindOpenSSL module will find the static libs and use those instead.
|
||||
|
||||
If you have been building other components it is possible that the OpenSSL compile will fail based on the values other cross-compilations (tbb, bullet) have set. Ensure that you are in a new terminal window to avoid compilation errors from previously set environment variables.
|
||||
|
||||
####Intel Threading Building Blocks
|
||||
|
||||
Download the [Intel Threading Building Blocks source](https://www.threadingbuildingblocks.org/download) and extract the tarball inside your `ANDROID_LIB_DIR`. Rename the extracted folder to `tbb`.
|
||||
|
||||
From the tbb directory, execute the following commands. This will set the compiler and archive tool to the correct ones from the NDK install and then build TBB using `ndk-build`. Then, the compiled libs are copied to a lib folder in the root of tbb directory.
|
||||
|
||||
Note that you will need to replace the value of $HOST below with whatever is appropriate for your host OS. On OS X, for example, the full exported value for CC is `$ANDROID_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gcc`.
|
||||
|
||||
```
|
||||
export CC=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$HOST/bin/arm-linux-androideabi-gcc
|
||||
export AR=$ANDROID_NDK/toolchains/arm-linux-androideabi-4.6/prebuilt/$HOST/bin/arm-linux-androideabi-ar
|
||||
cd jni
|
||||
ndk-build target=android tbb tbbmalloc arch=arm
|
||||
cd ../
|
||||
mkdir lib
|
||||
cp -rf build/linux_arm_*/**/*.so lib/
|
||||
```
|
||||
|
||||
####GLM
|
||||
|
||||
Since GLM is a header only library, assuming it is installed at a system path or a path where our FindGLM module will find it you do not need to do anything specific for the Android build.
|
||||
|
||||
###CMake
|
||||
|
||||
We use CMake to generate the makefiles that compile and deploy the Android APKs to your device. In order to create Makefiles for the Android targets, CMake requires that some environment variables are set, and that other variables are passed to it when it is run.
|
||||
|
||||
The following must be set in your environment:
|
||||
|
||||
* ANDROID_NDK - the root of your Android NDK install
|
||||
* ANDROID_HOME - the root of your Android SDK install
|
||||
* ANDROID_LIB_DIR - the directory containing cross-compiled versions of dependencies
|
||||
|
||||
The following must be passed to CMake when it is run:
|
||||
|
||||
* CMAKE_TOOLCHAIN_FILE - full path to the android.toolchain.cmake file that is included in this repository (/cmake/android/android.toolchain.cmake)
|
||||
* ANDROID_NATIVE_API_LEVEL - the API level you want to use (this should be 19 for GearVR)
|
|
@ -58,8 +58,25 @@ if (APPLE)
|
|||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --stdlib=libc++")
|
||||
endif ()
|
||||
|
||||
if (NOT QT_CMAKE_PREFIX_PATH)
|
||||
set(QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH})
|
||||
if (NOT ANDROID_LIB_DIR)
|
||||
set(ANDROID_LIB_DIR $ENV{ANDROID_LIB_DIR})
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
if (NOT ANDROID_QT_CMAKE_PREFIX_PATH)
|
||||
set(QT_CMAKE_PREFIX_PATH ${ANDROID_LIB_DIR}/Qt/5.3/android_armv7/lib/cmake)
|
||||
endif ()
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if (ANDROID_LIB_DIR)
|
||||
list(APPEND CMAKE_FIND_ROOT_PATH ${ANDROID_LIB_DIR})
|
||||
endif ()
|
||||
else ()
|
||||
if (NOT QT_CMAKE_PREFIX_PATH)
|
||||
set(QT_CMAKE_PREFIX_PATH $ENV{QT_CMAKE_PREFIX_PATH})
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${QT_CMAKE_PREFIX_PATH})
|
||||
|
@ -84,10 +101,21 @@ foreach(CUSTOM_MACRO ${HIFI_CUSTOM_MACROS})
|
|||
include(${CUSTOM_MACRO})
|
||||
endforeach()
|
||||
|
||||
# targets on all platforms
|
||||
add_subdirectory(assignment-client)
|
||||
add_subdirectory(domain-server)
|
||||
add_subdirectory(ice-server)
|
||||
add_subdirectory(interface)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(tools)
|
||||
if (ANDROID)
|
||||
file(GLOB ANDROID_CUSTOM_MACROS "cmake/android/*.cmake")
|
||||
foreach(CUSTOM_MACRO ${ANDROID_CUSTOM_MACROS})
|
||||
include(${CUSTOM_MACRO})
|
||||
endforeach()
|
||||
endif ()
|
||||
|
||||
# add subdirectories for all targets
|
||||
if (NOT ANDROID)
|
||||
add_subdirectory(assignment-client)
|
||||
add_subdirectory(domain-server)
|
||||
add_subdirectory(ice-server)
|
||||
add_subdirectory(interface)
|
||||
add_subdirectory(tests)
|
||||
add_subdirectory(tools)
|
||||
else ()
|
||||
add_subdirectory(gvr-interface)
|
||||
endif()
|
1084
CMakeLists.txt.user.18
Normal file
1084
CMakeLists.txt.user.18
Normal file
File diff suppressed because it is too large
Load diff
73
cmake/android/AndroidManifest.xml.in
Executable file
73
cmake/android/AndroidManifest.xml.in
Executable file
|
@ -0,0 +1,73 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- IMPORTANT: Do not manually manipulate this automatically generated file, changes will be gone after the next build! -->
|
||||
|
||||
<manifest package="${ANDROID_APK_PACKAGE}" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
|
||||
<application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/AppDisplayName" android:icon="@drawable/icon">
|
||||
|
||||
<!-- VR MODE -->
|
||||
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_dual"/>
|
||||
|
||||
<activity android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation"
|
||||
android:name="org.qtproject.qt5.android.bindings.QtActivity"
|
||||
android:label="@string/AppDisplayName"
|
||||
android:screenOrientation="unspecified"
|
||||
android:launchMode="singleTop"
|
||||
${ANDROID_APK_THEME}>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
|
||||
<meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/>
|
||||
<meta-data android:name="android.app.repository" android:value="default"/>
|
||||
<meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/>
|
||||
<meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/>
|
||||
<!-- Deploy Qt libs as part of package -->
|
||||
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="-- %%BUNDLE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/>
|
||||
<meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/>
|
||||
<!-- Run with local libs -->
|
||||
<meta-data android:name="android.app.use_local_qt_libs" android:value="-- %%USE_LOCAL_QT_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/>
|
||||
<meta-data android:name="android.app.load_local_libs" android:value="-- %%INSERT_LOCAL_LIBS%% --"/>
|
||||
<meta-data android:name="android.app.load_local_jars" android:value="-- %%INSERT_LOCAL_JARS%% --"/>
|
||||
<meta-data android:name="android.app.static_init_classes" android:value="-- %%INSERT_INIT_CLASSES%% --"/>
|
||||
<!-- Messages maps -->
|
||||
<meta-data android:value="@string/ministro_not_found_msg" android:name="android.app.ministro_not_found_msg"/>
|
||||
<meta-data android:value="@string/ministro_needed_msg" android:name="android.app.ministro_needed_msg"/>
|
||||
<meta-data android:value="@string/fatal_error_msg" android:name="android.app.fatal_error_msg"/>
|
||||
<!-- Messages maps -->
|
||||
|
||||
<!-- Splash screen -->
|
||||
<!--
|
||||
<meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/logo"/>
|
||||
-->
|
||||
<!-- Splash screen -->
|
||||
</activity>
|
||||
|
||||
<activity android:name="com.oculusvr.vrlib.PlatformActivity"
|
||||
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
|
||||
android:launchMode="singleTask"
|
||||
android:screenOrientation="landscape"
|
||||
android:configChanges="screenSize|orientation|keyboardHidden|keyboard">
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
<uses-sdk android:minSdkVersion="${ANDROID_API_LEVEL}" android:targetSdkVersion="${ANDROID_API_LEVEL}"/>
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default permissions. -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<!-- camera permission required for GEAR VR passthrough camera -->
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
|
||||
<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
|
||||
Remove the comment if you do not require these default features. -->
|
||||
|
||||
<!-- Tell the system this app requires OpenGL ES 3.0. -->
|
||||
<uses-feature android:glEsVersion="0x00030000" android:required="true" />
|
||||
</manifest>
|
113
cmake/android/QtCreateAPK.cmake
Normal file
113
cmake/android/QtCreateAPK.cmake
Normal file
|
@ -0,0 +1,113 @@
|
|||
#
|
||||
# QtCreateAPK.cmake
|
||||
#
|
||||
# Created by Stephen Birarda on 11/18/14.
|
||||
# Copyright 2013 High Fidelity, Inc.
|
||||
#
|
||||
# Distributed under the Apache License, Version 2.0.
|
||||
# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
#
|
||||
|
||||
#
|
||||
# OPTIONS
|
||||
# These options will modify how QtCreateAPK behaves. May be useful if somebody wants to fork.
|
||||
# For High Fidelity purposes these should not need to be changed.
|
||||
#
|
||||
set(ANDROID_THIS_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}) # Directory this CMake file is in
|
||||
|
||||
if (POLICY CMP0026)
|
||||
cmake_policy(SET CMP0026 OLD)
|
||||
endif ()
|
||||
|
||||
macro(qt_create_apk)
|
||||
if(ANDROID_APK_FULLSCREEN)
|
||||
set(ANDROID_APK_THEME "android:theme=\"@android:style/Theme.NoTitleBar.Fullscreen\"")
|
||||
else()
|
||||
set(ANDROID_APK_THEME "")
|
||||
endif()
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
set(ANDROID_APK_DEBUGGABLE "true")
|
||||
set(ANDROID_APK_RELEASE_LOCAL "0")
|
||||
else ()
|
||||
set(ANDROID_APK_DEBUGGABLE "false")
|
||||
set(ANDROID_APK_RELEASE_LOCAL ${ANDROID_APK_RELEASE})
|
||||
endif ()
|
||||
|
||||
# Create "AndroidManifest.xml"
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/AndroidManifest.xml.in" "${ANDROID_APK_BUILD_DIR}/AndroidManifest.xml")
|
||||
|
||||
# create "strings.xml"
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/strings.xml.in" "${ANDROID_APK_BUILD_DIR}/res/values/strings.xml")
|
||||
|
||||
# copy the res folder from the target to the apk build dir
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/res" "${ANDROID_APK_BUILD_DIR}/res"
|
||||
)
|
||||
|
||||
# copy the assets folder from the target to the apk build dir
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/assets" "${ANDROID_APK_BUILD_DIR}/assets"
|
||||
)
|
||||
|
||||
# figure out where the qt dir is
|
||||
get_filename_component(QT_DIR "${QT_CMAKE_PREFIX_PATH}/../../" ABSOLUTE)
|
||||
|
||||
# find androiddeployqt
|
||||
find_program(ANDROID_DEPLOY_QT androiddeployqt HINTS "${QT_DIR}/bin")
|
||||
|
||||
# set the path to our app shared library
|
||||
set(EXECUTABLE_DESTINATION_PATH "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}/lib${TARGET_NAME}.so")
|
||||
|
||||
# add our dependencies to the deployment file
|
||||
get_property(_DEPENDENCIES TARGET ${TARGET_NAME} PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
|
||||
foreach(_DEP IN LISTS _DEPENDENCIES)
|
||||
if (NOT TARGET ${_DEP})
|
||||
list(APPEND _DEPS_LIST ${_DEP})
|
||||
else ()
|
||||
if(NOT _DEP MATCHES "Qt5::.*")
|
||||
get_property(_DEP_LOCATION TARGET ${_DEP} PROPERTY "LOCATION_${CMAKE_BUILD_TYPE}")
|
||||
|
||||
# recurisvely add libraries which are dependencies of this target
|
||||
get_property(_DEP_DEPENDENCIES TARGET ${_DEP} PROPERTY INTERFACE_LINK_LIBRARIES)
|
||||
|
||||
foreach(_SUB_DEP IN LISTS _DEP_DEPENDENCIES)
|
||||
if (NOT TARGET ${_SUB_DEP} AND NOT _SUB_DEP MATCHES "Qt5::.*")
|
||||
list(APPEND _DEPS_LIST ${_SUB_DEP})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(APPEND _DEPS_LIST ${_DEP_LOCATION})
|
||||
endif()
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_DUPLICATES _DEPS_LIST)
|
||||
|
||||
# just copy static libs to apk libs folder - don't add to deps list
|
||||
foreach(_LOCATED_DEP IN LISTS _DEPS_LIST)
|
||||
if (_LOCATED_DEP MATCHES "\\.a$")
|
||||
add_custom_command(
|
||||
TARGET ${TARGET_NAME}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${_LOCATED_DEP} "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}"
|
||||
)
|
||||
list(REMOVE_ITEM _DEPS_LIST ${_LOCATED_DEP})
|
||||
endif ()
|
||||
endforeach()
|
||||
|
||||
string(REPLACE ";" "," _DEPS "${_DEPS_LIST}")
|
||||
|
||||
configure_file("${ANDROID_THIS_DIRECTORY}/deployment-file.json.in" "${TARGET_NAME}-deployment.json")
|
||||
|
||||
# use androiddeployqt to create the apk
|
||||
add_custom_target(${TARGET_NAME}-apk
|
||||
COMMAND ${ANDROID_DEPLOY_QT} --input "${TARGET_NAME}-deployment.json" --output "${ANDROID_APK_OUTPUT_DIR}" --android-platform android-${ANDROID_API_LEVEL} --install --deployment bundled "\\$(ARGS)"
|
||||
DEPENDS ${TARGET_NAME}
|
||||
)
|
||||
endmacro()
|
1750
cmake/android/android.toolchain.cmake
Executable file
1750
cmake/android/android.toolchain.cmake
Executable file
File diff suppressed because it is too large
Load diff
14
cmake/android/deployment-file.json.in
Normal file
14
cmake/android/deployment-file.json.in
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"qt": "@QT_DIR@",
|
||||
"sdk": "@ANDROID_SDK_ROOT@",
|
||||
"ndk": "@ANDROID_NDK@",
|
||||
"toolchain-prefix": "@ANDROID_TOOLCHAIN_MACHINE_NAME@",
|
||||
"tool-prefix": "@ANDROID_TOOLCHAIN_MACHINE_NAME@",
|
||||
"toolchain-version": "@ANDROID_COMPILER_VERSION@",
|
||||
"ndk-host": "@ANDROID_NDK_HOST_SYSTEM_NAME@",
|
||||
"target-architecture": "@ANDROID_ABI@",
|
||||
"application-binary": "@EXECUTABLE_DESTINATION_PATH@",
|
||||
"android-extra-libs": "@_DEPS@",
|
||||
"android-extra-plugins": "",
|
||||
"android-package-source-directory": "@ANDROID_APK_BUILD_DIR@"
|
||||
}
|
11
cmake/android/strings.xml.in
Normal file
11
cmake/android/strings.xml.in
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
|
||||
<!-- IMPORTANT: Do not manually manipulate this automatically generated file, changes will be gone after the next build! -->
|
||||
|
||||
<resources>
|
||||
<string name="AppDisplayName">${ANDROID_APP_DISPLAY_NAME}</string>
|
||||
|
||||
<string name="ministro_not_found_msg">Can\'t find Ministro service.\nThe application can\'t start.</string>
|
||||
<string name="ministro_needed_msg">This application requires Ministro service. Would you like to install it?</string>
|
||||
<string name="fatal_error_msg">Your application encountered a fatal error and cannot continue.</string>
|
||||
</resources>
|
|
@ -13,5 +13,11 @@ macro(AUTO_MTC)
|
|||
|
||||
file(GLOB INCLUDE_FILES src/*.h)
|
||||
|
||||
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND mtc -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS mtc ${INCLUDE_FILES})
|
||||
if (NOT ANDROID)
|
||||
set(MTC_EXECUTABLE mtc)
|
||||
else ()
|
||||
set(MTC_EXECUTABLE $ENV{MTC_PATH}/mtc)
|
||||
endif ()
|
||||
|
||||
add_custom_command(OUTPUT ${AUTOMTC_SRC} COMMAND ${MTC_EXECUTABLE} -o ${AUTOMTC_SRC} ${INCLUDE_FILES} DEPENDS ${MTC_EXECUTABLE} ${INCLUDE_FILES})
|
||||
endmacro()
|
||||
|
|
|
@ -16,6 +16,10 @@ macro(HIFI_LIBRARY_SEARCH_HINTS LIBRARY_FOLDER)
|
|||
set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_ROOT_DIR}")
|
||||
endif ()
|
||||
|
||||
if (ANDROID)
|
||||
set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_SEARCH_DIRS}" "/${LIBRARY_FOLDER}")
|
||||
endif ()
|
||||
|
||||
if (DEFINED ENV{${LIBRARY_PREFIX}_ROOT_DIR})
|
||||
set(${LIBRARY_PREFIX}_SEARCH_DIRS "${${LIBRARY_PREFIX}_SEARCH_DIRS}" "$ENV{${LIBRARY_PREFIX}_ROOT_DIR}")
|
||||
endif ()
|
||||
|
|
|
@ -32,5 +32,4 @@ macro(LINK_HIFI_LIBRARIES)
|
|||
list(APPEND ${TARGET_NAME}_DEPENDENCY_INCLUDES ${LINKED_TARGET_DEPENDENCY_INCLUDES})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
endmacro(LINK_HIFI_LIBRARIES)
|
|
@ -9,14 +9,18 @@
|
|||
|
||||
macro(SETUP_HIFI_LIBRARY)
|
||||
|
||||
project(${TARGET_NAME})
|
||||
project(${TARGET_NAME})
|
||||
|
||||
# grab the implemenation and header files
|
||||
file(GLOB_RECURSE LIB_SRCS "src/*.h" "src/*.cpp")
|
||||
set(LIB_SRCS ${LIB_SRCS})
|
||||
list(APPEND ${TARGET_NAME}_SRCS ${LIB_SRCS})
|
||||
|
||||
# create a library and set the property so it can be referenced later
|
||||
add_library(${TARGET_NAME} ${LIB_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC})
|
||||
if (${${TARGET_NAME}_SHARED})
|
||||
add_library(${TARGET_NAME} SHARED ${LIB_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC})
|
||||
else ()
|
||||
add_library(${TARGET_NAME} ${LIB_SRCS} ${AUTOMTC_SRC} ${AUTOSCRIBE_SHADER_LIB_SRC})
|
||||
endif ()
|
||||
|
||||
set(${TARGET_NAME}_DEPENDENCY_QT_MODULES ${ARGN})
|
||||
list(APPEND ${TARGET_NAME}_DEPENDENCY_QT_MODULES Core)
|
||||
|
|
|
@ -18,7 +18,8 @@ include("${MACRO_DIR}/HifiLibrarySearchHints.cmake")
|
|||
hifi_library_search_hints("glm")
|
||||
|
||||
# locate header
|
||||
find_path(GLM_INCLUDE_DIR "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS})
|
||||
find_path(GLM_INCLUDE_DIR "glm/glm.hpp" HINTS ${GLM_SEARCH_DIRS} NO_CMAKE_FIND_ROOT_PATH)
|
||||
|
||||
set(GLM_INCLUDE_DIRS "${GLM_INCLUDE_DIR}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
|
|
@ -52,7 +52,9 @@ else ()
|
|||
set(_OPENSSL_ROOT_HINTS_AND_PATHS ${OPENSSL_SEARCH_DIRS})
|
||||
endif ()
|
||||
|
||||
find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} ${_OPENSSL_INCLUDEDIR} PATH_SUFFIXES include)
|
||||
find_path(OPENSSL_INCLUDE_DIR NAMES openssl/ssl.h HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} ${_OPENSSL_INCLUDEDIR}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
if (WIN32 AND NOT CYGWIN)
|
||||
if (MSVC)
|
||||
|
@ -133,7 +135,9 @@ else()
|
|||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} ${_OPENSSL_LIBDIR} PATH_SUFFIXES lib)
|
||||
find_library(OPENSSL_CRYPTO_LIBRARY NAMES crypto HINTS ${_OPENSSL_ROOT_HINTS_AND_PATHS} ${_OPENSSL_LIBDIR}
|
||||
PATH_SUFFIXES lib
|
||||
)
|
||||
|
||||
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
|||
|
||||
if (APPLE)
|
||||
set(_TBB_LIB_DIR "lib/libc++")
|
||||
elseif (UNIX)
|
||||
elseif (UNIX AND NOT ANDROID)
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(_TBB_ARCH_DIR "intel64")
|
||||
else()
|
||||
|
@ -56,6 +56,13 @@ elseif (WIN32)
|
|||
endif()
|
||||
|
||||
set(_TBB_LIB_DIR "lib/${_TBB_ARCH_DIR}/vc12")
|
||||
elseif (ANDROID)
|
||||
set(_TBB_DEFAULT_INSTALL_DIR "/tbb")
|
||||
set(_TBB_LIB_NAME "tbb")
|
||||
set(_TBB_LIB_DIR "lib")
|
||||
set(_TBB_LIB_MALLOC_NAME "${_TBB_LIB_NAME}malloc")
|
||||
set(_TBB_LIB_DEBUG_NAME "${_TBB_LIB_NAME}_debug")
|
||||
set(_TBB_LIB_MALLOC_DEBUG_NAME "${_TBB_LIB_MALLOC_NAME}_debug")
|
||||
endif ()
|
||||
|
||||
find_library(TBB_LIBRARY_DEBUG NAMES ${_TBB_LIB_NAME}_debug PATH_SUFFIXES ${_TBB_LIB_DIR} HINTS ${TBB_SEARCH_DIRS})
|
||||
|
|
|
@ -905,10 +905,10 @@ void DomainServer::sendDomainListToNode(const SharedNodePointer& node, const Hif
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// always write the last broadcastPacket
|
||||
nodeList->writeDatagram(broadcastPacket, node, senderSockAddr);
|
||||
}
|
||||
|
||||
// always write the last broadcastPacket
|
||||
nodeList->writeDatagram(broadcastPacket, node, senderSockAddr);
|
||||
}
|
||||
|
||||
void DomainServer::readAvailableDatagrams() {
|
||||
|
|
30
gvr-interface/CMakeLists.txt
Normal file
30
gvr-interface/CMakeLists.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
set(TARGET_NAME gvr-interface)
|
||||
|
||||
set(ANDROID_APK_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk-build")
|
||||
set(ANDROID_APK_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/apk")
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${ANDROID_APK_OUTPUT_DIR}/libs/${ANDROID_ABI}")
|
||||
set(BUILD_SHARED_LIBS ON)
|
||||
|
||||
setup_hifi_library(Gui Widgets)
|
||||
|
||||
include_glm()
|
||||
|
||||
link_hifi_libraries(shared networking audio-client)
|
||||
include_dependency_includes()
|
||||
|
||||
set(ANDROID_SDK_ROOT $ENV{ANDROID_HOME})
|
||||
set(ANDROID_APP_DISPLAY_NAME Interface)
|
||||
set(ANDROID_API_LEVEL 19)
|
||||
set(ANDROID_APK_PACKAGE io.highfidelity.gvrinterface)
|
||||
|
||||
# we need VRLib, so add a project.properties to our apk build folder that says that
|
||||
find_path(_OCULUS_VRLIB_DIR NAME VRLib.vcxproj HINTS "/ovr_mobile_sdk/VRLib/")
|
||||
if (NOT _OCULUS_VRLIB_DIR)
|
||||
message(FATAL_ERROR "Could not find Oculus Mobile SDK VRLib.")
|
||||
endif()
|
||||
|
||||
file(RELATIVE_PATH RELATIVE_VRLIB_PATH ${ANDROID_APK_OUTPUT_DIR} "${_OCULUS_VRLIB_DIR}")
|
||||
file(WRITE "${ANDROID_APK_BUILD_DIR}/project.properties" "android.library.reference.1=${RELATIVE_VRLIB_PATH}")
|
||||
|
||||
qt_create_apk()
|
BIN
gvr-interface/res/drawable/icon.png
Normal file
BIN
gvr-interface/res/drawable/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
73
gvr-interface/src/Client.cpp
Normal file
73
gvr-interface/src/Client.cpp
Normal file
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// Client.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtCore/QThread>
|
||||
|
||||
#include <AddressManager.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
Client::Client(QObject* parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
// we need to make sure that required dependencies are created
|
||||
DependencyManager::set<AddressManager>();
|
||||
|
||||
setupNetworking();
|
||||
}
|
||||
|
||||
void Client::setupNetworking() {
|
||||
// setup the NodeList for this client
|
||||
DependencyManager::registerInheritance<LimitedNodeList, NodeList>();
|
||||
auto nodeList = DependencyManager::set<NodeList>(NodeType::Agent, 0);
|
||||
|
||||
// while datagram processing remains simple for targets using Client, we'll handle datagrams
|
||||
connect(&nodeList->getNodeSocket(), &QUdpSocket::readyRead, this, &Client::processDatagrams);
|
||||
|
||||
// every second, ask the NodeList to check in with the domain server
|
||||
QTimer* domainCheckInTimer = new QTimer(this);
|
||||
domainCheckInTimer->setInterval(DOMAIN_SERVER_CHECK_IN_MSECS);
|
||||
connect(domainCheckInTimer, &QTimer::timeout, nodeList.data(), &NodeList::sendDomainServerCheckIn);
|
||||
|
||||
// TODO: once the Client knows its Address on start-up we should be able to immediately send a check in here
|
||||
domainCheckInTimer->start();
|
||||
|
||||
// handle the case where the domain stops talking to us
|
||||
// TODO: can we just have the nodelist do this when it sets up? Is there a user of the NodeList that wouldn't want this?
|
||||
connect(nodeList.data(), &NodeList::limitOfSilentDomainCheckInsReached, nodeList.data(), &NodeList::reset);
|
||||
}
|
||||
|
||||
void Client::processDatagrams() {
|
||||
HifiSockAddr senderSockAddr;
|
||||
|
||||
static QByteArray incomingPacket;
|
||||
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
|
||||
while (DependencyManager::get<NodeList>()->getNodeSocket().hasPendingDatagrams()) {
|
||||
incomingPacket.resize(nodeList->getNodeSocket().pendingDatagramSize());
|
||||
nodeList->getNodeSocket().readDatagram(incomingPacket.data(), incomingPacket.size(),
|
||||
senderSockAddr.getAddressPointer(), senderSockAddr.getPortPointer());
|
||||
|
||||
if (nodeList->packetVersionAndHashMatch(incomingPacket)) {
|
||||
|
||||
PacketType incomingType = packetTypeForPacket(incomingPacket);
|
||||
// only process this packet if we have a match on the packet version
|
||||
switch (incomingType) {
|
||||
default:
|
||||
nodeList->processNodeData(senderSockAddr, incomingPacket);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
gvr-interface/src/Client.h
Normal file
29
gvr-interface/src/Client.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// Client.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_Client_h
|
||||
#define hifi_Client_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class QThread;
|
||||
|
||||
class Client : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
Client(QObject* parent = 0);
|
||||
private:
|
||||
void setupNetworking();
|
||||
private slots:
|
||||
void processDatagrams();
|
||||
};
|
||||
|
||||
#endif // hifi_Client_h
|
23
gvr-interface/src/GVRInterface.cpp
Normal file
23
gvr-interface/src/GVRInterface.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// GVRInterface.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/18/14.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
#include "RenderingClient.h"
|
||||
|
||||
#include "GVRInterface.h"
|
||||
|
||||
GVRInterface::GVRInterface(int argc, char* argv[]) :
|
||||
QApplication(argc, argv)
|
||||
{
|
||||
_client = new RenderingClient(this);
|
||||
}
|
35
gvr-interface/src/GVRInterface.h
Normal file
35
gvr-interface/src/GVRInterface.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// GVRInterface.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/18/14.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_GVRInterface_h
|
||||
#define hifi_GVRInterface_h
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
class RenderingClient;
|
||||
|
||||
#if defined(qApp)
|
||||
#undef qApp
|
||||
#endif
|
||||
#define qApp (static_cast<GVRInterface*>(QApplication::instance()))
|
||||
|
||||
class GVRInterface : public QApplication {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GVRInterface(int argc, char* argv[]);
|
||||
|
||||
RenderingClient* getClient() { return _client; }
|
||||
|
||||
private:
|
||||
RenderingClient* _client;
|
||||
};
|
||||
|
||||
#endif // hifi_GVRInterface_h
|
63
gvr-interface/src/GVRMainWindow.cpp
Normal file
63
gvr-interface/src/GVRMainWindow.cpp
Normal file
|
@ -0,0 +1,63 @@
|
|||
//
|
||||
// GVRMainWindow.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/14.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QtWidgets/QVBoxLayout>
|
||||
#include <QtWidgets/QInputDialog>
|
||||
#include <QtWidgets/QMenuBar>
|
||||
|
||||
#include <AddressManager.h>
|
||||
|
||||
#include "RenderingClient.h"
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
|
||||
GVRMainWindow::GVRMainWindow(QWidget* parent) :
|
||||
QMainWindow(parent)
|
||||
{
|
||||
QMenu* fileMenu = new QMenu("File");
|
||||
QMenu* helpMenu = new QMenu("Help");
|
||||
|
||||
menuBar()->addMenu(fileMenu);
|
||||
menuBar()->addMenu(helpMenu);
|
||||
|
||||
QAction* goToAddress = new QAction("Go to Address", fileMenu);
|
||||
QAction* aboutQt = new QAction("About Qt", helpMenu);
|
||||
|
||||
fileMenu->addAction(goToAddress);
|
||||
helpMenu->addAction(aboutQt);
|
||||
|
||||
connect(goToAddress, &QAction::triggered, this, &GVRMainWindow::showAddressBar);
|
||||
connect(aboutQt, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||
|
||||
QWidget* baseWidget = new QWidget(this);
|
||||
|
||||
// setup a layout so we can vertically align to top
|
||||
_mainLayout = new QVBoxLayout(baseWidget);
|
||||
_mainLayout->setAlignment(Qt::AlignTop);
|
||||
|
||||
// set the layout on the base widget
|
||||
baseWidget->setLayout(_mainLayout);
|
||||
|
||||
setCentralWidget(baseWidget);
|
||||
}
|
||||
|
||||
void GVRMainWindow::showAddressBar() {
|
||||
// setup the address QInputDialog
|
||||
QInputDialog* addressDialog = new QInputDialog(this);
|
||||
addressDialog->setLabelText("Address");
|
||||
|
||||
// add the address dialog to the main layout
|
||||
_mainLayout->addWidget(addressDialog);
|
||||
|
||||
connect(addressDialog, &QInputDialog::textValueSelected,
|
||||
DependencyManager::get<AddressManager>().data(), &AddressManager::handleLookupString);
|
||||
}
|
29
gvr-interface/src/GVRMainWindow.h
Normal file
29
gvr-interface/src/GVRMainWindow.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// GVRMainWindow.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/14.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_GVRMainWindow_h
|
||||
#define hifi_GVRMainWindow_h
|
||||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
|
||||
class QVBoxLayout;
|
||||
|
||||
class GVRMainWindow : public QMainWindow {
|
||||
Q_OBJECT
|
||||
public:
|
||||
GVRMainWindow(QWidget* parent = 0);
|
||||
public slots:
|
||||
void showAddressBar();
|
||||
private:
|
||||
QVBoxLayout* _mainLayout;
|
||||
};
|
||||
|
||||
#endif // hifi_GVRMainWindow_h
|
23
gvr-interface/src/RenderingClient.cpp
Normal file
23
gvr-interface/src/RenderingClient.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// RenderingClient.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <QtWidgets/QInputDialog>
|
||||
|
||||
#include <NodeList.h>
|
||||
|
||||
#include "RenderingClient.h"
|
||||
|
||||
RenderingClient::RenderingClient(QObject *parent) :
|
||||
Client(parent)
|
||||
{
|
||||
// tell the NodeList which node types all rendering clients will want to know about
|
||||
DependencyManager::get<NodeList>()->addSetOfNodeTypesToNodeInterestSet(NodeSet() << NodeType::AudioMixer);
|
||||
}
|
24
gvr-interface/src/RenderingClient.h
Normal file
24
gvr-interface/src/RenderingClient.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// RenderingClient.h
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/20/15.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#ifndef hifi_RenderingClient_h
|
||||
#define hifi_RenderingClient_h
|
||||
|
||||
#include "Client.h"
|
||||
|
||||
class RenderingClient : public Client {
|
||||
Q_OBJECT
|
||||
public:
|
||||
RenderingClient(QObject* parent = 0);
|
||||
};
|
||||
|
||||
#endif // hifi_RenderingClient_h
|
22
gvr-interface/src/main.cpp
Normal file
22
gvr-interface/src/main.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
//
|
||||
// main.cpp
|
||||
// gvr-interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 11/17/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
//
|
||||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "GVRMainWindow.h"
|
||||
#include "GVRInterface.h"
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
GVRInterface app(argc, argv);
|
||||
|
||||
GVRMainWindow mainWindow;
|
||||
mainWindow.showMaximized();
|
||||
|
||||
return app.exec();
|
||||
}
|
|
@ -2,7 +2,7 @@ set(TARGET_NAME interface)
|
|||
project(${TARGET_NAME})
|
||||
|
||||
# set a default root dir for each of our optional externals if it was not passed
|
||||
set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "Gverb" "RSSDK")
|
||||
set(OPTIONAL_EXTERNALS "Faceshift" "LibOVR" "PrioVR" "Sixense" "LeapMotion" "RtMidi" "Qxmpp" "SDL2" "RSSDK")
|
||||
foreach(EXTERNAL ${OPTIONAL_EXTERNALS})
|
||||
string(TOUPPER ${EXTERNAL} ${EXTERNAL}_UPPERCASE)
|
||||
if (NOT ${${EXTERNAL}_UPPERCASE}_ROOT_DIR)
|
||||
|
@ -14,10 +14,6 @@ endforeach()
|
|||
find_package(Qt5LinguistTools REQUIRED)
|
||||
find_package(Qt5LinguistToolsMacros)
|
||||
|
||||
|
||||
# As Gverb is currently the only reverb library, it's required.
|
||||
find_package(Gverb REQUIRED)
|
||||
|
||||
if (DEFINED ENV{JOB_ID})
|
||||
set(BUILD_SEQ $ENV{JOB_ID})
|
||||
else ()
|
||||
|
@ -108,7 +104,8 @@ endif()
|
|||
add_executable(${TARGET_NAME} MACOSX_BUNDLE ${INTERFACE_SRCS} ${QM})
|
||||
|
||||
# link required hifi libraries
|
||||
link_hifi_libraries(shared octree environment gpu model fbx metavoxels networking entities avatars audio animation script-engine physics
|
||||
link_hifi_libraries(shared octree environment gpu model fbx metavoxels networking entities avatars
|
||||
audio audio-client animation script-engine physics
|
||||
render-utils entities-renderer)
|
||||
|
||||
# find any optional and required libraries
|
||||
|
@ -173,13 +170,6 @@ if (QXMPP_FOUND AND NOT DISABLE_QXMPP AND WIN32)
|
|||
add_definitions(-DQXMPP_STATIC)
|
||||
endif ()
|
||||
|
||||
if (GVERB_FOUND)
|
||||
file(GLOB GVERB_SRCS ${GVERB_SRC_DIRS}/*.c)
|
||||
include_directories(${GVERB_INCLUDE_DIRS})
|
||||
add_library(gverb STATIC ${GVERB_SRCS})
|
||||
target_link_libraries(${TARGET_NAME} gverb)
|
||||
endif (GVERB_FOUND)
|
||||
|
||||
# include headers for interface and InterfaceConfig.
|
||||
include_directories("${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/includes")
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ bool setupEssentials(int& argc, char** argv) {
|
|||
auto geometryCache = DependencyManager::set<GeometryCache>();
|
||||
auto glowEffect = DependencyManager::set<GlowEffect>();
|
||||
auto faceshift = DependencyManager::set<Faceshift>();
|
||||
auto audio = DependencyManager::set<Audio>();
|
||||
auto audio = DependencyManager::set<AudioClient>();
|
||||
auto audioScope = DependencyManager::set<AudioScope>();
|
||||
auto audioIOStatsRenderer = DependencyManager::set<AudioIOStatsRenderer>();
|
||||
auto deferredLightingEffect = DependencyManager::set<DeferredLightingEffect>();
|
||||
|
@ -278,9 +278,13 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
// put the audio processing on a separate thread
|
||||
QThread* audioThread = new QThread(this);
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
|
||||
audioIO->setPositionGetter(getPositionForAudio);
|
||||
audioIO->setOrientationGetter(getOrientationForAudio);
|
||||
|
||||
audioIO->moveToThread(audioThread);
|
||||
connect(audioThread, &QThread::started, audioIO.data(), &Audio::start);
|
||||
connect(audioThread, &QThread::started, audioIO.data(), &AudioClient::start);
|
||||
|
||||
audioThread->start();
|
||||
|
||||
|
@ -476,7 +480,7 @@ Application::~Application() {
|
|||
// kill any audio injectors that are still around
|
||||
AudioScriptingInterface::getInstance().stopAllInjectors();
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
|
||||
// stop the audio process
|
||||
QMetaObject::invokeMethod(audioIO.data(), "stop", Qt::BlockingQueuedConnection);
|
||||
|
@ -2117,7 +2121,7 @@ void Application::update(float deltaTime) {
|
|||
if (sinceLastNack > TOO_LONG_SINCE_LAST_SEND_DOWNSTREAM_AUDIO_STATS) {
|
||||
_lastSendDownstreamAudioStats = now;
|
||||
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "sendDownstreamAudioStatsPacket", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "sendDownstreamAudioStatsPacket", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3113,7 +3117,7 @@ void Application::resetSensors() {
|
|||
|
||||
_myAvatar->reset();
|
||||
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "reset", Qt::QueuedConnection);
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "reset", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
static void setShortcutsEnabled(QWidget* widget, bool enabled) {
|
||||
|
@ -3253,7 +3257,7 @@ void Application::nodeKilled(SharedNodePointer node) {
|
|||
_entityEditSender.nodeKilled(node);
|
||||
|
||||
if (node->getType() == NodeType::AudioMixer) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "audioMixerKilled");
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "audioMixerKilled");
|
||||
}
|
||||
|
||||
if (node->getType() == NodeType::EntityServer) {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <TextureCache.h>
|
||||
#include <ViewFrustum.h>
|
||||
|
||||
#include "Audio.h"
|
||||
#include "AudioClient.h"
|
||||
#include "Bookmarks.h"
|
||||
#include "Camera.h"
|
||||
#include "DatagramProcessor.h"
|
||||
|
@ -132,6 +132,8 @@ public:
|
|||
static Application* getInstance() { return static_cast<Application*>(QCoreApplication::instance()); }
|
||||
static const glm::vec3& getPositionForPath() { return getInstance()->_myAvatar->getPosition(); }
|
||||
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();
|
||||
|
|
|
@ -54,15 +54,15 @@ void DatagramProcessor::processDatagrams() {
|
|||
case PacketTypeMixedAudio:
|
||||
case PacketTypeSilentAudioFrame: {
|
||||
if (incomingType == PacketTypeAudioStreamStats) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "parseAudioStreamStatsPacket",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "parseAudioStreamStatsPacket",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
} else if (incomingType == PacketTypeAudioEnvironment) {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "parseAudioEnvironmentData",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "parseAudioEnvironmentData",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
} else {
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "addReceivedAudioToStream",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "addReceivedAudioToStream",
|
||||
Qt::QueuedConnection,
|
||||
Q_ARG(QByteArray, incomingPacket));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
}
|
||||
case PacketTypeNoisyMute:
|
||||
case PacketTypeMuteEnvironment: {
|
||||
bool mute = !DependencyManager::get<Audio>()->isMuted();
|
||||
bool mute = !DependencyManager::get<AudioClient>()->isMuted();
|
||||
|
||||
if (incomingType == PacketTypeMuteEnvironment) {
|
||||
glm::vec3 position;
|
||||
|
@ -144,7 +144,7 @@ void DatagramProcessor::processDatagrams() {
|
|||
}
|
||||
|
||||
if (mute) {
|
||||
DependencyManager::get<Audio>()->toggleMute();
|
||||
DependencyManager::get<AudioClient>()->toggleMute();
|
||||
if (incomingType == PacketTypeMuteEnvironment) {
|
||||
AudioScriptingInterface::getInstance().environmentMuted();
|
||||
} else {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// FileUtils.cpp
|
||||
// libraries/shared/src
|
||||
// interface/src
|
||||
//
|
||||
// Created by Stojce Slavkovski on 12/23/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
||||
|
@ -9,9 +9,14 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include <qdir.h>
|
||||
#include <qfileinfo.h>
|
||||
#include <qdesktopservices.h>
|
||||
#include <qprocess.h>
|
||||
#include <qurl.h>
|
||||
|
||||
#include "FileUtils.h"
|
||||
#include <QtCore>
|
||||
#include <QDesktopServices>
|
||||
|
||||
|
||||
void FileUtils::locateFile(QString filePath) {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// FileUtils.h
|
||||
// libraries/shared/src
|
||||
// interface/src
|
||||
//
|
||||
// Created by Stojce Slavkovski on 12/23/13.
|
||||
// Copyright 2013 High Fidelity, Inc.
|
|
@ -31,6 +31,7 @@
|
|||
|
||||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <AudioClient.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <MainWindow.h>
|
||||
#include <GlowEffect.h>
|
||||
|
@ -41,7 +42,6 @@
|
|||
|
||||
#include "Application.h"
|
||||
#include "AccountManager.h"
|
||||
#include "Audio.h"
|
||||
#include "audio/AudioIOStatsRenderer.h"
|
||||
#include "audio/AudioScope.h"
|
||||
#include "devices/RealSense.h"
|
||||
|
@ -490,7 +490,7 @@ Menu::Menu() :
|
|||
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::PipelineWarnings);
|
||||
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::SuppressShortTimings);
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
QMenu* audioDebugMenu = developerMenu->addMenu("Audio");
|
||||
addCheckableActionToQMenuAndActionHash(audioDebugMenu, MenuOption::AudioNoiseReduction,
|
||||
0,
|
||||
|
@ -615,7 +615,7 @@ void Menu::loadSettings(QSettings* settings) {
|
|||
_receivedAudioStreamSettings._windowSecondsForDesiredReduction = settings->value("windowSecondsForDesiredReduction", DEFAULT_WINDOW_SECONDS_FOR_DESIRED_REDUCTION).toInt();
|
||||
_receivedAudioStreamSettings._repetitionWithFade = settings->value("repetitionWithFade", DEFAULT_REPETITION_WITH_FADE).toBool();
|
||||
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
audio->setOutputStarveDetectionEnabled(settings->value("audioOutputStarveDetectionEnabled", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_ENABLED).toBool());
|
||||
audio->setOutputStarveDetectionThreshold(settings->value("audioOutputStarveDetectionThreshold", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_THRESHOLD).toInt());
|
||||
audio->setOutputStarveDetectionPeriod(settings->value("audioOutputStarveDetectionPeriod", DEFAULT_AUDIO_OUTPUT_STARVE_DETECTION_PERIOD).toInt());
|
||||
|
@ -680,7 +680,7 @@ void Menu::saveSettings(QSettings* settings) {
|
|||
settings->setValue("windowSecondsForDesiredReduction", _receivedAudioStreamSettings._windowSecondsForDesiredReduction);
|
||||
settings->setValue("repetitionWithFade", _receivedAudioStreamSettings._repetitionWithFade);
|
||||
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
settings->setValue("audioOutputStarveDetectionEnabled", audio->getOutputStarveDetectionEnabled());
|
||||
settings->setValue("audioOutputStarveDetectionThreshold", audio->getOutputStarveDetectionThreshold());
|
||||
settings->setValue("audioOutputStarveDetectionPeriod", audio->getOutputStarveDetectionPeriod());
|
||||
|
@ -1297,7 +1297,7 @@ void Menu::toggleToolWindow() {
|
|||
void Menu::audioMuteToggled() {
|
||||
QAction *muteAction = _actionHash.value(MenuOption::MuteAudio);
|
||||
if (muteAction) {
|
||||
muteAction->setChecked(DependencyManager::get<Audio>()->isMuted());
|
||||
muteAction->setChecked(DependencyManager::get<AudioClient>()->isMuted());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// UIUtil.cpp
|
||||
// library/shared/src
|
||||
// interface/src
|
||||
//
|
||||
// Created by Ryan Huffman on 09/02/2014.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// UIUtil.h
|
||||
// library/shared/src
|
||||
// interface/src
|
||||
//
|
||||
// Created by Ryan Huffman on 09/02/2014.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
|
@ -11,15 +11,14 @@
|
|||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <AudioClient.h>
|
||||
#include <AudioConstants.h>
|
||||
#include <AudioIOStats.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GeometryCache.h>
|
||||
#include <NodeList.h>
|
||||
#include <Util.h>
|
||||
|
||||
#include "Audio.h"
|
||||
#include "AudioIOStats.h"
|
||||
|
||||
#include "AudioIOStatsRenderer.h"
|
||||
|
||||
AudioIOStatsRenderer::AudioIOStatsRenderer() :
|
||||
|
@ -28,7 +27,7 @@ AudioIOStatsRenderer::AudioIOStatsRenderer() :
|
|||
_shouldShowInjectedStreams(false)
|
||||
{
|
||||
// grab the stats object from the audio I/O singleton
|
||||
_stats = &DependencyManager::get<Audio>()->getStats();
|
||||
_stats = &DependencyManager::get<AudioClient>()->getStats();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -13,11 +13,10 @@
|
|||
|
||||
#include <limits>
|
||||
|
||||
#include <AudioClient.h>
|
||||
#include <AudioConstants.h>
|
||||
#include <GeometryCache.h>
|
||||
|
||||
#include "Audio.h"
|
||||
|
||||
#include "AudioScope.h"
|
||||
|
||||
static const unsigned int DEFAULT_FRAMES_PER_SCOPE = 5;
|
||||
|
@ -41,14 +40,14 @@ AudioScope::AudioScope() :
|
|||
_outputLeftID(DependencyManager::get<GeometryCache>()->allocateID()),
|
||||
_outputRightD(DependencyManager::get<GeometryCache>()->allocateID())
|
||||
{
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
connect(&audioIO->getReceivedAudioStream(), &MixedProcessedAudioStream::addedSilence,
|
||||
this, &AudioScope::addStereoSilenceToScope);
|
||||
connect(&audioIO->getReceivedAudioStream(), &MixedProcessedAudioStream::addedLastFrameRepeatedWithFade,
|
||||
this, &AudioScope::addLastFrameRepeatedWithFadeToScope);
|
||||
connect(&audioIO->getReceivedAudioStream(), &MixedProcessedAudioStream::addedStereoSamples,
|
||||
this, &AudioScope::addStereoSamplesToScope);
|
||||
connect(audioIO.data(), &Audio::inputReceived, this, &AudioScope::addInputToScope);
|
||||
connect(audioIO.data(), &AudioClient::inputReceived, this, &AudioScope::addInputToScope);
|
||||
}
|
||||
|
||||
void AudioScope::toggle() {
|
||||
|
|
|
@ -11,12 +11,11 @@
|
|||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <AudioClient.h>
|
||||
#include <GLCanvas.h>
|
||||
#include <PathUtils.h>
|
||||
#include <GeometryCache.h>
|
||||
|
||||
#include "Audio.h"
|
||||
|
||||
#include "AudioToolBox.h"
|
||||
|
||||
// Mute icon configration
|
||||
|
@ -29,7 +28,7 @@ AudioToolBox::AudioToolBox() :
|
|||
|
||||
bool AudioToolBox::mousePressEvent(int x, int y) {
|
||||
if (_iconBounds.contains(x, y)) {
|
||||
DependencyManager::get<Audio>()->toggleMute();
|
||||
DependencyManager::get<AudioClient>()->toggleMute();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -49,7 +48,7 @@ void AudioToolBox::render(int x, int y, bool boxed) {
|
|||
_boxTextureId = glCanvas->bindTexture(QImage(PathUtils::resourcesPath() + "images/audio-box.svg"));
|
||||
}
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
|
||||
if (boxed) {
|
||||
bool isClipping = ((audioIO->getTimeSinceLastClip() > 0.0f) && (audioIO->getTimeSinceLastClip() < 1.0f));
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <AccountManager.h>
|
||||
#include <AddressManager.h>
|
||||
#include <AnimationHandle.h>
|
||||
#include <AudioClient.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <GeometryUtil.h>
|
||||
#include <NodeList.h>
|
||||
|
@ -33,7 +34,6 @@
|
|||
#include <TextRenderer.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Audio.h"
|
||||
#include "Environment.h"
|
||||
#include "Menu.h"
|
||||
#include "ModelReferential.h"
|
||||
|
@ -146,7 +146,7 @@ void MyAvatar::update(float deltaTime) {
|
|||
head->relaxLean(deltaTime);
|
||||
updateFromTrackers(deltaTime);
|
||||
// Get audio loudness data from audio input device
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
head->setAudioLoudness(audio->getLastInputLoudness());
|
||||
head->setAudioAverageLoudness(audio->getAudioAverageInputLoudness());
|
||||
|
||||
|
@ -490,7 +490,7 @@ void MyAvatar::startRecording() {
|
|||
if (!_recorder) {
|
||||
_recorder = RecorderPointer(new Recorder(this));
|
||||
}
|
||||
DependencyManager::get<Audio>()->setRecorder(_recorder);
|
||||
DependencyManager::get<AudioClient>()->setRecorder(_recorder);
|
||||
_recorder->startRecording();
|
||||
|
||||
}
|
||||
|
|
|
@ -19,13 +19,13 @@ AudioDeviceScriptingInterface* AudioDeviceScriptingInterface::getInstance() {
|
|||
}
|
||||
|
||||
AudioDeviceScriptingInterface::AudioDeviceScriptingInterface() {
|
||||
connect(DependencyManager::get<Audio>().data(), &Audio::muteToggled,
|
||||
connect(DependencyManager::get<AudioClient>().data(), &AudioClient::muteToggled,
|
||||
this, &AudioDeviceScriptingInterface::muteToggled);
|
||||
}
|
||||
|
||||
bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) {
|
||||
bool result;
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "switchInputToAudioDevice",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchInputToAudioDevice",
|
||||
Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, result),
|
||||
Q_ARG(const QString&, deviceName));
|
||||
|
@ -35,7 +35,7 @@ bool AudioDeviceScriptingInterface::setInputDevice(const QString& deviceName) {
|
|||
|
||||
bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) {
|
||||
bool result;
|
||||
QMetaObject::invokeMethod(DependencyManager::get<Audio>().data(), "switchOutputToAudioDevice",
|
||||
QMetaObject::invokeMethod(DependencyManager::get<AudioClient>().data(), "switchOutputToAudioDevice",
|
||||
Qt::BlockingQueuedConnection,
|
||||
Q_RETURN_ARG(bool, result),
|
||||
Q_ARG(const QString&, deviceName));
|
||||
|
@ -44,50 +44,50 @@ bool AudioDeviceScriptingInterface::setOutputDevice(const QString& deviceName) {
|
|||
}
|
||||
|
||||
QString AudioDeviceScriptingInterface::getInputDevice() {
|
||||
return DependencyManager::get<Audio>()->getDeviceName(QAudio::AudioInput);
|
||||
return DependencyManager::get<AudioClient>()->getDeviceName(QAudio::AudioInput);
|
||||
}
|
||||
|
||||
QString AudioDeviceScriptingInterface::getOutputDevice() {
|
||||
return DependencyManager::get<Audio>()->getDeviceName(QAudio::AudioOutput);
|
||||
return DependencyManager::get<AudioClient>()->getDeviceName(QAudio::AudioOutput);
|
||||
}
|
||||
|
||||
QString AudioDeviceScriptingInterface::getDefaultInputDevice() {
|
||||
return DependencyManager::get<Audio>()->getDefaultDeviceName(QAudio::AudioInput);
|
||||
return DependencyManager::get<AudioClient>()->getDefaultDeviceName(QAudio::AudioInput);
|
||||
}
|
||||
|
||||
QString AudioDeviceScriptingInterface::getDefaultOutputDevice() {
|
||||
return DependencyManager::get<Audio>()->getDefaultDeviceName(QAudio::AudioOutput);
|
||||
return DependencyManager::get<AudioClient>()->getDefaultDeviceName(QAudio::AudioOutput);
|
||||
}
|
||||
|
||||
QVector<QString> AudioDeviceScriptingInterface::getInputDevices() {
|
||||
return DependencyManager::get<Audio>()->getDeviceNames(QAudio::AudioInput);
|
||||
return DependencyManager::get<AudioClient>()->getDeviceNames(QAudio::AudioInput);
|
||||
}
|
||||
|
||||
QVector<QString> AudioDeviceScriptingInterface::getOutputDevices() {
|
||||
return DependencyManager::get<Audio>()->getDeviceNames(QAudio::AudioOutput);
|
||||
return DependencyManager::get<AudioClient>()->getDeviceNames(QAudio::AudioOutput);
|
||||
}
|
||||
|
||||
|
||||
float AudioDeviceScriptingInterface::getInputVolume() {
|
||||
return DependencyManager::get<Audio>()->getInputVolume();
|
||||
return DependencyManager::get<AudioClient>()->getInputVolume();
|
||||
}
|
||||
|
||||
void AudioDeviceScriptingInterface::setInputVolume(float volume) {
|
||||
DependencyManager::get<Audio>()->setInputVolume(volume);
|
||||
DependencyManager::get<AudioClient>()->setInputVolume(volume);
|
||||
}
|
||||
|
||||
void AudioDeviceScriptingInterface::setReverb(bool reverb) {
|
||||
DependencyManager::get<Audio>()->setReverb(reverb);
|
||||
DependencyManager::get<AudioClient>()->setReverb(reverb);
|
||||
}
|
||||
|
||||
void AudioDeviceScriptingInterface::setReverbOptions(const AudioEffectOptions* options) {
|
||||
DependencyManager::get<Audio>()->setReverbOptions(options);
|
||||
DependencyManager::get<AudioClient>()->setReverbOptions(options);
|
||||
}
|
||||
|
||||
void AudioDeviceScriptingInterface::toggleMute() {
|
||||
DependencyManager::get<Audio>()->toggleMute();
|
||||
DependencyManager::get<AudioClient>()->toggleMute();
|
||||
}
|
||||
|
||||
bool AudioDeviceScriptingInterface::getMuted() {
|
||||
return DependencyManager::get<Audio>()->isMuted();
|
||||
return DependencyManager::get<AudioClient>()->isMuted();
|
||||
}
|
||||
|
|
|
@ -787,7 +787,7 @@ void ApplicationOverlay::renderMagnifier(glm::vec2 magPos, float sizeMult, bool
|
|||
|
||||
void ApplicationOverlay::renderAudioMeter() {
|
||||
auto glCanvas = DependencyManager::get<GLCanvas>();
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
|
||||
// Audio VU Meter and Mute Icon
|
||||
const int MUTE_ICON_SIZE = 24;
|
||||
|
|
|
@ -11,8 +11,9 @@
|
|||
|
||||
#include <QFileDialog>
|
||||
|
||||
#include <AudioClient.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "Audio.h"
|
||||
#include "MainWindow.h"
|
||||
#include "Menu.h"
|
||||
#include "ModelsBrowser.h"
|
||||
|
@ -140,7 +141,7 @@ void PreferencesDialog::loadPreferences() {
|
|||
ui.windowSecondsForDesiredReductionSpin->setValue(streamSettings._windowSecondsForDesiredReduction);
|
||||
ui.repetitionWithFadeCheckBox->setChecked(streamSettings._repetitionWithFade);
|
||||
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
ui.outputBufferSizeSpinner->setValue(audio->getOutputBufferSize());
|
||||
|
||||
ui.outputStarveDetectionCheckBox->setChecked(audio->getOutputStarveDetectionEnabled());
|
||||
|
@ -256,7 +257,7 @@ void PreferencesDialog::savePreferences() {
|
|||
|
||||
Menu::getInstance()->setReceivedAudioStreamSettings(streamSettings);
|
||||
|
||||
auto audio = DependencyManager::get<Audio>();
|
||||
auto audio = DependencyManager::get<AudioClient>();
|
||||
|
||||
QMetaObject::invokeMethod(audio.data(), "setOutputBufferSize", Q_ARG(int, ui.outputBufferSizeSpinner->value()));
|
||||
|
||||
|
|
21
libraries/audio-client/CMakeLists.txt
Normal file
21
libraries/audio-client/CMakeLists.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
set(TARGET_NAME audio-client)
|
||||
|
||||
# use setup_hifi_library macro to setup our project and link appropriate Qt modules
|
||||
setup_hifi_library(Network)
|
||||
|
||||
link_hifi_libraries(audio)
|
||||
|
||||
set(GVERB_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/external/gverb")
|
||||
|
||||
# As Gverb is currently the only reverb library, it's required.
|
||||
find_package(Gverb REQUIRED)
|
||||
|
||||
file(GLOB GVERB_SRCS ${GVERB_SRC_DIRS}/*.c)
|
||||
add_library(gverb STATIC ${GVERB_SRCS})
|
||||
target_link_libraries(${TARGET_NAME} gverb)
|
||||
|
||||
# append gverb includes to our list of includes to bubble
|
||||
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()
|
234
libraries/audio-client/external/gverb/include/gverb.h
vendored
Executable file
234
libraries/audio-client/external/gverb/include/gverb.h
vendored
Executable file
|
@ -0,0 +1,234 @@
|
|||
/*
|
||||
|
||||
Copyright (C) 1999 Juhana Sadeharju
|
||||
kouhia at nic.funet.fi
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef GVERB_H
|
||||
#define GVERB_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "gverbdsp.h"
|
||||
#include "gverb.h"
|
||||
#include "ladspa-util.h"
|
||||
|
||||
#define FDNORDER 4
|
||||
|
||||
typedef struct {
|
||||
int rate;
|
||||
float inputbandwidth;
|
||||
float taillevel;
|
||||
float earlylevel;
|
||||
ty_damper *inputdamper;
|
||||
float maxroomsize;
|
||||
float roomsize;
|
||||
float revtime;
|
||||
float maxdelay;
|
||||
float largestdelay;
|
||||
ty_fixeddelay **fdndels;
|
||||
float *fdngains;
|
||||
int *fdnlens;
|
||||
ty_damper **fdndamps;
|
||||
float fdndamping;
|
||||
ty_diffuser **ldifs;
|
||||
ty_diffuser **rdifs;
|
||||
ty_fixeddelay *tapdelay;
|
||||
int *taps;
|
||||
float *tapgains;
|
||||
float *d;
|
||||
float *u;
|
||||
float *f;
|
||||
double alpha;
|
||||
} ty_gverb;
|
||||
|
||||
|
||||
ty_gverb *gverb_new(int, float, float, float, float, float, float, float, float);
|
||||
void gverb_free(ty_gverb *);
|
||||
void gverb_flush(ty_gverb *);
|
||||
static void gverb_do(ty_gverb *, float, float *, float *);
|
||||
static void gverb_set_roomsize(ty_gverb *, float);
|
||||
static void gverb_set_revtime(ty_gverb *, float);
|
||||
static void gverb_set_damping(ty_gverb *, float);
|
||||
static void gverb_set_inputbandwidth(ty_gverb *, float);
|
||||
static void gverb_set_earlylevel(ty_gverb *, float);
|
||||
static void gverb_set_taillevel(ty_gverb *, float);
|
||||
|
||||
/*
|
||||
* This FDN reverb can be made smoother by setting matrix elements at the
|
||||
* diagonal and near of it to zero or nearly zero. By setting diagonals to zero
|
||||
* means we remove the effect of the parallel comb structure from the
|
||||
* reverberation. A comb generates uniform impulse stream to the reverberation
|
||||
* impulse response, and thus it is not good. By setting near diagonal elements
|
||||
* to zero means we remove delay sequences having consequtive delays of the
|
||||
* similar lenths, when the delays are in sorted in length with respect to
|
||||
* matrix element index. The matrix described here could be generated by
|
||||
* differencing Rocchesso's circulant matrix at max diffuse value and at low
|
||||
* diffuse value (approaching parallel combs).
|
||||
*
|
||||
* Example 1:
|
||||
* Set a(k,k), for all k, equal to 0.
|
||||
*
|
||||
* Example 2:
|
||||
* Set a(k,k), a(k,k-1) and a(k,k+1) equal to 0.
|
||||
*
|
||||
* Example 3: The transition to zero gains could be smooth as well.
|
||||
* a(k,k-1) and a(k,k+1) could be 0.3, and a(k,k-2) and a(k,k+2) could
|
||||
* be 0.5, say.
|
||||
*/
|
||||
|
||||
static __inline void gverb_fdnmatrix(float *a, float *b)
|
||||
{
|
||||
const float dl0 = a[0], dl1 = a[1], dl2 = a[2], dl3 = a[3];
|
||||
|
||||
b[0] = 0.5f*(+dl0 + dl1 - dl2 - dl3);
|
||||
b[1] = 0.5f*(+dl0 - dl1 - dl2 + dl3);
|
||||
b[2] = 0.5f*(-dl0 + dl1 - dl2 + dl3);
|
||||
b[3] = 0.5f*(+dl0 + dl1 + dl2 + dl3);
|
||||
}
|
||||
|
||||
static __inline void gverb_do(ty_gverb *p, float x, float *yl, float *yr)
|
||||
{
|
||||
float z;
|
||||
unsigned int i;
|
||||
float lsum,rsum,sum,sign;
|
||||
|
||||
if ((x != x) || fabsf(x) > 100000.0f) {
|
||||
x = 0.0f;
|
||||
}
|
||||
|
||||
z = damper_do(p->inputdamper, x);
|
||||
|
||||
z = diffuser_do(p->ldifs[0],z);
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->u[i] = p->tapgains[i]*fixeddelay_read(p->tapdelay,p->taps[i]);
|
||||
}
|
||||
fixeddelay_write(p->tapdelay,z);
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->d[i] = damper_do(p->fdndamps[i],
|
||||
p->fdngains[i]*fixeddelay_read(p->fdndels[i],
|
||||
p->fdnlens[i]));
|
||||
}
|
||||
|
||||
sum = 0.0f;
|
||||
sign = 1.0f;
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
sum += sign*(p->taillevel*p->d[i] + p->earlylevel*p->u[i]);
|
||||
sign = -sign;
|
||||
}
|
||||
sum += x*p->earlylevel;
|
||||
lsum = sum;
|
||||
rsum = sum;
|
||||
|
||||
gverb_fdnmatrix(p->d,p->f);
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
fixeddelay_write(p->fdndels[i],p->u[i]+p->f[i]);
|
||||
}
|
||||
|
||||
lsum = diffuser_do(p->ldifs[1],lsum);
|
||||
lsum = diffuser_do(p->ldifs[2],lsum);
|
||||
lsum = diffuser_do(p->ldifs[3],lsum);
|
||||
rsum = diffuser_do(p->rdifs[1],rsum);
|
||||
rsum = diffuser_do(p->rdifs[2],rsum);
|
||||
rsum = diffuser_do(p->rdifs[3],rsum);
|
||||
|
||||
*yl = lsum;
|
||||
*yr = rsum;
|
||||
}
|
||||
|
||||
static __inline void gverb_set_roomsize(ty_gverb *p, const float a)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (a <= 1.0 || (a != a)) {
|
||||
p->roomsize = 1.0;
|
||||
} else {
|
||||
p->roomsize = a;
|
||||
}
|
||||
p->largestdelay = p->rate * p->roomsize * 0.00294f;
|
||||
|
||||
p->fdnlens[0] = f_round(1.000000f*p->largestdelay);
|
||||
p->fdnlens[1] = f_round(0.816490f*p->largestdelay);
|
||||
p->fdnlens[2] = f_round(0.707100f*p->largestdelay);
|
||||
p->fdnlens[3] = f_round(0.632450f*p->largestdelay);
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->fdngains[i] = -powf((float)p->alpha, p->fdnlens[i]);
|
||||
}
|
||||
|
||||
p->taps[0] = 5+f_round(0.410f*p->largestdelay);
|
||||
p->taps[1] = 5+f_round(0.300f*p->largestdelay);
|
||||
p->taps[2] = 5+f_round(0.155f*p->largestdelay);
|
||||
p->taps[3] = 5+f_round(0.000f*p->largestdelay);
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->tapgains[i] = powf((float)p->alpha, p->taps[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static __inline void gverb_set_revtime(ty_gverb *p,float a)
|
||||
{
|
||||
float ga,gt;
|
||||
double n;
|
||||
unsigned int i;
|
||||
|
||||
p->revtime = a;
|
||||
|
||||
ga = 60.0;
|
||||
gt = p->revtime;
|
||||
ga = powf(10.0f,-ga/20.0f);
|
||||
n = p->rate*gt;
|
||||
p->alpha = (double)powf(ga,1.0f/n);
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->fdngains[i] = -powf((float)p->alpha, p->fdnlens[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static __inline void gverb_set_damping(ty_gverb *p,float a)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
p->fdndamping = a;
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
damper_set(p->fdndamps[i],p->fdndamping);
|
||||
}
|
||||
}
|
||||
|
||||
static __inline void gverb_set_inputbandwidth(ty_gverb *p,float a)
|
||||
{
|
||||
p->inputbandwidth = a;
|
||||
damper_set(p->inputdamper,1.0 - p->inputbandwidth);
|
||||
}
|
||||
|
||||
static __inline void gverb_set_earlylevel(ty_gverb *p,float a)
|
||||
{
|
||||
p->earlylevel = a;
|
||||
}
|
||||
|
||||
static __inline void gverb_set_taillevel(ty_gverb *p,float a)
|
||||
{
|
||||
p->taillevel = a;
|
||||
}
|
||||
|
||||
#endif
|
85
libraries/audio-client/external/gverb/include/gverbdsp.h
vendored
Executable file
85
libraries/audio-client/external/gverb/include/gverbdsp.h
vendored
Executable file
|
@ -0,0 +1,85 @@
|
|||
|
||||
#ifndef GVERBDSP_H
|
||||
#define GVERBDSP_H
|
||||
|
||||
#include "ladspa-util.h"
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
int idx;
|
||||
float *buf;
|
||||
} ty_fixeddelay;
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
float coeff;
|
||||
int idx;
|
||||
float *buf;
|
||||
} ty_diffuser;
|
||||
|
||||
typedef struct {
|
||||
float damping;
|
||||
float delay;
|
||||
} ty_damper;
|
||||
|
||||
ty_diffuser *diffuser_make(int, float);
|
||||
void diffuser_free(ty_diffuser *);
|
||||
void diffuser_flush(ty_diffuser *);
|
||||
//float diffuser_do(ty_diffuser *, float);
|
||||
|
||||
ty_damper *damper_make(float);
|
||||
void damper_free(ty_damper *);
|
||||
void damper_flush(ty_damper *);
|
||||
//void damper_set(ty_damper *, float);
|
||||
//float damper_do(ty_damper *, float);
|
||||
|
||||
ty_fixeddelay *fixeddelay_make(int);
|
||||
void fixeddelay_free(ty_fixeddelay *);
|
||||
void fixeddelay_flush(ty_fixeddelay *);
|
||||
//float fixeddelay_read(ty_fixeddelay *, int);
|
||||
//void fixeddelay_write(ty_fixeddelay *, float);
|
||||
|
||||
int isprime(int);
|
||||
int nearest_prime(int, float);
|
||||
|
||||
static __inline float diffuser_do(ty_diffuser *p, float x)
|
||||
{
|
||||
float y,w;
|
||||
|
||||
w = x - p->buf[p->idx]*p->coeff;
|
||||
w = flush_to_zero(w);
|
||||
y = p->buf[p->idx] + w*p->coeff;
|
||||
p->buf[p->idx] = w;
|
||||
p->idx = (p->idx + 1) % p->size;
|
||||
return(y);
|
||||
}
|
||||
|
||||
static __inline float fixeddelay_read(ty_fixeddelay *p, int n)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = (p->idx - n + p->size) % p->size;
|
||||
return(p->buf[i]);
|
||||
}
|
||||
|
||||
static __inline void fixeddelay_write(ty_fixeddelay *p, float x)
|
||||
{
|
||||
p->buf[p->idx] = x;
|
||||
p->idx = (p->idx + 1) % p->size;
|
||||
}
|
||||
|
||||
static __inline void damper_set(ty_damper *p, float damping)
|
||||
{
|
||||
p->damping = damping;
|
||||
}
|
||||
|
||||
static __inline float damper_do(ty_damper *p, float x)
|
||||
{
|
||||
float y;
|
||||
|
||||
y = x*(1.0-p->damping) + p->delay*p->damping;
|
||||
p->delay = y;
|
||||
return(y);
|
||||
}
|
||||
|
||||
#endif
|
234
libraries/audio-client/external/gverb/include/ladspa-util.h
vendored
Executable file
234
libraries/audio-client/external/gverb/include/ladspa-util.h
vendored
Executable file
|
@ -0,0 +1,234 @@
|
|||
/* Some misc util functions for audio DSP work, written by Steve Harris,
|
||||
* December 2000
|
||||
*
|
||||
* steve@plugin.org.uk
|
||||
*/
|
||||
|
||||
#ifndef LADSPA_UTIL_H
|
||||
#define LADSPA_UTIL_H
|
||||
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#define buffer_write(a, b) a=(b)
|
||||
|
||||
// 16.16 fixpoint
|
||||
typedef union {
|
||||
int32_t all;
|
||||
struct {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
int16_t in;
|
||||
uint16_t fr;
|
||||
#else
|
||||
uint16_t fr;
|
||||
int16_t in;
|
||||
#endif
|
||||
} part;
|
||||
} fixp16;
|
||||
|
||||
// 32.32 fixpoint
|
||||
typedef union {
|
||||
int64_t all;
|
||||
struct {
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
int32_t in;
|
||||
uint32_t fr;
|
||||
#else
|
||||
uint32_t fr;
|
||||
int32_t in;
|
||||
#endif
|
||||
} part;
|
||||
} fixp32;
|
||||
|
||||
/* 32 bit "pointer cast" union */
|
||||
typedef union {
|
||||
float f;
|
||||
int32_t i;
|
||||
} ls_pcast32;
|
||||
|
||||
// Sometimes it doesn't get defined, even though it eists and C99 is declared
|
||||
long int lrintf (float x);
|
||||
|
||||
// 1.0 / ln(2)
|
||||
#define LN2R 1.442695041f
|
||||
|
||||
/* detet floating point denormal numbers by comparing them to the smallest
|
||||
* normal, crap, but reliable */
|
||||
#define DN_CHECK(x, l) if (fabs(x) < 1e-38) printf("DN: " l"\n")
|
||||
|
||||
// Denormalise floats, only actually needed for PIII and recent PowerPC
|
||||
//#define FLUSH_TO_ZERO(fv) (((*(unsigned int*)&(fv))&0x7f800000)==0)?0.0f:(fv)
|
||||
|
||||
static __inline float flush_to_zero(float f)
|
||||
{
|
||||
ls_pcast32 v;
|
||||
|
||||
v.f = f;
|
||||
|
||||
// original: return (v.i & 0x7f800000) == 0 ? 0.0f : f;
|
||||
// version from Tim Blechmann
|
||||
return (v.i & 0x7f800000) < 0x08000000 ? 0.0f : f;
|
||||
}
|
||||
|
||||
static __inline void round_to_zero(volatile float *f)
|
||||
{
|
||||
*f += 1e-18;
|
||||
*f -= 1e-18;
|
||||
}
|
||||
|
||||
/* A set of branchless clipping operations from Laurent de Soras */
|
||||
|
||||
static __inline float f_max(float x, float a)
|
||||
{
|
||||
x -= a;
|
||||
x += fabs(x);
|
||||
x *= 0.5;
|
||||
x += a;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static __inline float f_min(float x, float b)
|
||||
{
|
||||
x = b - x;
|
||||
x += fabs(x);
|
||||
x *= 0.5;
|
||||
x = b - x;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
static __inline float f_clamp(float x, float a, float b)
|
||||
{
|
||||
const float x1 = fabs(x - a);
|
||||
const float x2 = fabs(x - b);
|
||||
|
||||
x = x1 + a + b;
|
||||
x -= x2;
|
||||
x *= 0.5;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
// Limit a value to be l<=v<=u
|
||||
#define LIMIT(v,l,u) ((v)<(l)?(l):((v)>(u)?(u):(v)))
|
||||
|
||||
// Truncate-to-zero modulo (ANSI C doesn't specify) will only work
|
||||
// if -m < v < 2m
|
||||
#define MOD(v,m) (v<0?v+m:(v>=m?v-m:v))
|
||||
|
||||
// Truncate-to-zero modulo (ANSI C doesn't specify) will only work
|
||||
// if v > -m and v < m
|
||||
#define NEG_MOD(v,m) ((v)<0?((v)+(m)):(v))
|
||||
|
||||
// Convert a value in dB's to a coefficent
|
||||
#define DB_CO(g) ((g) > -90.0f ? powf(10.0f, (g) * 0.05f) : 0.0f)
|
||||
#define CO_DB(v) (20.0f * log10f(v))
|
||||
|
||||
// Linearly interpolate [ = a * (1 - f) + b * f]
|
||||
#define LIN_INTERP(f,a,b) ((a) + (f) * ((b) - (a)))
|
||||
|
||||
// Cubic interpolation function
|
||||
static __inline float cube_interp(const float fr, const float inm1, const float
|
||||
in, const float inp1, const float inp2)
|
||||
{
|
||||
return in + 0.5f * fr * (inp1 - inm1 +
|
||||
fr * (4.0f * inp1 + 2.0f * inm1 - 5.0f * in - inp2 +
|
||||
fr * (3.0f * (in - inp1) - inm1 + inp2)));
|
||||
}
|
||||
|
||||
/* fast sin^2 aproxiamtion, adapted from jan AT rpgfan's posting to the
|
||||
* music-dsp list */
|
||||
static __inline float f_sin_sq(float angle)
|
||||
{
|
||||
const float asqr = angle * angle;
|
||||
float result = -2.39e-08f;
|
||||
|
||||
result *= asqr;
|
||||
result += 2.7526e-06f;
|
||||
result *= asqr;
|
||||
result -= 1.98409e-04f;
|
||||
result *= asqr;
|
||||
result += 8.3333315e-03f;
|
||||
result *= asqr;
|
||||
result -= 1.666666664e-01f;
|
||||
result *= asqr;
|
||||
result += 1.0f;
|
||||
result *= angle;
|
||||
|
||||
return result * result;
|
||||
}
|
||||
|
||||
#ifdef HAVE_LRINTF
|
||||
|
||||
#define f_round(f) lrintf(f)
|
||||
|
||||
#else
|
||||
|
||||
// Round float to int using IEEE int* hack
|
||||
static __inline int f_round(float f)
|
||||
{
|
||||
ls_pcast32 p;
|
||||
|
||||
p.f = f;
|
||||
p.f += (3<<22);
|
||||
|
||||
return p.i - 0x4b400000;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Truncate float to int
|
||||
static __inline int f_trunc(float f)
|
||||
{
|
||||
return f_round(floorf(f));
|
||||
}
|
||||
|
||||
/* Andrew Simper's pow(2, x) aproximation from the music-dsp list */
|
||||
|
||||
#if 0
|
||||
|
||||
/* original */
|
||||
static __inline float f_pow2(float x)
|
||||
{
|
||||
long *px = (long*)(&x); // store address of float as long pointer
|
||||
const float tx = (x-0.5f) + (3<<22); // temporary value for truncation
|
||||
const long lx = *((long*)&tx) - 0x4b400000; // integer power of 2
|
||||
const float dx = x-(float)(lx); // float remainder of power of 2
|
||||
|
||||
x = 1.0f + dx*(0.6960656421638072f + // cubic apporoximation of 2^x
|
||||
dx*(0.224494337302845f + // for x in the range [0, 1]
|
||||
dx*(0.07944023841053369f)));
|
||||
*px += (lx<<23); // add integer power of 2 to exponent
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
/* union version */
|
||||
static __inline float f_pow2(float x)
|
||||
{
|
||||
ls_pcast32 *px, tx, lx;
|
||||
float dx;
|
||||
|
||||
px = (ls_pcast32 *)&x; // store address of float as long pointer
|
||||
tx.f = (x-0.5f) + (3<<22); // temporary value for truncation
|
||||
lx.i = tx.i - 0x4b400000; // integer power of 2
|
||||
dx = x - (float)lx.i; // float remainder of power of 2
|
||||
|
||||
x = 1.0f + dx * (0.6960656421638072f + // cubic apporoximation of 2^x
|
||||
dx * (0.224494337302845f + // for x in the range [0, 1]
|
||||
dx * (0.07944023841053369f)));
|
||||
(*px).i += (lx.i << 23); // add integer power of 2 to exponent
|
||||
|
||||
return (*px).f;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Fast exponentiation function, y = e^x */
|
||||
#define f_exp(x) f_pow2(x * LN2R)
|
||||
|
||||
#endif
|
14
libraries/audio-client/external/gverb/readme.txt
vendored
Normal file
14
libraries/audio-client/external/gverb/readme.txt
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
Instructions for adding the Gverb library to Interface
|
||||
(This is a required library)
|
||||
Clément Brisset, October 22nd, 2014
|
||||
|
||||
1. Go to https://github.com/highfidelity/gverb
|
||||
Or download the sources directly via this link:
|
||||
https://github.com/highfidelity/gverb/archive/master.zip
|
||||
|
||||
2. Extract the archive
|
||||
|
||||
3. Place the directories “include” and “src” in libraries/audio-client/external/gverb
|
||||
(Normally next to this readme)
|
||||
|
||||
4. Clear your build directory, run cmake, build and you should be all set.
|
207
libraries/audio-client/external/gverb/src/gverb.c
vendored
Executable file
207
libraries/audio-client/external/gverb/src/gverb.c
vendored
Executable file
|
@ -0,0 +1,207 @@
|
|||
/*
|
||||
|
||||
Copyright (C) 1999 Juhana Sadeharju
|
||||
kouhia at nic.funet.fi
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include "gverbdsp.h"
|
||||
#include "gverb.h"
|
||||
#include "../include/ladspa-util.h"
|
||||
|
||||
ty_gverb *gverb_new(int srate, float maxroomsize, float roomsize,
|
||||
float revtime,
|
||||
float damping, float spread,
|
||||
float inputbandwidth, float earlylevel,
|
||||
float taillevel)
|
||||
{
|
||||
ty_gverb *p;
|
||||
float ga,gb,gt;
|
||||
int i,n;
|
||||
float r;
|
||||
float diffscale;
|
||||
int a,b,c,cc,d,dd,e;
|
||||
float spread1,spread2;
|
||||
|
||||
p = (ty_gverb *)malloc(sizeof(ty_gverb));
|
||||
p->rate = srate;
|
||||
p->fdndamping = damping;
|
||||
p->maxroomsize = maxroomsize;
|
||||
p->roomsize = roomsize;
|
||||
p->revtime = revtime;
|
||||
p->earlylevel = earlylevel;
|
||||
p->taillevel = taillevel;
|
||||
|
||||
p->maxdelay = p->rate*p->maxroomsize/340.0;
|
||||
p->largestdelay = p->rate*p->roomsize/340.0;
|
||||
|
||||
|
||||
/* Input damper */
|
||||
|
||||
p->inputbandwidth = inputbandwidth;
|
||||
p->inputdamper = damper_make(1.0 - p->inputbandwidth);
|
||||
|
||||
|
||||
/* FDN section */
|
||||
|
||||
|
||||
p->fdndels = (ty_fixeddelay **)calloc(FDNORDER, sizeof(ty_fixeddelay *));
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->fdndels[i] = fixeddelay_make((int)p->maxdelay+1000);
|
||||
}
|
||||
p->fdngains = (float *)calloc(FDNORDER, sizeof(float));
|
||||
p->fdnlens = (int *)calloc(FDNORDER, sizeof(int));
|
||||
|
||||
p->fdndamps = (ty_damper **)calloc(FDNORDER, sizeof(ty_damper *));
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->fdndamps[i] = damper_make(p->fdndamping);
|
||||
}
|
||||
|
||||
ga = 60.0;
|
||||
gt = p->revtime;
|
||||
ga = powf(10.0f,-ga/20.0f);
|
||||
n = p->rate*gt;
|
||||
p->alpha = pow((double)ga, 1.0/(double)n);
|
||||
|
||||
gb = 0.0;
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
if (i == 0) gb = 1.000000*p->largestdelay;
|
||||
if (i == 1) gb = 0.816490*p->largestdelay;
|
||||
if (i == 2) gb = 0.707100*p->largestdelay;
|
||||
if (i == 3) gb = 0.632450*p->largestdelay;
|
||||
|
||||
#if 0
|
||||
p->fdnlens[i] = nearest_prime((int)gb, 0.5);
|
||||
#else
|
||||
p->fdnlens[i] = f_round(gb);
|
||||
#endif
|
||||
p->fdngains[i] = -powf((float)p->alpha,p->fdnlens[i]);
|
||||
}
|
||||
|
||||
p->d = (float *)calloc(FDNORDER, sizeof(float));
|
||||
p->u = (float *)calloc(FDNORDER, sizeof(float));
|
||||
p->f = (float *)calloc(FDNORDER, sizeof(float));
|
||||
|
||||
/* Diffuser section */
|
||||
|
||||
diffscale = (float)p->fdnlens[3]/(210+159+562+410);
|
||||
spread1 = spread;
|
||||
spread2 = 3.0*spread;
|
||||
|
||||
b = 210;
|
||||
r = 0.125541;
|
||||
a = spread1*r;
|
||||
c = 210+159+a;
|
||||
cc = c-b;
|
||||
r = 0.854046;
|
||||
a = spread2*r;
|
||||
d = 210+159+562+a;
|
||||
dd = d-c;
|
||||
e = 1341-d;
|
||||
|
||||
p->ldifs = (ty_diffuser **)calloc(4, sizeof(ty_diffuser *));
|
||||
p->ldifs[0] = diffuser_make((int)(diffscale*b),0.75);
|
||||
p->ldifs[1] = diffuser_make((int)(diffscale*cc),0.75);
|
||||
p->ldifs[2] = diffuser_make((int)(diffscale*dd),0.625);
|
||||
p->ldifs[3] = diffuser_make((int)(diffscale*e),0.625);
|
||||
|
||||
b = 210;
|
||||
r = -0.568366;
|
||||
a = spread1*r;
|
||||
c = 210+159+a;
|
||||
cc = c-b;
|
||||
r = -0.126815;
|
||||
a = spread2*r;
|
||||
d = 210+159+562+a;
|
||||
dd = d-c;
|
||||
e = 1341-d;
|
||||
|
||||
p->rdifs = (ty_diffuser **)calloc(4, sizeof(ty_diffuser *));
|
||||
p->rdifs[0] = diffuser_make((int)(diffscale*b),0.75);
|
||||
p->rdifs[1] = diffuser_make((int)(diffscale*cc),0.75);
|
||||
p->rdifs[2] = diffuser_make((int)(diffscale*dd),0.625);
|
||||
p->rdifs[3] = diffuser_make((int)(diffscale*e),0.625);
|
||||
|
||||
|
||||
|
||||
/* Tapped delay section */
|
||||
|
||||
p->tapdelay = fixeddelay_make(44000);
|
||||
p->taps = (int *)calloc(FDNORDER, sizeof(int));
|
||||
p->tapgains = (float *)calloc(FDNORDER, sizeof(float));
|
||||
|
||||
p->taps[0] = 5+0.410*p->largestdelay;
|
||||
p->taps[1] = 5+0.300*p->largestdelay;
|
||||
p->taps[2] = 5+0.155*p->largestdelay;
|
||||
p->taps[3] = 5+0.000*p->largestdelay;
|
||||
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
p->tapgains[i] = pow(p->alpha,(double)p->taps[i]);
|
||||
}
|
||||
|
||||
return(p);
|
||||
}
|
||||
|
||||
void gverb_free(ty_gverb *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
damper_free(p->inputdamper);
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
fixeddelay_free(p->fdndels[i]);
|
||||
damper_free(p->fdndamps[i]);
|
||||
diffuser_free(p->ldifs[i]);
|
||||
diffuser_free(p->rdifs[i]);
|
||||
}
|
||||
free(p->fdndels);
|
||||
free(p->fdngains);
|
||||
free(p->fdnlens);
|
||||
free(p->fdndamps);
|
||||
free(p->d);
|
||||
free(p->u);
|
||||
free(p->f);
|
||||
free(p->ldifs);
|
||||
free(p->rdifs);
|
||||
free(p->taps);
|
||||
free(p->tapgains);
|
||||
fixeddelay_free(p->tapdelay);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void gverb_flush(ty_gverb *p)
|
||||
{
|
||||
int i;
|
||||
|
||||
damper_flush(p->inputdamper);
|
||||
for(i = 0; i < FDNORDER; i++) {
|
||||
fixeddelay_flush(p->fdndels[i]);
|
||||
damper_flush(p->fdndamps[i]);
|
||||
diffuser_flush(p->ldifs[i]);
|
||||
diffuser_flush(p->rdifs[i]);
|
||||
}
|
||||
memset(p->d, 0, FDNORDER * sizeof(float));
|
||||
memset(p->u, 0, FDNORDER * sizeof(float));
|
||||
memset(p->f, 0, FDNORDER * sizeof(float));
|
||||
fixeddelay_flush(p->tapdelay);
|
||||
}
|
||||
|
||||
/* swh: other functions are now in the .h file for inlining */
|
130
libraries/audio-client/external/gverb/src/gverbdsp.c
vendored
Executable file
130
libraries/audio-client/external/gverb/src/gverbdsp.c
vendored
Executable file
|
@ -0,0 +1,130 @@
|
|||
|
||||
|
||||
/*
|
||||
|
||||
Copyright (C) 1999 Juhana Sadeharju
|
||||
kouhia at nic.funet.fi
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "gverbdsp.h"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
ty_diffuser *diffuser_make(int size, float coeff)
|
||||
{
|
||||
ty_diffuser *p;
|
||||
int i;
|
||||
|
||||
p = (ty_diffuser *)malloc(sizeof(ty_diffuser));
|
||||
p->size = size;
|
||||
p->coeff = coeff;
|
||||
p->idx = 0;
|
||||
p->buf = (float *)malloc(size*sizeof(float));
|
||||
for (i = 0; i < size; i++) p->buf[i] = 0.0;
|
||||
return(p);
|
||||
}
|
||||
|
||||
void diffuser_free(ty_diffuser *p)
|
||||
{
|
||||
free(p->buf);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void diffuser_flush(ty_diffuser *p)
|
||||
{
|
||||
memset(p->buf, 0, p->size * sizeof(float));
|
||||
}
|
||||
|
||||
ty_damper *damper_make(float damping)
|
||||
{
|
||||
ty_damper *p;
|
||||
|
||||
p = (ty_damper *)malloc(sizeof(ty_damper));
|
||||
p->damping = damping;
|
||||
p->delay = 0.0f;
|
||||
return(p);
|
||||
}
|
||||
|
||||
void damper_free(ty_damper *p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
void damper_flush(ty_damper *p)
|
||||
{
|
||||
p->delay = 0.0f;
|
||||
}
|
||||
|
||||
ty_fixeddelay *fixeddelay_make(int size)
|
||||
{
|
||||
ty_fixeddelay *p;
|
||||
int i;
|
||||
|
||||
p = (ty_fixeddelay *)malloc(sizeof(ty_fixeddelay));
|
||||
p->size = size;
|
||||
p->idx = 0;
|
||||
p->buf = (float *)malloc(size*sizeof(float));
|
||||
for (i = 0; i < size; i++) p->buf[i] = 0.0;
|
||||
return(p);
|
||||
}
|
||||
|
||||
void fixeddelay_free(ty_fixeddelay *p)
|
||||
{
|
||||
free(p->buf);
|
||||
free(p);
|
||||
}
|
||||
|
||||
void fixeddelay_flush(ty_fixeddelay *p)
|
||||
{
|
||||
memset(p->buf, 0, p->size * sizeof(float));
|
||||
}
|
||||
|
||||
int isprime(int n)
|
||||
{
|
||||
unsigned int i;
|
||||
const unsigned int lim = (int)sqrtf((float)n);
|
||||
|
||||
if (n == 2) return(TRUE);
|
||||
if ((n & 1) == 0) return(FALSE);
|
||||
for(i = 3; i <= lim; i += 2)
|
||||
if ((n % i) == 0) return(FALSE);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
int nearest_prime(int n, float rerror)
|
||||
/* relative error; new prime will be in range
|
||||
* [n-n*rerror, n+n*rerror];
|
||||
*/
|
||||
{
|
||||
int bound,k;
|
||||
|
||||
if (isprime(n)) return(n);
|
||||
/* assume n is large enough and n*rerror enough smaller than n */
|
||||
bound = n*rerror;
|
||||
for(k = 1; k <= bound; k++) {
|
||||
if (isprime(n+k)) return(n+k);
|
||||
if (isprime(n-k)) return(n-k);
|
||||
}
|
||||
return(-1);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Audio.cpp
|
||||
// AudioClient.cpp
|
||||
// interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/22/13.
|
||||
|
@ -28,30 +28,27 @@
|
|||
#include <VersionHelpers.h>
|
||||
#endif
|
||||
|
||||
#include <AudioConstants.h>
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtMultimedia/QAudioInput>
|
||||
#include <QtMultimedia/QAudioOutput>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <AudioInjector.h>
|
||||
#include <NodeList.h>
|
||||
#include <PacketHeaders.h>
|
||||
|
||||
#include <PositionalAudioStream.h>
|
||||
|
||||
#include <SharedUtil.h>
|
||||
#include <UUID.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "AudioInjector.h"
|
||||
#include "AudioConstants.h"
|
||||
#include "PositionalAudioStream.h"
|
||||
|
||||
#include "Audio.h"
|
||||
#include "AudioClient.h"
|
||||
|
||||
static const int RECEIVED_AUDIO_STREAM_CAPACITY_FRAMES = 100;
|
||||
|
||||
Audio::Audio() :
|
||||
AudioClient::AudioClient() :
|
||||
AbstractAudioInterface(),
|
||||
_audioInput(NULL),
|
||||
_desiredInputFormat(),
|
||||
|
@ -95,13 +92,13 @@ Audio::Audio() :
|
|||
// clear the array of locally injected samples
|
||||
memset(_localProceduralSamples, 0, AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL);
|
||||
|
||||
connect(&_receivedAudioStream, &MixedProcessedAudioStream::processSamples, this, &Audio::processReceivedSamples, Qt::DirectConnection);
|
||||
connect(&_receivedAudioStream, &MixedProcessedAudioStream::processSamples, this, &AudioClient::processReceivedSamples, Qt::DirectConnection);
|
||||
|
||||
// Initialize GVerb
|
||||
initGverb();
|
||||
}
|
||||
|
||||
void Audio::reset() {
|
||||
void AudioClient::reset() {
|
||||
_receivedAudioStream.reset();
|
||||
_stats.reset();
|
||||
_noiseSource.reset();
|
||||
|
@ -110,7 +107,7 @@ void Audio::reset() {
|
|||
_inputGain.reset();
|
||||
}
|
||||
|
||||
void Audio::audioMixerKilled() {
|
||||
void AudioClient::audioMixerKilled() {
|
||||
_outgoingAvatarAudioSequenceNumber = 0;
|
||||
_stats.reset();
|
||||
}
|
||||
|
@ -358,7 +355,7 @@ void linearResampling(const int16_t* sourceSamples, int16_t* destinationSamples,
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::start() {
|
||||
void AudioClient::start() {
|
||||
|
||||
// set up the desired audio format
|
||||
_desiredInputFormat.setSampleRate(AudioConstants::SAMPLE_RATE);
|
||||
|
@ -397,7 +394,7 @@ void Audio::start() {
|
|||
_inputGain.setParameters(1.0f,0.0f);
|
||||
}
|
||||
|
||||
void Audio::stop() {
|
||||
void AudioClient::stop() {
|
||||
|
||||
_inputFrameBuffer.finalize();
|
||||
_inputGain.finalize();
|
||||
|
@ -410,12 +407,12 @@ void Audio::stop() {
|
|||
switchOutputToAudioDevice(QAudioDeviceInfo());
|
||||
}
|
||||
|
||||
QString Audio::getDefaultDeviceName(QAudio::Mode mode) {
|
||||
QString AudioClient::getDefaultDeviceName(QAudio::Mode mode) {
|
||||
QAudioDeviceInfo deviceInfo = defaultAudioDeviceForMode(mode);
|
||||
return deviceInfo.deviceName();
|
||||
}
|
||||
|
||||
QVector<QString> Audio::getDeviceNames(QAudio::Mode mode) {
|
||||
QVector<QString> AudioClient::getDeviceNames(QAudio::Mode mode) {
|
||||
QVector<QString> deviceNames;
|
||||
foreach(QAudioDeviceInfo audioDevice, QAudioDeviceInfo::availableDevices(mode)) {
|
||||
deviceNames << audioDevice.deviceName().trimmed();
|
||||
|
@ -423,17 +420,17 @@ QVector<QString> Audio::getDeviceNames(QAudio::Mode mode) {
|
|||
return deviceNames;
|
||||
}
|
||||
|
||||
bool Audio::switchInputToAudioDevice(const QString& inputDeviceName) {
|
||||
bool AudioClient::switchInputToAudioDevice(const QString& inputDeviceName) {
|
||||
qDebug() << "DEBUG [" << inputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName).deviceName() << "]";
|
||||
return switchInputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioInput, inputDeviceName));
|
||||
}
|
||||
|
||||
bool Audio::switchOutputToAudioDevice(const QString& outputDeviceName) {
|
||||
bool AudioClient::switchOutputToAudioDevice(const QString& outputDeviceName) {
|
||||
qDebug() << "DEBUG [" << outputDeviceName << "] [" << getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName).deviceName() << "]";
|
||||
return switchOutputToAudioDevice(getNamedAudioDeviceForMode(QAudio::AudioOutput, outputDeviceName));
|
||||
}
|
||||
|
||||
void Audio::initGverb() {
|
||||
void AudioClient::initGverb() {
|
||||
// Initialize a new gverb instance
|
||||
_gverbLocal = gverb_new(_outputFormat.sampleRate(), _reverbOptions->getMaxRoomSize(), _reverbOptions->getRoomSize(),
|
||||
_reverbOptions->getReverbTime(), _reverbOptions->getDamping(), _reverbOptions->getSpread(),
|
||||
|
@ -460,7 +457,7 @@ void Audio::initGverb() {
|
|||
gverb_set_taillevel(_gverb, DB_CO(_reverbOptions->getTailLevel()));
|
||||
}
|
||||
|
||||
void Audio::updateGverbOptions() {
|
||||
void AudioClient::updateGverbOptions() {
|
||||
bool reverbChanged = false;
|
||||
if (_receivedAudioStream.hasReverb()) {
|
||||
|
||||
|
@ -487,7 +484,7 @@ void Audio::updateGverbOptions() {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::setReverbOptions(const AudioEffectOptions* options) {
|
||||
void AudioClient::setReverbOptions(const AudioEffectOptions* options) {
|
||||
// Save the new options
|
||||
_scriptReverbOptions.setMaxRoomSize(options->getMaxRoomSize());
|
||||
_scriptReverbOptions.setRoomSize(options->getRoomSize());
|
||||
|
@ -507,7 +504,7 @@ void Audio::setReverbOptions(const AudioEffectOptions* options) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::addReverb(ty_gverb* gverb, int16_t* samplesData, int numSamples, QAudioFormat& audioFormat, bool noEcho) {
|
||||
void AudioClient::addReverb(ty_gverb* gverb, int16_t* samplesData, int numSamples, QAudioFormat& audioFormat, bool noEcho) {
|
||||
float wetFraction = DB_CO(_reverbOptions->getWetLevel());
|
||||
float dryFraction = (noEcho) ? 0.0f : (1.0f - wetFraction);
|
||||
|
||||
|
@ -536,7 +533,7 @@ void Audio::addReverb(ty_gverb* gverb, int16_t* samplesData, int numSamples, QAu
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
|
||||
void AudioClient::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
|
||||
// If there is server echo, reverb will be applied to the recieved audio stream so no need to have it here.
|
||||
bool hasLocalReverb = (_reverb || _receivedAudioStream.hasReverb()) &&
|
||||
!_shouldEchoToServer;
|
||||
|
@ -576,7 +573,7 @@ void Audio::handleLocalEchoAndReverb(QByteArray& inputByteArray) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::handleAudioInput() {
|
||||
void AudioClient::handleAudioInput() {
|
||||
static char audioDataPacket[MAX_PACKET_SIZE];
|
||||
|
||||
static int numBytesPacketHeader = numBytesForPacketHeaderGivenPacketType(PacketTypeMicrophoneAudioNoEcho);
|
||||
|
@ -693,9 +690,8 @@ void Audio::handleAudioInput() {
|
|||
}
|
||||
|
||||
if (audioMixer && audioMixer->getActiveSocket()) {
|
||||
const MyAvatar* interfaceAvatar = Application::getInstance()->getAvatar();
|
||||
glm::vec3 headPosition = interfaceAvatar->getHead()->getPosition();
|
||||
glm::quat headOrientation = interfaceAvatar->getHead()->getFinalOrientationInWorldFrame();
|
||||
glm::vec3 headPosition = _positionGetter();
|
||||
glm::quat headOrientation = _orientationGetter();
|
||||
quint8 isStereo = _isStereoInput ? 1 : 0;
|
||||
|
||||
PacketType packetType;
|
||||
|
@ -751,14 +747,14 @@ void Audio::handleAudioInput() {
|
|||
nodeList->writeDatagram(audioDataPacket, packetBytes, audioMixer);
|
||||
_outgoingAvatarAudioSequenceNumber++;
|
||||
|
||||
Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
||||
.updateValue(packetBytes);
|
||||
// Application::getInstance()->getBandwidthMeter()->outputStream(BandwidthMeter::AUDIO)
|
||||
// .updateValue(packetBytes);
|
||||
}
|
||||
delete[] inputAudioSamples;
|
||||
}
|
||||
}
|
||||
|
||||
void Audio::processReceivedSamples(const QByteArray& inputBuffer, QByteArray& outputBuffer) {
|
||||
void AudioClient::processReceivedSamples(const QByteArray& inputBuffer, QByteArray& outputBuffer) {
|
||||
const int numNetworkOutputSamples = inputBuffer.size() / sizeof(int16_t);
|
||||
const int numDeviceOutputSamples = numNetworkOutputSamples * (_outputFormat.sampleRate() * _outputFormat.channelCount())
|
||||
/ (_desiredOutputFormat.sampleRate() * _desiredOutputFormat.channelCount());
|
||||
|
@ -785,14 +781,14 @@ void Audio::processReceivedSamples(const QByteArray& inputBuffer, QByteArray& ou
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::sendMuteEnvironmentPacket() {
|
||||
void AudioClient::sendMuteEnvironmentPacket() {
|
||||
QByteArray mutePacket = byteArrayWithPopulatedHeader(PacketTypeMuteEnvironment);
|
||||
QDataStream mutePacketStream(&mutePacket, QIODevice::Append);
|
||||
|
||||
const float MUTE_RADIUS = 50;
|
||||
|
||||
mutePacketStream.writeBytes(reinterpret_cast<const char *>(&Application::getInstance()->getAvatar()->getPosition()),
|
||||
sizeof(glm::vec3));
|
||||
glm::vec3 currentSourcePosition = _positionGetter();
|
||||
mutePacketStream.writeBytes(reinterpret_cast<const char *>(¤tSourcePosition), sizeof(glm::vec3));
|
||||
mutePacketStream.writeBytes(reinterpret_cast<const char *>(&MUTE_RADIUS), sizeof(float));
|
||||
|
||||
// grab our audio mixer from the NodeList, if it exists
|
||||
|
@ -805,16 +801,16 @@ void Audio::sendMuteEnvironmentPacket() {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::addReceivedAudioToStream(const QByteArray& audioByteArray) {
|
||||
void AudioClient::addReceivedAudioToStream(const QByteArray& audioByteArray) {
|
||||
if (_audioOutput) {
|
||||
// Audio output must exist and be correctly set up if we're going to process received audio
|
||||
_receivedAudioStream.parseData(audioByteArray);
|
||||
}
|
||||
|
||||
Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AUDIO).updateValue(audioByteArray.size());
|
||||
// Application::getInstance()->getBandwidthMeter()->inputStream(BandwidthMeter::AUDIO).updateValue(audioByteArray.size());
|
||||
}
|
||||
|
||||
void Audio::parseAudioEnvironmentData(const QByteArray &packet) {
|
||||
void AudioClient::parseAudioEnvironmentData(const QByteArray &packet) {
|
||||
int numBytesPacketHeader = numBytesForPacketHeader(packet);
|
||||
const char* dataAt = packet.constData() + numBytesPacketHeader;
|
||||
|
||||
|
@ -835,12 +831,12 @@ void Audio::parseAudioEnvironmentData(const QByteArray &packet) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::toggleMute() {
|
||||
void AudioClient::toggleMute() {
|
||||
_muted = !_muted;
|
||||
muteToggled();
|
||||
}
|
||||
|
||||
void Audio::setIsStereoInput(bool isStereoInput) {
|
||||
void AudioClient::setIsStereoInput(bool isStereoInput) {
|
||||
if (isStereoInput != _isStereoInput) {
|
||||
_isStereoInput = isStereoInput;
|
||||
|
||||
|
@ -855,21 +851,21 @@ void Audio::setIsStereoInput(bool isStereoInput) {
|
|||
}
|
||||
}
|
||||
|
||||
void Audio::toggleAudioSourceInject() {
|
||||
void AudioClient::toggleAudioSourceInject() {
|
||||
_audioSourceInjectEnabled = !_audioSourceInjectEnabled;
|
||||
}
|
||||
|
||||
void Audio::selectAudioSourcePinkNoise() {
|
||||
void AudioClient::selectAudioSourcePinkNoise() {
|
||||
_noiseSourceEnabled = true;
|
||||
_toneSourceEnabled = false;
|
||||
}
|
||||
|
||||
void Audio::selectAudioSourceSine440() {
|
||||
void AudioClient::selectAudioSourceSine440() {
|
||||
_toneSourceEnabled = true;
|
||||
_noiseSourceEnabled = false;
|
||||
}
|
||||
|
||||
bool Audio::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) {
|
||||
bool AudioClient::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* injector) {
|
||||
if (injector->getLocalBuffer()) {
|
||||
QAudioFormat localFormat = _desiredOutputFormat;
|
||||
localFormat.setChannelCount(isStereo ? 2 : 1);
|
||||
|
@ -895,13 +891,13 @@ bool Audio::outputLocalInjector(bool isStereo, qreal volume, AudioInjector* inje
|
|||
}
|
||||
|
||||
|
||||
void Audio::outputFormatChanged() {
|
||||
void AudioClient::outputFormatChanged() {
|
||||
int outputFormatChannelCountTimesSampleRate = _outputFormat.channelCount() * _outputFormat.sampleRate();
|
||||
_outputFrameSize = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * outputFormatChannelCountTimesSampleRate / _desiredOutputFormat.sampleRate();
|
||||
_receivedAudioStream.outputFormatChanged(outputFormatChannelCountTimesSampleRate);
|
||||
}
|
||||
|
||||
bool Audio::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
||||
bool AudioClient::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
||||
bool supportedFormat = false;
|
||||
|
||||
// cleanup any previously initialized device
|
||||
|
@ -946,7 +942,7 @@ bool Audio::switchInputToAudioDevice(const QAudioDeviceInfo& inputDeviceInfo) {
|
|||
return supportedFormat;
|
||||
}
|
||||
|
||||
void Audio::outputNotify() {
|
||||
void AudioClient::outputNotify() {
|
||||
int recentUnfulfilled = _audioOutputIODevice.getRecentUnfulfilledReads();
|
||||
if (recentUnfulfilled > 0) {
|
||||
if (_outputStarveDetectionEnabled) {
|
||||
|
@ -970,7 +966,7 @@ void Audio::outputNotify() {
|
|||
}
|
||||
}
|
||||
|
||||
bool Audio::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo) {
|
||||
bool AudioClient::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo) {
|
||||
bool supportedFormat = false;
|
||||
|
||||
// cleanup any previously initialized device
|
||||
|
@ -998,7 +994,7 @@ bool Audio::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo)
|
|||
_audioOutput = new QAudioOutput(outputDeviceInfo, _outputFormat, this);
|
||||
_audioOutput->setBufferSize(_outputBufferSizeFrames * _outputFrameSize * sizeof(int16_t));
|
||||
|
||||
connect(_audioOutput, &QAudioOutput::notify, this, &Audio::outputNotify);
|
||||
connect(_audioOutput, &QAudioOutput::notify, this, &AudioClient::outputNotify);
|
||||
|
||||
qDebug() << "Output Buffer capacity in frames: " << _audioOutput->bufferSize() / sizeof(int16_t) / (float)_outputFrameSize;
|
||||
|
||||
|
@ -1017,7 +1013,7 @@ bool Audio::switchOutputToAudioDevice(const QAudioDeviceInfo& outputDeviceInfo)
|
|||
return supportedFormat;
|
||||
}
|
||||
|
||||
void Audio::setOutputBufferSize(int numFrames) {
|
||||
void AudioClient::setOutputBufferSize(int numFrames) {
|
||||
numFrames = std::min(std::max(numFrames, MIN_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES), MAX_AUDIO_OUTPUT_BUFFER_SIZE_FRAMES);
|
||||
if (numFrames != _outputBufferSizeFrames) {
|
||||
qDebug() << "Audio output buffer size (frames): " << numFrames;
|
||||
|
@ -1037,18 +1033,18 @@ void Audio::setOutputBufferSize(int numFrames) {
|
|||
// proportional to the accelerator ratio.
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
const float Audio::CALLBACK_ACCELERATOR_RATIO = 0.1f;
|
||||
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 0.1f;
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
const float Audio::CALLBACK_ACCELERATOR_RATIO = 2.0f;
|
||||
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 2.0f;
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
const float Audio::CALLBACK_ACCELERATOR_RATIO = 2.0f;
|
||||
const float AudioClient::CALLBACK_ACCELERATOR_RATIO = 2.0f;
|
||||
#endif
|
||||
|
||||
int Audio::calculateNumberOfInputCallbackBytes(const QAudioFormat& format) const {
|
||||
int AudioClient::calculateNumberOfInputCallbackBytes(const QAudioFormat& format) const {
|
||||
int numInputCallbackBytes = (int)(((AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL
|
||||
* format.channelCount()
|
||||
* (format.sampleRate() / AudioConstants::SAMPLE_RATE))
|
||||
|
@ -1057,7 +1053,7 @@ int Audio::calculateNumberOfInputCallbackBytes(const QAudioFormat& format) const
|
|||
return numInputCallbackBytes;
|
||||
}
|
||||
|
||||
float Audio::calculateDeviceToNetworkInputRatio(int numBytes) const {
|
||||
float AudioClient::calculateDeviceToNetworkInputRatio(int numBytes) const {
|
||||
float inputToNetworkInputRatio = (int)((_numInputCallbackBytes
|
||||
* CALLBACK_ACCELERATOR_RATIO
|
||||
/ AudioConstants::NETWORK_FRAME_BYTES_PER_CHANNEL) + 0.5f);
|
||||
|
@ -1065,18 +1061,18 @@ float Audio::calculateDeviceToNetworkInputRatio(int numBytes) const {
|
|||
return inputToNetworkInputRatio;
|
||||
}
|
||||
|
||||
int Audio::calculateNumberOfFrameSamples(int numBytes) const {
|
||||
int AudioClient::calculateNumberOfFrameSamples(int numBytes) const {
|
||||
int frameSamples = (int)(numBytes * CALLBACK_ACCELERATOR_RATIO + 0.5f) / sizeof(int16_t);
|
||||
return frameSamples;
|
||||
}
|
||||
|
||||
float Audio::getInputRingBufferMsecsAvailable() const {
|
||||
float AudioClient::getInputRingBufferMsecsAvailable() const {
|
||||
int bytesInInputRingBuffer = _inputRingBuffer.samplesAvailable() * sizeof(int16_t);
|
||||
float msecsInInputRingBuffer = bytesInInputRingBuffer / (float)(_inputFormat.bytesForDuration(USECS_PER_MSEC));
|
||||
return msecsInInputRingBuffer;
|
||||
}
|
||||
|
||||
float Audio::getAudioOutputMsecsUnplayed() const {
|
||||
float AudioClient::getAudioOutputMsecsUnplayed() const {
|
||||
if (!_audioOutput) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
@ -1085,7 +1081,7 @@ float Audio::getAudioOutputMsecsUnplayed() const {
|
|||
return msecsAudioOutputUnplayed;
|
||||
}
|
||||
|
||||
qint64 Audio::AudioOutputIODevice::readData(char * data, qint64 maxSize) {
|
||||
qint64 AudioClient::AudioOutputIODevice::readData(char * data, qint64 maxSize) {
|
||||
int samplesRequested = maxSize / sizeof(int16_t);
|
||||
int samplesPopped;
|
||||
int bytesWritten;
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Audio.h
|
||||
// AudioClient.h
|
||||
// interface/src
|
||||
//
|
||||
// Created by Stephen Birarda on 1/22/13.
|
||||
|
@ -9,43 +9,38 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#ifndef hifi_Audio_h
|
||||
#define hifi_Audio_h
|
||||
#ifndef hifi_AudioClient_h
|
||||
#define hifi_AudioClient_h
|
||||
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <QAudio>
|
||||
#include <QAudioInput>
|
||||
#include <QElapsedTimer>
|
||||
#include <QGLWidget>
|
||||
#include <QtCore/QByteArray>
|
||||
#include <QtCore/QElapsedTimer>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtCore/QVector>
|
||||
#include <QtMultimedia/QAudio>
|
||||
#include <QtMultimedia/QAudioFormat>
|
||||
#include <QVector>
|
||||
#include <QByteArray>
|
||||
#include <QtMultimedia/QAudioInput>
|
||||
|
||||
#include <AbstractAudioInterface.h>
|
||||
#include <AudioBuffer.h>
|
||||
#include <AudioEffectOptions.h>
|
||||
#include <AudioFormat.h>
|
||||
#include <AudioGain.h>
|
||||
#include <AudioRingBuffer.h>
|
||||
#include <AudioSourceTone.h>
|
||||
#include <AudioSourceNoise.h>
|
||||
#include <AudioStreamStats.h>
|
||||
#include <DependencyManager.h>
|
||||
#include <MixedProcessedAudioStream.h>
|
||||
#include <RingBufferHistory.h>
|
||||
#include <StDev.h>
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
#include "audio/AudioIOStats.h"
|
||||
#include "audio/AudioNoiseGate.h"
|
||||
#include "AudioStreamStats.h"
|
||||
#include "Recorder.h"
|
||||
#include "RingBufferHistory.h"
|
||||
#include "AudioRingBuffer.h"
|
||||
#include "AudioFormat.h"
|
||||
#include "AudioBuffer.h"
|
||||
#include "AudioSourceTone.h"
|
||||
#include "AudioSourceNoise.h"
|
||||
#include "AudioGain.h"
|
||||
|
||||
#include "MixedProcessedAudioStream.h"
|
||||
#include "AudioEffectOptions.h"
|
||||
|
||||
#include "AudioIOStats.h"
|
||||
#include "AudioNoiseGate.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning( push )
|
||||
|
@ -73,14 +68,17 @@ class QAudioInput;
|
|||
class QAudioOutput;
|
||||
class QIODevice;
|
||||
|
||||
class Audio : public AbstractAudioInterface, public Dependency {
|
||||
typedef glm::vec3 (*AudioPositionGetter)();
|
||||
typedef glm::quat (*AudioOrientationGetter)();
|
||||
|
||||
class AudioClient : public AbstractAudioInterface, public Dependency {
|
||||
Q_OBJECT
|
||||
SINGLETON_DEPENDENCY
|
||||
public:
|
||||
|
||||
class AudioOutputIODevice : public QIODevice {
|
||||
public:
|
||||
AudioOutputIODevice(MixedProcessedAudioStream& receivedAudioStream, Audio* audio) :
|
||||
AudioOutputIODevice(MixedProcessedAudioStream& receivedAudioStream, AudioClient* audio) :
|
||||
_receivedAudioStream(receivedAudioStream), _audio(audio), _unfulfilledReads(0) {};
|
||||
|
||||
void start() { open(QIODevice::ReadOnly); }
|
||||
|
@ -91,7 +89,7 @@ public:
|
|||
int getRecentUnfulfilledReads() { int unfulfilledReads = _unfulfilledReads; _unfulfilledReads = 0; return unfulfilledReads; }
|
||||
private:
|
||||
MixedProcessedAudioStream& _receivedAudioStream;
|
||||
Audio* _audio;
|
||||
AudioClient* _audio;
|
||||
int _unfulfilledReads;
|
||||
};
|
||||
|
||||
|
@ -127,6 +125,9 @@ public:
|
|||
|
||||
int getOutputStarveDetectionThreshold() { return _outputStarveDetectionThreshold; }
|
||||
void setOutputStarveDetectionThreshold(int threshold) { _outputStarveDetectionThreshold = threshold; }
|
||||
|
||||
void setPositionGetter(AudioPositionGetter positionGetter) { _positionGetter = positionGetter; }
|
||||
void setOrientationGetter(AudioOrientationGetter orientationGetter) { _orientationGetter = orientationGetter; }
|
||||
|
||||
static const float CALLBACK_ACCELERATOR_RATIO;
|
||||
|
||||
|
@ -179,7 +180,7 @@ signals:
|
|||
void inputReceived(const QByteArray& inputSamples);
|
||||
|
||||
protected:
|
||||
Audio();
|
||||
AudioClient();
|
||||
|
||||
private:
|
||||
void outputFormatChanged();
|
||||
|
@ -275,7 +276,10 @@ private:
|
|||
AudioIOStats _stats;
|
||||
|
||||
AudioNoiseGate _inputGate;
|
||||
|
||||
AudioPositionGetter _positionGetter;
|
||||
AudioOrientationGetter _orientationGetter;
|
||||
};
|
||||
|
||||
|
||||
#endif // hifi_Audio_h
|
||||
#endif // hifi_AudioClient_h
|
|
@ -9,14 +9,12 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "InterfaceConfig.h"
|
||||
|
||||
#include <AudioConstants.h>
|
||||
#include <MixedProcessedAudioStream.h>
|
||||
#include <NodeList.h>
|
||||
#include <PositionalAudioStream.h>
|
||||
|
||||
#include "Audio.h"
|
||||
#include "AudioClient.h"
|
||||
|
||||
#include "AudioIOStats.h"
|
||||
|
||||
|
@ -27,7 +25,7 @@ const int APPROXIMATELY_30_SECONDS_OF_AUDIO_PACKETS = (int)(30.0f * 1000.0f / Au
|
|||
|
||||
AudioIOStats::AudioIOStats(MixedProcessedAudioStream* receivedAudioStream) :
|
||||
_receivedAudioStream(receivedAudioStream),
|
||||
_audioInputMsecsReadStats(MSECS_PER_SECOND / (float)AudioConstants::NETWORK_FRAME_MSECS * Audio::CALLBACK_ACCELERATOR_RATIO, FRAMES_AVAILABLE_STATS_WINDOW_SECONDS),
|
||||
_audioInputMsecsReadStats(MSECS_PER_SECOND / (float)AudioConstants::NETWORK_FRAME_MSECS * AudioClient::CALLBACK_ACCELERATOR_RATIO, FRAMES_AVAILABLE_STATS_WINDOW_SECONDS),
|
||||
_inputRingBufferMsecsAvailableStats(1, FRAMES_AVAILABLE_STATS_WINDOW_SECONDS),
|
||||
_audioOutputMsecsUnplayedStats(1, FRAMES_AVAILABLE_STATS_WINDOW_SECONDS),
|
||||
_lastSentAudioPacket(0),
|
||||
|
@ -97,7 +95,7 @@ void AudioIOStats::parseAudioStreamStatsPacket(const QByteArray& packet) {
|
|||
|
||||
void AudioIOStats::sendDownstreamAudioStatsPacket() {
|
||||
|
||||
auto audioIO = DependencyManager::get<Audio>();
|
||||
auto audioIO = DependencyManager::get<AudioClient>();
|
||||
|
||||
// since this function is called every second, we'll sample for some of our stats here
|
||||
_inputRingBufferMsecsAvailableStats.update(audioIO->getInputRingBufferMsecsAvailable());
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// AudioBuffer.h
|
||||
// hifi
|
||||
// libraries/audio/src
|
||||
//
|
||||
// Created by Craig Hansen-Sturm on 8/29/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
|
@ -16,6 +16,8 @@
|
|||
|
||||
#include <QDebug>
|
||||
|
||||
#include "AudioFormat.h"
|
||||
|
||||
template< typename T >
|
||||
class AudioFrameBuffer {
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "InboundAudioStream.h"
|
||||
|
||||
class Audio;
|
||||
class AudioClient;
|
||||
|
||||
class MixedProcessedAudioStream : public InboundAudioStream {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//
|
||||
// Recorder.h
|
||||
//
|
||||
// libraries/avatars/src
|
||||
//
|
||||
// Created by Clement on 8/7/14.
|
||||
// Copyright 2014 High Fidelity, Inc.
|
||||
|
@ -50,4 +50,4 @@ private:
|
|||
};
|
||||
|
||||
|
||||
#endif // hifi_Recorder_h
|
||||
#endif // hifi_Recorder_h
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
const bool VERBOSE_HTTP_REQUEST_DEBUGGING = false;
|
||||
|
||||
AccountManager& AccountManager::getInstance(bool forceReset) {
|
||||
static std::auto_ptr<AccountManager> sharedInstance(new AccountManager());
|
||||
static std::unique_ptr<AccountManager> sharedInstance(new AccountManager());
|
||||
|
||||
if (forceReset) {
|
||||
sharedInstance.reset(new AccountManager());
|
||||
|
@ -59,7 +59,7 @@ JSONCallbackParameters::JSONCallbackParameters(QObject* jsonCallbackReceiver, co
|
|||
}
|
||||
|
||||
AccountManager::AccountManager() :
|
||||
_authURL(),
|
||||
_authURL(DEFAULT_NODE_AUTH_URL),
|
||||
_pendingCallbackMap(),
|
||||
_accountInfo(),
|
||||
_shouldPersistToSettingsFile(true)
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#define hifi_DataServerAccountInfo_h
|
||||
|
||||
#include <QtCore/QObject>
|
||||
#include <qnetworkreply.h>
|
||||
#include <QtCore/QUuid>
|
||||
#include <QtNetwork/qnetworkreply.h>
|
||||
|
||||
#include "OAuthAccessToken.h"
|
||||
|
||||
|
|
|
@ -108,19 +108,6 @@ QUdpSocket& LimitedNodeList::getDTLSSocket() {
|
|||
// DTLS requires that IP_DONTFRAG be set
|
||||
// This is not accessible on some platforms (OS X) so we need to make sure DTLS still works without it
|
||||
|
||||
#if defined(IP_DONTFRAG) || defined(IP_MTU_DISCOVER)
|
||||
qDebug() << "Making required DTLS changes to LimitedNodeList DTLS socket.";
|
||||
|
||||
int socketHandle = _dtlsSocket->socketDescriptor();
|
||||
#if defined(IP_DONTFRAG)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_DONTFRAG, reinterpret_cast<const void*>(&optValue), sizeof(optValue));
|
||||
#elif defined(IP_MTU_DISCOVER)
|
||||
int optValue = 1;
|
||||
setsockopt(socketHandle, IPPROTO_IP, IP_MTU_DISCOVER, reinterpret_cast<const void*>(&optValue), sizeof(optValue));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
qDebug() << "LimitedNodeList DTLS socket is listening on" << _dtlsSocket->localPort();
|
||||
}
|
||||
|
||||
|
@ -141,7 +128,6 @@ void LimitedNodeList::changeSocketBufferSizes(int numBytes) {
|
|||
}
|
||||
int oldBufferSize = _nodeSocket.socketOption(bufferOpt).toInt();
|
||||
if (oldBufferSize < numBytes) {
|
||||
_nodeSocket.setSocketOption(bufferOpt, numBytes);
|
||||
int newBufferSize = _nodeSocket.socketOption(bufferOpt).toInt();
|
||||
|
||||
qDebug() << "Changed socket" << bufferTypeString << "buffer size from" << oldBufferSize << "to"
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#ifndef hifi_NetworkAccessManager_h
|
||||
#define hifi_NetworkAccessManager_h
|
||||
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QtNetwork/qnetworkaccessmanager.h>
|
||||
|
||||
/// Wrapper around QNetworkAccessManager to restrict at one instance by thread
|
||||
class NetworkAccessManager : public QObject {
|
||||
|
|
|
@ -14,13 +14,6 @@
|
|||
#ifndef hifi_NetworkPacket_h
|
||||
#define hifi_NetworkPacket_h
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <arpa/inet.h> // not available on windows
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
#include "NodeList.h"
|
||||
|
||||
/// Storage of not-yet processed inbound, or not yet sent outbound generic UDP network packet
|
||||
|
|
Loading…
Reference in a new issue