Skip to content

Commit ce0ba4e

Browse files
authored
Merge pull request #4 from 3DTune-In/release/1.1.4
Release/1.1.4
2 parents 828cb51 + 5d556b7 commit ce0ba4e

24 files changed

Lines changed: 287 additions & 1215 deletions

3dti_Anechoic/3dti_Anechoic.jucer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pluginVSTCategory="kPlugCategSpacializer" pluginAUMainType="'aupn'"
88
pluginFormats="buildAU,buildVST3" pluginManufacturer="3D Tune-In"
99
aaxIdentifier="eu.3d-tune-in.anechoic" bundleIdentifier="eu.3d-tune-in.anechoic"
10-
version="1.1.3" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
10+
version="1.1.4" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
1111
pluginManufacturerCode="Tdti" pluginCode="Tspa" displaySplashScreen="1">
1212
<MAINGROUP id="J6xy11" name="3DTI Anechoic Spatialisation">
1313
<GROUP id="{59D5466E-D9A3-AE3E-55D8-0744C13FA3E0}" name="Libs">

3dti_Hearing_Aid_Simulator/3dti_Hearing_Aid_Simulator.jucer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pluginAAXCategory="512" pluginVSTCategory="kPlugCategEffect"
77
pluginAUMainType="'aufx'" pluginFormats="buildAU,buildVST3" pluginManufacturer="3D Tune-In"
88
aaxIdentifier="eu.3d-tune-in.hasplugin" bundleIdentifier="eu.3d-tune-in.hasplugin"
9-
version="1.1.3" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
9+
version="1.1.4" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
1010
pluginManufacturerCode="Dtun" pluginCode="Hasm" displaySplashScreen="1">
1111
<MAINGROUP id="J6xy11" name="3DTI Hearing Aid Simulator">
1212
<GROUP id="{59D5466E-D9A3-AE3E-55D8-0744C13FA3E0}" name="Libs">

3dti_Hearing_Loss_Simulator/3dti_Hearing_Loss_Simulator.jucer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pluginAAXCategory="512" pluginVSTCategory="kPlugCategEffect"
77
pluginAUMainType="'aufx'" pluginFormats="buildAU,buildVST3" pluginManufacturer="3D Tune-In"
88
aaxIdentifier="eu.3d-tune-in.hlsplugin" bundleIdentifier="eu.3d-tune-in.hlsplugin"
9-
version="1.1.3" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
9+
version="1.1.4" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
1010
pluginManufacturerCode="Dtun" pluginCode="Hlsm" displaySplashScreen="1">
1111
<MAINGROUP id="J6xy11" name="3DTI Hearing Loss Simulator">
1212
<GROUP id="{59D5466E-D9A3-AE3E-55D8-0744C13FA3E0}" name="Libs">

3dti_Reverb/3dti_Reverb.jucer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
pluginVSTCategory="kPlugCategSpacializer" pluginAUMainType="'aufx'"
77
pluginFormats="buildAU,buildVST3" pluginManufacturer="3D Tune-In"
88
aaxIdentifier="eu.3d-tune-in.reverbplugin" bundleIdentifier="eu.3d-tune-in.reverbplugin"
9-
version="1.1.3" companyWebsite="http://3d-tune-in.eu" pluginCode="Trev"
9+
version="1.1.4" companyWebsite="http://3d-tune-in.eu" pluginCode="Trev"
1010
pluginManufacturerCode="Tdti" jucerFormatVersion="1" displaySplashScreen="1"
1111
compilerFlagSchemes="NoDebug">
1212
<MAINGROUP id="J6xy11" name="3DTI 3D Reverb">

3dti_Spatialisation.jucer

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
pluginAAXCategory="512" pluginVSTCategory="kPlugCategSpacializer"
88
pluginFormats="buildAU,buildVST3" pluginManufacturer="3D Tune-In"
99
aaxIdentifier="eu.3d-tune-in.toolkitplugin" bundleIdentifier="eu.3d-tune-in.toolkitplugin"
10-
version="1.1.3" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
10+
version="1.1.4" companyWebsite="http://3d-tune-in.eu" jucerFormatVersion="1"
1111
pluginManufacturerCode="Dtun" pluginCode="Plug" pluginAUMainType="'aufx'"
1212
displaySplashScreen="1" compilerFlagSchemes="NoDebug">
1313
<MAINGROUP id="J6xy11" name="3DTI Spatialisation">

Source/Binaural/AnechoicControls.cpp

Lines changed: 55 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* \class AnechoicControls
33
*
44
* \brief Declaration of AnechoicControls interface.
5-
* \date June 2019
5+
* \date February 2022
66
*
77
* \authors Reactify Music LLP: R. Hrafnkelsson ||
88
* Coordinated by , A. Reyes-Lecuona (University of Malaga) and L.Picinali (Imperial College London) ||
@@ -11,7 +11,7 @@
1111
* \b Project: 3DTI (3D-games for TUNing and lEarnINg about hearing aids) ||
1212
* \b Website: http://3d-tune-in.eu/
1313
*
14-
* \b Copyright: University of Malaga and Imperial College London - 2021
14+
* \b Copyright: University of Malaga and Imperial College London - 2022
1515
*
1616
* \b Licence: This copy of the 3D Tune-In Toolkit Plugin is licensed to you under the terms described in the LICENSE.md file included in this distribution.
1717
*
@@ -21,18 +21,17 @@
2121
#include "Utils.h"
2222
#include "AnechoicControls.h"
2323

24-
AnechoicControls::AnechoicControls (AnechoicProcessor& processor)
25-
: mCore (processor),
26-
distanceAttenuationLabel("Distance Label", "dB attenuation per double distance")
24+
AnechoicControls::AnechoicControls (AnechoicProcessor& processor,
25+
AudioProcessorValueTreeState& params)
26+
: mCore (processor)
27+
, mParameters (params)
28+
, buttonAttachment (params, "HRTF", hrtfMenu)
29+
, distanceAttenuationLabel("Distance Label", "dB attenuation per double distance")
2730
{
2831
setOpaque (true);
2932

30-
for ( int i = 0; i < BundledHRTFs.size(); i++ ) {
31-
hrtfMenu.addItem( BundledHRTFs[i], i+1 ); // IDs must be non-zero
32-
}
33-
hrtfMenu.onChange = [this] { hrtfMenuChanged(); };
34-
hrtfMenu.setSelectedItemIndex(0, dontSendNotification);
35-
addAndMakeVisible( hrtfMenu );
33+
hrtfMenu.addItemList (BundledHRTFs, 1);
34+
addAndMakeVisible (hrtfMenu);
3635

3736
headCircumferenceToggle.setButtonText( "Custom Head Circumference" );
3837
headCircumferenceToggle.onClick = [this] { updateHeadCircumference(); };
@@ -80,10 +79,14 @@ AnechoicControls::AnechoicControls (AnechoicProcessor& processor)
8079
addAndMakeVisible( distanceAttenuationSlider );
8180

8281
updateGui();
82+
updateHrtfLabelText();
8383

84-
mCore.didReloadHRTF = [this] {
85-
updateHrtfLabelText();
86-
};
84+
mCore.addChangeListener (this);
85+
}
86+
87+
AnechoicControls::~AnechoicControls()
88+
{
89+
mCore.removeChangeListener (this);
8790
}
8891

8992
void AnechoicControls::updateGui() {
@@ -107,6 +110,15 @@ void AnechoicControls::updateGui() {
107110
qualityToggle.setToggleState( mCore.spatializationMode, dontSendNotification);
108111
}
109112

113+
void AnechoicControls::paint (Graphics& g)
114+
{
115+
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); // clear the background
116+
g.setColour (Colours::white);
117+
g.setFont (18.0f);
118+
g.drawText ("Anechoic Path", getLocalBounds().withTrimmedBottom( getLocalBounds().getHeight() - 32 ),
119+
Justification::centred, true);
120+
}
121+
110122
void AnechoicControls::resized() {
111123
auto area = getLocalBounds();
112124
bypassToggle.setBounds( 10, 4, 80, 24 );
@@ -121,6 +133,20 @@ void AnechoicControls::resized() {
121133
distanceAttenuationSlider.setBounds( 6, distanceAttenuationToggle.getBottom() + 4, area.getWidth()-20, 24);
122134
}
123135

136+
void AnechoicControls::sliderValueChanged (Slider* slider)
137+
{
138+
if ( slider == &headCircumferenceSlider ) {
139+
updateHeadCircumference();
140+
} else {
141+
mCore.sourceDistanceAttenuation = (float)slider->getValue();
142+
}
143+
}
144+
145+
void AnechoicControls::changeListenerCallback (ChangeBroadcaster *source)
146+
{
147+
updateHrtfLabelText();
148+
}
149+
124150
void AnechoicControls::updateBypass() {
125151
bool enabled = bypassToggle.getToggleState();
126152
if ( enabled ) {
@@ -131,46 +157,6 @@ void AnechoicControls::updateBypass() {
131157
setAlpha( enabled + 0.4f );
132158
}
133159

134-
void AnechoicControls::hrtfMenuChanged() {
135-
auto text = hrtfMenu.getText();
136-
// Note(Ragnar): Windows FileChooser will only accept
137-
// one filetype at a time so we provide separate options
138-
if ( text == "Load 3DTI" ) {
139-
loadCustomHrtf("*.3dti-hrtf");
140-
} else if ( text == "Load SOFA" ) {
141-
loadCustomHrtf("*.sofa");
142-
} else {
143-
mCore.loadHRTF(hrtfMenu.getSelectedItemIndex());
144-
}
145-
}
146-
147-
void AnechoicControls::loadCustomHrtf(String fileTypes) {
148-
fc.reset (new FileChooser ("Choose a file to open...",
149-
HRTFDirectory(),
150-
fileTypes,
151-
true));
152-
153-
fc->showDialog (FileBrowserComponent::openMode | FileBrowserComponent::canSelectFiles, nullptr);
154-
155-
auto results = fc->getURLResults();
156-
if (results.isEmpty())
157-
{
158-
updateHrtfLabelText();
159-
return;
160-
}
161-
162-
auto result = results.getFirst();
163-
164-
String chosen;
165-
chosen << (result.isLocalFile() ? result.getLocalFile().getFullPathName()
166-
: result.toString (false));
167-
168-
hrtfMenu.setText ("Loading...");
169-
170-
if (! mCore.loadHRTF(File(chosen.removeCharacters("\n"))))
171-
updateHrtfLabelText();
172-
}
173-
174160
void AnechoicControls::updateHeadCircumference() {
175161
bool enabled = headCircumferenceToggle.getToggleState();
176162
mCore.enableCustomizedITD = enabled;
@@ -181,14 +167,22 @@ void AnechoicControls::updateHeadCircumference() {
181167
headCircumferenceSlider.setEnabled(enabled);
182168
}
183169

184-
void AnechoicControls::updateHrtfLabelText() {
185-
auto hrtfIndex = mCore.getHrtfIndex();
186-
if (hrtfIndex >= 0 && hrtfIndex < BundledHRTFs.size()-2) {
187-
hrtfMenu.setSelectedItemIndex(hrtfIndex, dontSendNotification);
188-
} else {
170+
void AnechoicControls::updateHrtfLabelText()
171+
{
172+
auto* parameter = mParameters.getParameter ("HRTF");
173+
174+
auto hrtfValue = parameter->getValue();
175+
int hrtfIndex = std::floor (parameter->convertFrom0to1 (hrtfValue));
176+
177+
if (hrtfIndex >= BundledHRTFs.size() - 2)
178+
{
189179
// Show filename if custom file is selected
190-
auto hrtf = mCore.getHrtfPath().getFileNameWithoutExtension().upToLastOccurrenceOf("_", false, false);;
191-
hrtfMenu.setText(hrtf, dontSendNotification);
180+
auto hrtf = mCore.getHrtfPath().getFileNameWithoutExtension().upToLastOccurrenceOf ("_", false, false);
181+
hrtfMenu.setText (hrtf, dontSendNotification);
182+
}
183+
else
184+
{
185+
hrtfMenu.setSelectedItemIndex (hrtfIndex, dontSendNotification);
192186
}
193187
}
194188

Source/Binaural/AnechoicControls.h

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* \class AnechoicControls
33
*
44
* \brief Declaration of AnechoicControls interface.
5-
* \date June 2019
5+
* \date February 2022
66
*
77
* \authors Reactify Music LLP: R. Hrafnkelsson ||
88
* Coordinated by , A. Reyes-Lecuona (University of Malaga) and L.Picinali (Imperial College London) ||
@@ -11,7 +11,7 @@
1111
* \b Project: 3DTI (3D-games for TUNing and lEarnINg about hearing aids) ||
1212
* \b Website: http://3d-tune-in.eu/
1313
*
14-
* \b Copyright: University of Malaga and Imperial College London - 2021
14+
* \b Copyright: University of Malaga and Imperial College London - 2022
1515
*
1616
* \b Licence: This copy of the 3D Tune-In Toolkit Plugin is licensed to you under the terms described in the LICENSE.md file included in this distribution.
1717
*
@@ -26,39 +26,30 @@
2626
//==============================================================================
2727
/*
2828
*/
29-
class AnechoicControls : public Component, public Slider::Listener
29+
class AnechoicControls : public Component,
30+
public ChangeListener,
31+
public Slider::Listener
3032
{
3133
public:
32-
AnechoicControls (AnechoicProcessor& processor);
34+
//============================================================================
35+
AnechoicControls (AnechoicProcessor& processor, AudioProcessorValueTreeState& params);
3336

34-
~AnechoicControls() {}
37+
~AnechoicControls();
3538

3639
void updateGui();
3740

38-
void paint (Graphics& g) override {
39-
g.fillAll (getLookAndFeel().findColour (ResizableWindow::backgroundColourId)); // clear the background
40-
g.setColour(Colours::white);
41-
g.setFont(18.0f);
42-
g.drawText("Anechoic Path", getLocalBounds().withTrimmedBottom( getLocalBounds().getHeight() - 32 ),
43-
Justification::centred, true);
44-
}
41+
void paint (Graphics& g) override;
4542

4643
void resized() override;
4744

48-
void sliderValueChanged(Slider* slider) override {
49-
if ( slider == &headCircumferenceSlider ) {
50-
updateHeadCircumference();
51-
} else {
52-
mCore.sourceDistanceAttenuation = (float)slider->getValue();
53-
}
54-
}
45+
void sliderValueChanged(Slider* slider) override;
46+
47+
void changeListenerCallback (ChangeBroadcaster* source) override;
5548

5649
ToggleButton bypassToggle;
5750

5851
private:
59-
60-
void hrtfMenuChanged();
61-
void loadCustomHrtf(String fileTypes);
52+
//============================================================================
6253
void updateBypass();
6354
void updateHeadCircumference();
6455
void updateHrtfLabelText();
@@ -68,8 +59,10 @@ class AnechoicControls : public Component, public Slider::Listener
6859
void updateDistanceAttenuation();
6960

7061
AnechoicProcessor& mCore;
62+
AudioProcessorValueTreeState& mParameters;
7163

7264
ComboBox hrtfMenu;
65+
AudioProcessorValueTreeState::ComboBoxAttachment buttonAttachment;
7366
ToggleButton headCircumferenceToggle;
7467
Slider headCircumferenceSlider;
7568
std::unique_ptr<FileChooser> fc;

Source/Binaural/AnechoicPluginEditor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ AnechoicPluginProcessorEditor::AnechoicPluginProcessorEditor (AnechoicPluginProc
2727
: AudioProcessorEditor (&p)
2828
, processor (p)
2929
, sourceControls (p.getCore())
30-
, anechoicControls (p.getCore())
30+
, anechoicControls (p.getCore(), p.treeState)
3131
, reverbControls (p)
3232
, spatializerWidget (p.getCore())
3333
{

Source/Binaural/AnechoicPluginProcessor.cpp

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* \class AnechoicPluginProcessor
33
*
44
* \brief Declaration of AnechoicPluginProcessor interface.
5-
* \date November 2021
5+
* \date February 2022
66
*
77
* \authors Reactify Music LLP: R. Hrafnkelsson ||
88
* Coordinated by , A. Reyes-Lecuona (University of Malaga) and L.Picinali (Imperial College London) ||
@@ -101,7 +101,7 @@ AnechoicPluginProcessor::AnechoicPluginProcessor()
101101
treeState.addParameterListener ("Enable Reverb", this);
102102

103103
treeState.createAndAddParameter (std::make_unique<Parameter> ("HRTF", "HRTF", "", NormalisableRange<float>(0, BundledHRTFs.size()-1), 0, [](float value) { return String (value, 0); }, nullptr));
104-
treeState.addParameterListener ("HRTF", this);
104+
treeState.addParameterListener ("HRTF", &mSpatializer);
105105

106106
treeState.state = ValueTree("3DTI Anechoic Spatialisation Parameters");
107107

@@ -111,10 +111,7 @@ AnechoicPluginProcessor::AnechoicPluginProcessor()
111111
#endif
112112
}
113113

114-
AnechoicPluginProcessor::~AnechoicPluginProcessor()
115-
{
116-
stopTimer();
117-
}
114+
AnechoicPluginProcessor::~AnechoicPluginProcessor() {}
118115

119116
//==============================================================================
120117
const String AnechoicPluginProcessor::getName() const
@@ -205,8 +202,6 @@ void AnechoicPluginProcessor::prepareToPlay (double sampleRate, int samplesPerBl
205202
mCore.SetAudioState ({(int)sampleRate, blockSizeInternal});
206203

207204
mSpatializer.setup (sampleRate/*,blockSizeInternal*/);
208-
209-
startTimer (30);
210205
}
211206

212207
void AnechoicPluginProcessor::releaseResources() {
@@ -351,8 +346,7 @@ void AnechoicPluginProcessor::updateHostParameters()
351346
{"Near Field", getCore().enableNearDistanceEffect},
352347
{"Far Field", getCore().enableFarDistanceEffect},
353348
{"Custom Head", getCore().enableCustomizedITD},
354-
{"Head Circumference", getCore().headCircumference},
355-
{"HRFT", getCore().getHrtfIndex() },
349+
{"Head Circumference", getCore().headCircumference}
356350
};
357351

358352
for (auto const & parameter : parameters)
@@ -421,8 +415,6 @@ void AnechoicPluginProcessor::parameterChanged (const String& parameterID, float
421415
sources.front()->DisableReverbProcess();
422416
}
423417
}
424-
} else if ( parameterID == "HRTF" ) {
425-
getCore().loadHRTF((int)newValue);
426418
}
427419

428420
if (sources.size() > 0)

0 commit comments

Comments
 (0)