Skip to content

Commit

Permalink
1) Fixed RS-232 code to set line DTR to igh on startup
Browse files Browse the repository at this point in the history
2) Added function to reset position via headtracker interface
3) Minor fix in ffmpeg build scripts
4) Patch for cbmp lib to not fail with exit
5) Added generic profiles for audio mixer
6) Quaternion function renaming for clarification
  • Loading branch information
hkbinaurics committed Sep 2, 2024
1 parent 91a74b0 commit 81a52b5
Show file tree
Hide file tree
Showing 13 changed files with 269 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ void mexFunction(int nlhs, mxArray* plhs[],
jvx_quat* qout = (jvx_quat*)mxGetData(arr);
plhs[0] = arr;

jvx_quat_mult(q1, q2, qout);
jvx_quat_mult_core(q1, q2, qout);
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,22 @@
TYPE = "JVX_DATAFORMAT_SELECTION_LIST";
ONLY_SELECTION_TO_CONFIG = "yes";
};
SECTION flowControl
{
TYPE = "JVX_DATAFORMAT_SELECTION_LIST";
SELECTION_LIST_NAMES = {"None", "CTSRTS", "CTSDTR", "DSRRTS", "DSRDTR", "XONXOFF"};
SELECTION_LIST_SELECTED = {"yes", "no", "no", "no", "no", "no"};
SELECTION_LIST_EXCLUSIVE = {"yes", "yes", "yes", "yes", "yes", "yes"};
SELECTION_LIST_TRANSLATORS = {
"JVX_RS232_NO_FLOWCONTROL",
"JVX_RS232_CTSRTSFLOWCONTROL",
"JVX_RS232_CTSDTRFLOWCONTROL",
"JVX_RS232_DSRRTSFLOWCONTROL",
"JVX_RS232_DSRDTRFLOWCONTROL",
"JVX_RS232_XONXOFFFLOWCONTROL"
};
SELECTION_TRANSLATOR_TYPE = "jvxRs232FlowControlEnum";
READ_WRITE_ACCESS = "JVX_PROPERTY_ACCESS_READ_ONLY_ON_START";
CONTENT_DECODER_TYPE = "JVX_PROPERTY_DECODER_SINGLE_SELECTION";
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,8 @@ CjvxGenericRs232Device::activate_connection_port()
jvx_unlock_text_log(jvxrtst_bkp);
}

cfg.enFlow = JVX_RS232_NO_FLOWCONTROL;
// Read flow control setting from configuration property
cfg.enFlow = CjvxGenericRs232Device_pcg::translate__rs232_settings__flowControl_from(); //JVX_RS232_NO_FLOWCONTROL;

cfg.boostPrio = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class CjvxAuN2AudioMixer : public CjvxNVTasks, public IjvxDirectMixerControl, pu
public:
std::map<std::string, std::list<oneEntryChannel> > inputChannelsInStorage;
std::map<std::string, std::list<oneEntryChannel> > outputChannelsInStorage;
jvxBool storeInConfigFile = true;
};

// These two lists must be secured by the lock "_common_set_nv_proc.safeAcces_proc_tasks" since channels
Expand Down Expand Up @@ -153,6 +154,8 @@ class CjvxAuN2AudioMixer : public CjvxNVTasks, public IjvxDirectMixerControl, pu
// from base class <CjvxNVTasks> when extending the mixbuffer list!
std::map<jvxSize, oneBufferDefinition> mixBuffers;

jvxSize numberProfilePresets = 0;

private:

std::map<jvxSize, oneEntryProcessingVTask>::iterator theGlobalIterator;
Expand Down Expand Up @@ -290,6 +293,9 @@ class CjvxAuN2AudioMixer : public CjvxNVTasks, public IjvxDirectMixerControl, pu

void recursive_vtask_processing();

virtual std::string profile_preset_name(jvxSize cnt);
virtual void realize_preset_profile(jvxSize cnt);

// =============================================================================
// =============================================================================
// Property callbacks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ CjvxAuN2AudioMixer::put_configuration(jvxCallManagerConfiguration* callConf, Ijv
}
update_profile_list_properties();

gen2AudioMixer_node::put_configuration__profiles(callConf, processor, sectionToContainAllSubsectionsForMe, &warns);
// gen2AudioMixer_node::put_configuration__profiles(callConf, processor, sectionToContainAllSubsectionsForMe, &warns);
}
}
return(res);
Expand Down Expand Up @@ -321,19 +321,22 @@ CjvxAuN2AudioMixer::get_configuration(jvxCallManagerConfiguration* callConf, Ijv

for (auto& elmPro : profileList)
{

// Store all storage to config file
processor->createEmptySection(&datSecStorage, ("AYF_CHANNELS_PROFILE_" + jvx_size2String(cnt)).c_str());
processor->createAssignmentString(&datSecStorageName, "AYF_CHANNELS_PROFILE_NAME", elmPro.first.c_str());
processor->addSubsectionToSection(datSecStorage, datSecStorageName);
if (datSecStorage)
if (elmPro.second.storeInConfigFile)
{
addChannelsStorageConfig(processor, datSecStorage, "AYF_INPUT_CHANNELS_STORAGE_", elmPro.second.inputChannelsInStorage, true);
addChannelsStorageConfig(processor, datSecStorage, "AYF_OUTPUT_CHANNELS_STORAGE_", elmPro.second.outputChannelsInStorage, false);
processor->addSubsectionToSection(sectionWhereToAddAllSubsections, datSecStorage);
}

// Store all storage to config file
processor->createEmptySection(&datSecStorage, ("AYF_CHANNELS_PROFILE_" + jvx_size2String(cnt)).c_str());
processor->createAssignmentString(&datSecStorageName, "AYF_CHANNELS_PROFILE_NAME", elmPro.first.c_str());
processor->addSubsectionToSection(datSecStorage, datSecStorageName);
if (datSecStorage)
{
addChannelsStorageConfig(processor, datSecStorage, "AYF_INPUT_CHANNELS_STORAGE_", elmPro.second.inputChannelsInStorage, true);
addChannelsStorageConfig(processor, datSecStorage, "AYF_OUTPUT_CHANNELS_STORAGE_", elmPro.second.outputChannelsInStorage, false);
processor->addSubsectionToSection(sectionWhereToAddAllSubsections, datSecStorage);
}
datSecStorage = nullptr;
cnt++;
cnt++;
}
}
}
if (_common_set_min.theState >= JVX_STATE_ACTIVE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,54 +558,61 @@ JVX_PROPERTIES_FORWARD_C_CALLBACK_EXECUTE_FULL(CjvxAuN2AudioMixer, address_profi
gen2AudioMixer_node::profiles.profile_list.value.entries.size());
if (JVX_CHECK_SIZE_SELECTED(selId))
{
std::string entry = gen2AudioMixer_node::profiles.profile_list.value.entries[selId];

const auto& elmP = profileList.find(entry);

// Load profile entries
jvxSize cntChan = 0;
for (auto& set : registeredChannelListInput)
if (selId >= this->numberProfilePresets)
{
std::string masName = set.second.masName;
for (auto& elmC : set.second.channels)
std::string entry = gen2AudioMixer_node::profiles.profile_list.value.entries[selId];

const auto& elmP = profileList.find(entry);

// Load profile entries
jvxSize cntChan = 0;
for (auto& set : registeredChannelListInput)
{
updateChannelFromStorage((*elmP).second.inputChannelsInStorage, elmC, masName, true);
mixer_input.fldGain[cntChan] = elmC.gain;
jvx_bitZSet(mixer_input.fldMute[cntChan], 0);
if (elmC.mute)
std::string masName = set.second.masName;
for (auto& elmC : set.second.channels)
{
jvx_bitZSet(mixer_input.fldMute[cntChan], 1);
}
updateChannelFromStorage((*elmP).second.inputChannelsInStorage, elmC, masName, true);
mixer_input.fldGain[cntChan] = elmC.gain;
jvx_bitZSet(mixer_input.fldMute[cntChan], 0);
if (elmC.mute)
{
jvx_bitZSet(mixer_input.fldMute[cntChan], 1);
}

if (extender)
{
extender->fillLinearFields(true, cntChan, elmC.attSpecificPtr);
if (extender)
{
extender->fillLinearFields(true, cntChan, elmC.attSpecificPtr);
}

cntChan++;
}

cntChan++;
}
}

cntChan = 0;
for (auto& set : registeredChannelListOutput)
{
std::string masName = set.second.masName;
for (auto& elmC : set.second.channels)
cntChan = 0;
for (auto& set : registeredChannelListOutput)
{
updateChannelFromStorage((*elmP).second.outputChannelsInStorage, elmC, masName, false);

mixer_output.fldGain[cntChan] = elmC.gain;
jvx_bitZSet(mixer_output.fldMute[cntChan], 0);
if (elmC.mute)
{
jvx_bitZSet(mixer_output.fldMute[cntChan], 1);
}
if (extender)
std::string masName = set.second.masName;
for (auto& elmC : set.second.channels)
{
extender->fillLinearFields(false, cntChan, elmC.attSpecificPtr);
updateChannelFromStorage((*elmP).second.outputChannelsInStorage, elmC, masName, false);

mixer_output.fldGain[cntChan] = elmC.gain;
jvx_bitZSet(mixer_output.fldMute[cntChan], 0);
if (elmC.mute)
{
jvx_bitZSet(mixer_output.fldMute[cntChan], 1);
}
if (extender)
{
extender->fillLinearFields(false, cntChan, elmC.attSpecificPtr);
}
cntChan++;
}
cntChan++;
}
}
}
else
{
realize_preset_profile(selId);
}

CjvxProperties::add_property_report_collect(gen2AudioMixer_node::mixer_input.mixer_control.level_gain.descriptor.std_str());
Expand Down Expand Up @@ -657,6 +664,16 @@ CjvxAuN2AudioMixer::update_profile_list_properties(const std::string& activateTh
gen2AudioMixer_node::profiles.profile_list.value.entries.clear();
jvx_bitFClear(gen2AudioMixer_node::profiles.profile_list.value.selection());

for (cnt = 0; cnt < numberProfilePresets; cnt++)
{
std::string token = profile_preset_name(cnt);
if (token == actProf)
{
idNew = cnt;
}
gen2AudioMixer_node::profiles.profile_list.value.entries.push_back(token);
}

for (auto elm : profileList)
{
if (elm.first == actProf)
Expand All @@ -680,3 +697,15 @@ CjvxAuN2AudioMixer::update_profile_list_properties(const std::string& activateTh
}
}

std::string
CjvxAuN2AudioMixer::profile_preset_name(jvxSize cnt)
{
std::string token = "Profile #" + jvx_size2String(cnt);
return token;
}

void
CjvxAuN2AudioMixer::realize_preset_profile(jvxSize cnt)
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@ struct jvx_quat
jvxData w;
};

void jvx_quat_mult(const struct jvx_quat* qxyzw1, const struct jvx_quat* qxyzw2, struct jvx_quat* qxyzw3);
// If we combine two rotations, rot1 first and rot2 afterwards, we need to consider the order in
// jvx_quat_mult_core: q1 -> q2 can be expressed on rotation matrices as
// R2 * R1 * vec. Therefore to combine rot1 and rot2 in the right order, we need to compute q2 * q1!!
// The function <jvx_combine_rot> allows to more intuitively describe that in a function call than <jvx_quat_mult_core>!!

void jvx_quat_combine_rot(const struct jvx_quat* rot_first, const struct jvx_quat* rot_second, struct jvx_quat* rot_combined);
void jvx_quat_mult_core(const struct jvx_quat* qxyzw1, const struct jvx_quat* qxyzw2, struct jvx_quat* qxyzw3);

void jvx_quat_inv(const struct jvx_quat* qin, struct jvx_quat* qout);
jvxData jvx_quat_abs2(const struct jvx_quat* q);
void jvx_quat_reset(struct jvx_quat* q);
Expand Down
7 changes: 6 additions & 1 deletion sources/jvxLibraries/jvx-dsp-base/src/jvx_quat/jvx_quat.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "jvx_dsp_base.h"
#include "jvx_quat/jvx_quat.h"

void jvx_quat_mult(const struct jvx_quat* qxyzw1, const struct jvx_quat* qxyzw2, struct jvx_quat* qxyzw3)
void jvx_quat_mult_core(const struct jvx_quat* qxyzw1, const struct jvx_quat* qxyzw2, struct jvx_quat* qxyzw3)
{
jvxData x1 = qxyzw1->x;
jvxData x2 = qxyzw1->y;
Expand All @@ -25,6 +25,11 @@ void jvx_quat_mult(const struct jvx_quat* qxyzw1, const struct jvx_quat* qxyzw2,
qxyzw3->w = z0;
}

void jvx_quat_combine_rot(const struct jvx_quat* rot_first, const struct jvx_quat* rot_second, struct jvx_quat* rot_combined)
{
jvx_quat_mult_core(rot_second, rot_first, rot_combined);
}

void jvx_quat_inv(const struct jvx_quat* qin, struct jvx_quat* qout)
{
jvxData q1 = qin->x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ JVX_INTERFACE IjvxPropertyExtenderHeadTrackerProvider
virtual ~IjvxPropertyExtenderHeadTrackerProvider() {};
virtual jvxErrorType register_listener(IjvxPropertyExtenderHeadTrackerProvider_report* ptr, const char* tag) = 0;
virtual jvxErrorType unregister_listener(IjvxPropertyExtenderHeadTrackerProvider_report* ptr) = 0;
virtual jvxErrorType request_trigger_zero_calibration(jvxBool reset = false) = 0;
};

#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
From 515a963c8063621d55574b00b1d5040e3ba2ab9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hauke=20Kr=C3=BCger?= <[email protected]>
Date: Mon, 2 Sep 2024 18:04:16 +0200
Subject: [PATCH] Modified lib to not exit in case a bmp was not valid

---
cbmp.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cbmp.c b/cbmp.c
index 0cfd4f0..85d5a8d 100644
--- a/cbmp.c
+++ b/cbmp.c
@@ -51,7 +51,7 @@ BMP* bopen(char* file_path)
if (fp == NULL)
{
perror("Error opening file");
- exit(EXIT_FAILURE);
+ return NULL;
}

BMP* bmp = (BMP*) malloc(sizeof(BMP));
@@ -62,6 +62,7 @@ BMP* bopen(char* file_path)
if(!_validate_file_type(bmp->file_byte_contents))
{
_throw_error("Invalid file type");
+ return NULL;
}

bmp->pixel_array_start = _get_pixel_array_start(bmp->file_byte_contents);
@@ -73,6 +74,7 @@ BMP* bopen(char* file_path)
if(!_validate_depth(bmp->depth))
{
_throw_error("Invalid file depth");
+ return NULL;
}

_populate_pixel_array(bmp);
@@ -172,7 +174,6 @@ void bclose(BMP* bmp)
void _throw_error(char* message)
{
fprintf(stderr, "%s\n", message);
- exit(1);
}

unsigned int _get_int_from_buffer(unsigned int bytes,
@@ -208,6 +209,7 @@ unsigned char* _get_file_byte_contents(FILE* fp, unsigned int file_byte_number)
if (result != file_byte_number)
{
_throw_error("There was a problem reading the file");
+ return NULL;
}


--
2.35.1.windows.2

3 changes: 3 additions & 0 deletions sources/jvxLibraries/third_party/git/cbmp/prepareModules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

if [ ! -d "cbmt" ]; then
git clone https://github.com/mattflow/cbmp.git
cd cbmt
git apply ../0001-Modified-lib-to-not-exit-in-case-a-bmp-was-not-valid.patch
cd ..
fi
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ if [ -d $folder ]; then

# The following line can be modified to run directly
# ./make-Makefiles-64bit.sh
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=$release_mode -DCMAKE_CXX_FLAGS="-DWIN32 -D_WINDOWS -W4 -GR -EHsc" -DCMAKE_C_FLAGS="-DWIN32 -D_WINDOWS -W4 $compile_flags" ../../source -DCMAKE_INSTALL_PREFIX=./install-$release_mode
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=$release_mode -DCMAKE_CXX_FLAGS="-DWIN32 -D_WINDOWS -W4 -GR -EHsc $compile_flags" -DCMAKE_C_FLAGS="-DWIN32 -D_WINDOWS -W4 $compile_flags" ../../source -DCMAKE_INSTALL_PREFIX=./install-$release_mode
nmake
nmake install

Expand All @@ -81,7 +81,7 @@ if [ -d $folder ]; then
# H264 ->
# https://stackoverflow.com/questions/50693934/different-h264-encoders-in-ffmpeg
# https://superuser.com/questions/512368/unknown-encoder-libx264-on-windows
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-gpl --enable-libx264 --enable-libx265 --extra-cflags=-MDd --prefix=./ --disable-htmlpages --disable-manpages
./configure --target-os=win64 --arch=x86_64 --toolchain=msvc --enable-gpl --enable-libx264 --enable-libx265 --extra-cflags=$compile_flags --prefix=./ --disable-htmlpages --disable-manpages

#echo ./configure --target-os=win64 --arch=x86_64 --enable-debug=3 --toolchain=msvc --prefix=./
#./configure --target-os=win64 --arch=x86_64 --enable-debug=3 --toolchain=msvc --prefix=./
Expand Down
Loading

0 comments on commit 81a52b5

Please sign in to comment.