@@ -52,6 +52,27 @@ BinauralMonitoringJuceFrontendConnector::
52
52
if (auto oscControl = oscPortControl_.lock ()) {
53
53
oscControl->removeListener (this );
54
54
}
55
+ if (auto oscControl = oscInvertYawButton_.lock ()) {
56
+ oscControl->removeListener (this );
57
+ }
58
+ if (auto oscControl = oscInvertPitchButton_.lock ()) {
59
+ oscControl->removeListener (this );
60
+ }
61
+ if (auto oscControl = oscInvertRollButton_.lock ()) {
62
+ oscControl->removeListener (this );
63
+ }
64
+ if (auto oscControl = oscInvertQuatWButton_.lock ()) {
65
+ oscControl->removeListener (this );
66
+ }
67
+ if (auto oscControl = oscInvertQuatXButton_.lock ()) {
68
+ oscControl->removeListener (this );
69
+ }
70
+ if (auto oscControl = oscInvertQuatYButton_.lock ()) {
71
+ oscControl->removeListener (this );
72
+ }
73
+ if (auto oscControl = oscInvertQuatZButton_.lock ()) {
74
+ oscControl->removeListener (this );
75
+ }
55
76
56
77
if (listenerOrientation) {
57
78
listenerOrientation->removeListener (this );
@@ -102,6 +123,55 @@ void BinauralMonitoringJuceFrontendConnector::setOscPortControl(
102
123
setOscPort (cachedOscPort_);
103
124
}
104
125
126
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertYawButton (
127
+ std::shared_ptr<ToggleButton> button) {
128
+ button->addListener (this );
129
+ oscInvertYawButton_ = button;
130
+ setOscInvertYaw (cachedOscInvertYaw_);
131
+ }
132
+
133
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertPitchButton (
134
+ std::shared_ptr<ToggleButton> button) {
135
+ button->addListener (this );
136
+ oscInvertPitchButton_ = button;
137
+ setOscInvertPitch (cachedOscInvertPitch_);
138
+ }
139
+
140
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertRollButton (
141
+ std::shared_ptr<ToggleButton> button) {
142
+ button->addListener (this );
143
+ oscInvertRollButton_ = button;
144
+ setOscInvertRoll (cachedOscInvertRoll_);
145
+ }
146
+
147
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatWButton (
148
+ std::shared_ptr<ToggleButton> button) {
149
+ button->addListener (this );
150
+ oscInvertQuatWButton_ = button;
151
+ setOscInvertQuatW (cachedOscInvertQuatW_);
152
+ }
153
+
154
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatXButton (
155
+ std::shared_ptr<ToggleButton> button) {
156
+ button->addListener (this );
157
+ oscInvertQuatXButton_ = button;
158
+ setOscInvertQuatX (cachedOscInvertQuatX_);
159
+ }
160
+
161
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatYButton (
162
+ std::shared_ptr<ToggleButton> button) {
163
+ button->addListener (this );
164
+ oscInvertQuatYButton_ = button;
165
+ setOscInvertQuatY (cachedOscInvertQuatY_);
166
+ }
167
+
168
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatZButton (
169
+ std::shared_ptr<ToggleButton> button) {
170
+ button->addListener (this );
171
+ oscInvertQuatZButton_ = button;
172
+ setOscInvertQuatZ (cachedOscInvertQuatZ_);
173
+ }
174
+
105
175
void BinauralMonitoringJuceFrontendConnector::setListenerOrientationInstance (
106
176
std::shared_ptr<ListenerOrientation> lo) {
107
177
listenerOrientation = lo;
@@ -137,6 +207,7 @@ void BinauralMonitoringJuceFrontendConnector::setEuler(
137
207
if (listenerOrientation) {
138
208
listenerOrientation->setEuler (euler);
139
209
}
210
+
140
211
}
141
212
142
213
void BinauralMonitoringJuceFrontendConnector::setQuaternion (
@@ -160,6 +231,55 @@ void BinauralMonitoringJuceFrontendConnector::setOscPort(int port) {
160
231
cachedOscPort_ = port;
161
232
}
162
233
234
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertYaw (bool invert) {
235
+ if (auto oscInvertButtonLocked = oscInvertYawButton_.lock ()) {
236
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
237
+ }
238
+ cachedOscInvertYaw_ = invert;
239
+ }
240
+
241
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertPitch (bool invert) {
242
+ if (auto oscInvertButtonLocked = oscInvertPitchButton_.lock ()) {
243
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
244
+ }
245
+ cachedOscInvertPitch_ = invert;
246
+ }
247
+
248
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertRoll (bool invert) {
249
+ if (auto oscInvertButtonLocked = oscInvertRollButton_.lock ()) {
250
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
251
+ }
252
+ cachedOscInvertRoll_ = invert;
253
+ }
254
+
255
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatW (bool invert) {
256
+ if (auto oscInvertButtonLocked = oscInvertQuatWButton_.lock ()) {
257
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
258
+ }
259
+ cachedOscInvertQuatW_ = invert;
260
+ }
261
+
262
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatX (bool invert) {
263
+ if (auto oscInvertButtonLocked = oscInvertQuatXButton_.lock ()) {
264
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
265
+ }
266
+ cachedOscInvertQuatX_ = invert;
267
+ }
268
+
269
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatY (bool invert) {
270
+ if (auto oscInvertButtonLocked = oscInvertQuatYButton_.lock ()) {
271
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
272
+ }
273
+ cachedOscInvertQuatY_ = invert;
274
+ }
275
+
276
+ void BinauralMonitoringJuceFrontendConnector::setOscInvertQuatZ (bool invert) {
277
+ if (auto oscInvertButtonLocked = oscInvertQuatZButton_.lock ()) {
278
+ oscInvertButtonLocked->setToggleState (invert, dontSendNotification);
279
+ }
280
+ cachedOscInvertQuatZ_ = invert;
281
+ }
282
+
163
283
void BinauralMonitoringJuceFrontendConnector::orientationChange (
164
284
ear::plugin::ListenerOrientation::Euler euler) {
165
285
// ListenerOrientation callback from backend
@@ -220,6 +340,56 @@ void BinauralMonitoringJuceFrontendConnector::parameterValueChanged(
220
340
notifyParameterChanged (ParameterId::OSC_PORT, p_->getOscPort ()->get ());
221
341
setOscPort (p_->getOscPort ()->get ());
222
342
});
343
+
344
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_YAW) {
345
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
346
+ notifyParameterChanged (ParameterId::OSC_INVERT_YAW,
347
+ p_->getOscInvertYaw ()->get ());
348
+ setOscInvertYaw (p_->getOscInvertYaw ()->get ());
349
+ });
350
+
351
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_PITCH) {
352
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
353
+ notifyParameterChanged (ParameterId::OSC_INVERT_PITCH,
354
+ p_->getOscInvertPitch ()->get ());
355
+ setOscInvertPitch (p_->getOscInvertPitch ()->get ());
356
+ });
357
+
358
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_ROLL) {
359
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
360
+ notifyParameterChanged (ParameterId::OSC_INVERT_ROLL,
361
+ p_->getOscInvertRoll ()->get ());
362
+ setOscInvertRoll (p_->getOscInvertRoll ()->get ());
363
+ });
364
+
365
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_QUAT_W) {
366
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
367
+ notifyParameterChanged (ParameterId::OSC_INVERT_QUAT_W,
368
+ p_->getOscInvertQuatW ()->get ());
369
+ setOscInvertQuatW (p_->getOscInvertQuatW ()->get ());
370
+ });
371
+
372
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_QUAT_X) {
373
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
374
+ notifyParameterChanged (ParameterId::OSC_INVERT_QUAT_X,
375
+ p_->getOscInvertQuatX ()->get ());
376
+ setOscInvertQuatX (p_->getOscInvertQuatX ()->get ());
377
+ });
378
+
379
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_QUAT_Y) {
380
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
381
+ notifyParameterChanged (ParameterId::OSC_INVERT_QUAT_Y,
382
+ p_->getOscInvertQuatY ()->get ());
383
+ setOscInvertQuatY (p_->getOscInvertQuatY ()->get ());
384
+ });
385
+
386
+ } else if (parameterIndex == (int )ParameterId::OSC_INVERT_QUAT_Z) {
387
+ updater_.callOnMessageThread ([this , parameterIndex, newValue]() {
388
+ notifyParameterChanged (ParameterId::OSC_INVERT_QUAT_Z,
389
+ p_->getOscInvertQuatZ ()->get ());
390
+ setOscInvertQuatZ (p_->getOscInvertQuatZ ()->get ());
391
+ });
392
+
223
393
}
224
394
}
225
395
@@ -270,12 +440,40 @@ void BinauralMonitoringJuceFrontendConnector::orientationDragEnded(
270
440
}
271
441
272
442
void BinauralMonitoringJuceFrontendConnector::buttonClicked (Button* button) {
443
+ // note: getToggleState still has the old value for toggle types when this is called
444
+ // due to setClickingTogglesState on the button intentionally being false
273
445
if (auto oscButton = lockIfSame (oscEnableButton_, button)) {
274
- // note: getToggleState still has the old value when this is called
275
- // due to setClickingTogglesState on the button being false
276
446
bool newState = !oscButton->getToggleState ();
277
447
*(p_->getOscEnable ()) = newState;
278
448
}
449
+ if (auto oscButton = lockIfSame (oscInvertYawButton_, button)) {
450
+ bool newState = !oscButton->getToggleState ();
451
+ *(p_->getOscInvertYaw ()) = newState;
452
+ }
453
+ if (auto oscButton = lockIfSame (oscInvertPitchButton_, button)) {
454
+ bool newState = !oscButton->getToggleState ();
455
+ *(p_->getOscInvertPitch ()) = newState;
456
+ }
457
+ if (auto oscButton = lockIfSame (oscInvertRollButton_, button)) {
458
+ bool newState = !oscButton->getToggleState ();
459
+ *(p_->getOscInvertRoll ()) = newState;
460
+ }
461
+ if (auto oscButton = lockIfSame (oscInvertQuatWButton_, button)) {
462
+ bool newState = !oscButton->getToggleState ();
463
+ *(p_->getOscInvertQuatW ()) = newState;
464
+ }
465
+ if (auto oscButton = lockIfSame (oscInvertQuatXButton_, button)) {
466
+ bool newState = !oscButton->getToggleState ();
467
+ *(p_->getOscInvertQuatX ()) = newState;
468
+ }
469
+ if (auto oscButton = lockIfSame (oscInvertQuatYButton_, button)) {
470
+ bool newState = !oscButton->getToggleState ();
471
+ *(p_->getOscInvertQuatY ()) = newState;
472
+ }
473
+ if (auto oscButton = lockIfSame (oscInvertQuatZButton_, button)) {
474
+ bool newState = !oscButton->getToggleState ();
475
+ *(p_->getOscInvertQuatZ ()) = newState;
476
+ }
279
477
}
280
478
281
479
void BinauralMonitoringJuceFrontendConnector::sliderValueChanged (
0 commit comments