Skip to content

Commit 8b60bad

Browse files
committed
Added define for audio subsampling.
1 parent 69d20c9 commit 8b60bad

File tree

8 files changed

+13
-10
lines changed

8 files changed

+13
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
cmake_minimum_required(VERSION 3.16)
2-
project(RecordingPlugin VERSION "0.8.4")
2+
project(RecordingPlugin VERSION "0.8.5")
33

44
set(CMAKE_CXX_STANDARD 17)
55

@@ -13,9 +13,9 @@ set(UtilsDir Utils)
1313
configure_file(Config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/${SrcDir}/Config.h @ONLY)
1414

1515
if(ANDROID_BUILD)
16-
set( UNITY_PLUGINS_DIR "C:/Users/Anton-Lammert/Desktop/ImmersiveStudyAnalyzer/Assets/Plugins/Android/ARM64" )
16+
set( UNITY_PLUGINS_DIR "C:/Users/Anton-Lammert/Desktop/Immersive-Study-Analyzer/Assets/Plugins/Android/ARM64" )
1717
else()
18-
set( UNITY_PLUGINS_DIR "C:/Users/Anton-Lammert/Desktop/ImmersiveStudyAnalyzer/Assets/Plugins/Windows" )
18+
set( UNITY_PLUGINS_DIR "C:/Users/Anton-Lammert/Desktop/Immersive-Study-Analyzer/Assets/Plugins/Windows" )
1919
endif()
2020

2121
if(NOT WORKFLOW)

Config.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#define PROJECT_VER_MINOR "@PROJECT_VERSION_MINOR@"
1111
#define PROJECT_VER_PATCH "@PROJECT_VERSION_PATCH@"
1212
#define COMPRESSION 0
13+
#define SUBSAMPLE_RECORDED_AUDIO 0
1314
#define COMPRESSION_LEVEL 5 // 1 (low) to 9 (high but slow)
1415
#define MULTI_THREADED 1
1516
const size_t HEADER_SIZE = sizeof(uint32_t); // size of compressed data block header

Src/Config.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
#include <stdint.h>
66

77
#define PROJECT_NAME "RecordingPlugin"
8-
#define PROJECT_VER "0.8.4"
8+
#define PROJECT_VER "0.8.5"
99
#define PROJECT_VER_MAJOR "0"
1010
#define PROJECT_VER_MINOR "8"
11-
#define PROJECT_VER_PATCH "4"
11+
#define PROJECT_VER_PATCH "5"
1212
#define COMPRESSION 0
13+
#define SUBSAMPLE_RECORDED_AUDIO 0
1314
#define COMPRESSION_LEVEL 5 // 1 (low) to 9 (high but slow)
1415
#define MULTI_THREADED 1
1516
const size_t HEADER_SIZE = sizeof(uint32_t); // size of compressed data block header

Src/Recording/Generic/GenericData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct GenericDTO{
6060
char c[char_c];
6161

6262
std::string static dto_layout() {
63-
return "genericDTO: int id;float t;int i[10];float f[10];char c[10];int layer = 0;";
63+
return "genericDTO: int id;float t;int i[10];float f[10];char c[10];";
6464
}
6565
};
6666

Src/Recording/Recorder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ Recorder::record_sound(float *sound_data, int sound_data_length, int sampling_ra
504504
Debug::Log("Waiting until the current sound data is written to file before recording new data");
505505
i++;
506506
}
507-
507+
#ifdef SUBSAMPLE_RECORDED_AUDIO
508508
int subsample_factor = 2;
509509
bool subsampled = false;
510510
if(sampling_rate % subsample_factor == 0 && sampling_rate/subsample_factor >= 16000){
@@ -522,6 +522,7 @@ Recorder::record_sound(float *sound_data, int sound_data_length, int sampling_ra
522522

523523
if(debug)
524524
Debug::Log("Subsampled audio source: " + std::to_string(sound_id));
525+
# endif
525526

526527
if(last_sound_data.count(sound_id) == 0)
527528
last_sound_data[sound_id] = sound_dto;

Src/Recording/Sound/SoundData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ struct SoundDTO{
6060
float s_d[4800];
6161

6262
std::string static dto_layout(){
63-
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;";
63+
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];";
6464
}
6565
};
6666

Src/Recording/Transform/TransformData.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ struct TransformDTO{
9191
}
9292

9393
std::string static dto_layout(){
94-
return "TransformDTO: int id;float t;float lp[3];float lr[4];float ls[3];float gp[3];float gr[4];float gs[3];int act;int p_id;int layer = 0;";
94+
return "TransformDTO: int id;float t;float lp[3];float lr[4];float ls[3];float gp[3];float gr[4];float gs[3];int act;int p_id;";
9595
}
9696
};
9797

Utils/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void Utils::export_generic_data_to_CSV(const std::string &generic_file_path) {
194194

195195
void Utils::export_sound_data_to_WAV(std::string const& sound_file_path) {
196196
Debug::Log("Writing sound data to WAV file");
197-
197+
Debug::Log("Reading sound data from file: " + sound_file_path);
198198
std::string sound_data_file = sound_file_path;
199199
//std::set<int> sound_ids = current_recording.meta_information.get_sound_ids();
200200

0 commit comments

Comments
 (0)