Skip to content

Commit

Permalink
add conversion app to derive audio data from recordings
Browse files Browse the repository at this point in the history
  • Loading branch information
gary444 committed Jul 24, 2024
1 parent 719bf64 commit a4e0278
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 1 deletion.
5 changes: 4 additions & 1 deletion AnalysisTest/Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ using std::chrono::milliseconds;
#include <iostream>


/*
void collaboration_analysis() {
std::vector<std::string> files;
std::string directory = "C:\\Users\\Admin\\CLionProjects\\UnityRecordingPlugin\\cmake-build-debug\\";
Expand Down Expand Up @@ -258,8 +260,9 @@ void single_user_analysis() {
//manager.add_sound_activation_analysis_request(0, microphone_audio, temporal_search_interval, sound_level);
}
*/

int main() {
collaboration_analysis();
//collaboration_analysis();
return 0;
}
17 changes: 17 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ set(UnityDir Unity)
set(SrcDir Src)
set(ExternalDir External)
set(TestDir Test)
set(ConvertDir Convert)
set(AnalysisTestDir AnalysisTest)
set(UtilsDir Utils)

Expand Down Expand Up @@ -50,6 +51,19 @@ file(GLOB_RECURSE TEST_FILES
External/ThreadPool/*.hpp
)

file(GLOB_RECURSE CONVERT_FILES
${SrcDir}/*.h.in
${SrcDir}/*.cpp
${SrcDir}/*.h
${UnityDir}/*.cpp
${UnityDir}/*.h
${ConvertDir}/Convert.cpp
${UtilsDir}/*.cpp
${UtilsDir}/*.h
External/AudioFile/*.h
External/ThreadPool/*.hpp
)

file(GLOB_RECURSE ANALYSIS_TEST_FILES
${SrcDir}/*.h.in
${SrcDir}/*.cpp
Expand Down Expand Up @@ -77,6 +91,9 @@ if(NOT ANDROID_BUILD)
add_executable(tests ${TEST_FILES})
target_link_libraries(tests ${TEST_LIBRARIES})

add_executable(convert ${CONVERT_FILES})
target_link_libraries(convert ${TEST_LIBRARIES})

add_executable(analysis_tests ${ANALYSIS_TEST_FILES})
target_link_libraries(analysis_tests ${TEST_LIBRARIES})
endif()
Expand Down
85 changes: 85 additions & 0 deletions Convert/Convert.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// VRSYS plugin of Virtual Reality and Visualization Group (Bauhaus-University Weimar)
// _ ______ _______ _______
// | | / / __ \/ ___/\ \/ / ___/
// | | / / /_/ /\__ \ \ /\__ \
// | |/ / _, _/___/ / / /___/ /
// |___/_/ |_|/____/ /_//____/
//
// __ __ __ __ __ ___ . . ___
// |__) /\ | | |__| /\ | | /__` | | |\ | | \ / |__ |__) /__` | | /\ |
// |__) /~~\ \__/ | | /~~\ \__/ .__/ \__/ | \| | \/ |___ | \ .__/ | | /~~\ |
//
// ___ __
// | | |__ | |\/| /\ |__)
// |/\| |___ | | | /~~\ | \
//
// Copyright (c) 2024 Virtual Reality and Visualization Group
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//-----------------------------------------------------------------
// Authors: Anton Lammert
// Date: 2024
//-----------------------------------------------------------------

#include "Recording/RecorderManager.h"
#include "catch2/catch_test_macros.hpp"
#include "catch2/catch_all.hpp"
#include "../Utils/Utils.h"

#include <filesystem>
#include <iostream>
#include <chrono>
#include <random>

std::string recording_dir = std::filesystem::current_path().string() + "/";
std::string recording_file = "test";

int transform_buffer_size = 1000;
int sound_buffer_size = 100;
int replay_buffer_num = 3;
float replay_buffer_interval = 10.0f;
int recording_duration = 100;
int stop_time = 15;
int transform_count = 20;
int recording_steps_per_second = 10;

bool forward = true;
bool reverse = true;
bool random = true;

bool first = true;


int main(int argc, char *argv[]) {
//RecorderManager &manager = RecorderManager::getInstance();
//manager.set_debug_mode(0,true);

//void export_sound_data_to_WAV(std::string const& sound_file_path);

std::string base_path (argv[1]);
std::cout << "Will search for audio files for conversion in directory: " << base_path << std::endl;


//std::string sound_file_path = "./aplausemr_group7_date20240715_15_09_trial1_participant1_sound.txt";
//std::string sound_file_path = "Z:/Gary/Research/APlausE - MR_MR4_CollaborativeTelepresenceStudy/unityRecordings/excluded/group7/interrupted/aplausemr_group7_date20240715_15_00_trial1_participant1_sound.txt";
//Utils::export_sound_data_to_WAV(sound_file_path);

return 0;
}


1 change: 1 addition & 0 deletions Src/Recording/Generic/GenericData.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct GenericDTO{
int i[num_c];
float f[num_c];
char c[char_c];
int layer;

std::string static dto_layout() {
return "genericDTO: int id;float t;int i[10];float f[10];char c[10];int layer = 0;";
Expand Down
1 change: 1 addition & 0 deletions Src/Recording/Sound/SoundData.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct SoundDTO{
int c_n;
int c_go_id;
float s_d[4800];
int layer;

std::string static dto_layout(){
return "SoundDTO: int id;float t;float s_t;float e_t;int s_n;int s_i;int s_r;int c_n;int c_go_id;float s_d[4800];int layer = 0;";
Expand Down
1 change: 1 addition & 0 deletions Src/Recording/Transform/TransformData.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ struct TransformDTO{
float gs[3];
int act;
int p_id;
int layer;

bool friend operator==(TransformDTO const& lhs, TransformDTO const& rhs)
{
Expand Down

0 comments on commit a4e0278

Please sign in to comment.