Skip to content

Commit eb3befb

Browse files
committed
#39 Disable zero-delay convolution and use offset in the IRs instead.
1 parent e7f5a03 commit eb3befb

File tree

2 files changed

+27
-10
lines changed

2 files changed

+27
-10
lines changed

Source/aeolus/engine.cpp

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,12 +216,19 @@ void EngineGlobal::loadIRs()
216216
{
217217
_irs.clear();
218218

219+
// This corresponds to the zero-delay segment of the
220+
// convolver (see dsp/convolver.cpp) that we remove from
221+
// the beginning of the IRs and use non-zero delay instead
222+
// for better performance.
223+
constexpr size_t startOffset = 4096;
224+
219225
_irs.push_back({
220226
"York Guildhall Council Chamber",
221227
BinaryData::york_council_chamber_wav,
222228
BinaryData::york_council_chamber_wavSize,
223229
0.25f,
224-
true,
230+
false,
231+
startOffset,
225232
{}
226233
});
227234

@@ -230,7 +237,8 @@ void EngineGlobal::loadIRs()
230237
BinaryData::st_laurentius_molenbeek_wav,
231238
BinaryData::st_laurentius_molenbeek_wavSize,
232239
0.8f,
233-
true,
240+
false,
241+
startOffset,
234242
{}
235243
});
236244

@@ -239,7 +247,8 @@ void EngineGlobal::loadIRs()
239247
BinaryData::st_andrews_church_wav,
240248
BinaryData::st_andrews_church_wavSize,
241249
1.0f,
242-
true,
250+
false,
251+
startOffset,
243252
{}
244253
});
245254

@@ -248,7 +257,8 @@ void EngineGlobal::loadIRs()
248257
BinaryData::st_georges_far_wav,
249258
BinaryData::st_georges_far_wavSize,
250259
1.0f,
251-
true,
260+
false,
261+
startOffset,
252262
{}
253263
});
254264

@@ -257,7 +267,8 @@ void EngineGlobal::loadIRs()
257267
BinaryData::lady_chapel_stalbans_wav,
258268
BinaryData::lady_chapel_stalbans_wavSize,
259269
1.0f,
260-
true,
270+
false,
271+
startOffset,
261272
{}
262273
});
263274

@@ -266,7 +277,8 @@ void EngineGlobal::loadIRs()
266277
BinaryData::_1st_baptist_nashville_balcony_wav,
267278
BinaryData::_1st_baptist_nashville_balcony_wavSize,
268279
1.0f,
269-
true,
280+
false,
281+
startOffset,
270282
{}
271283
});
272284

@@ -276,6 +288,7 @@ void EngineGlobal::loadIRs()
276288
BinaryData::elveden_hall_suffolk_england_wavSize,
277289
0.1f,
278290
false,
291+
0,
279292
{}
280293
});
281294

@@ -284,7 +297,8 @@ void EngineGlobal::loadIRs()
284297
BinaryData::r1_nuclear_reactor_hall_wav,
285298
BinaryData::r1_nuclear_reactor_hall_wavSize,
286299
0.4f,
287-
true,
300+
false,
301+
startOffset,
288302
{}
289303
});
290304

@@ -293,7 +307,8 @@ void EngineGlobal::loadIRs()
293307
BinaryData::york_uni_sportscentre_wav,
294308
BinaryData::york_uni_sportscentre_wavSize,
295309
0.4f,
296-
true,
310+
false,
311+
startOffset,
297312
{}
298313
});
299314

@@ -302,7 +317,8 @@ void EngineGlobal::loadIRs()
302317
BinaryData::york_minster_wav,
303318
BinaryData::york_minster_wavSize,
304319
0.3f,
305-
true,
320+
false,
321+
startOffset,
306322
{}
307323
});
308324

@@ -316,7 +332,7 @@ void EngineGlobal::loadIRs()
316332
std::unique_ptr<InputStream> stream = std::make_unique<MemoryInputStream>(ir.data, ir.size, false);
317333
std::unique_ptr<AudioFormatReader> reader{manager.createReaderFor(std::move(stream))};
318334
ir.waveform.setSize(reader->numChannels, (int)reader->lengthInSamples);
319-
reader->read(&ir.waveform, 0, ir.waveform.getNumSamples(), 0, true, true);
335+
reader->read(&ir.waveform, 0, ir.waveform.getNumSamples(), (juce::int64)ir.startOffset, true, true);
320336

321337
ir.waveform.applyGain(ir.gain);
322338

Source/aeolus/engine.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ class EngineGlobal : public juce::DeletedAtShutdown
7272

7373
float gain;
7474
bool zeroDelay;
75+
size_t startOffset; // Sample offset from the beginning of the IR waveform
7576

7677
juce::AudioBuffer<float> waveform;
7778
};

0 commit comments

Comments
 (0)