Skip to content

Commit 41a4e9b

Browse files
committed
#39 Use real pre-delay offset for the IRs.
1 parent eb3befb commit 41a4e9b

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

Source/aeolus/engine.cpp

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,15 @@ 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;
219+
// Here we offset the IRs predelay and use non-zero convolution instead.
224220

225221
_irs.push_back({
226222
"York Guildhall Council Chamber",
227223
BinaryData::york_council_chamber_wav,
228224
BinaryData::york_council_chamber_wavSize,
229225
0.25f,
230226
false,
231-
startOffset,
227+
216,
232228
{}
233229
});
234230

@@ -238,7 +234,7 @@ void EngineGlobal::loadIRs()
238234
BinaryData::st_laurentius_molenbeek_wavSize,
239235
0.8f,
240236
false,
241-
startOffset,
237+
15,
242238
{}
243239
});
244240

@@ -248,7 +244,7 @@ void EngineGlobal::loadIRs()
248244
BinaryData::st_andrews_church_wavSize,
249245
1.0f,
250246
false,
251-
startOffset,
247+
1796,
252248
{}
253249
});
254250

@@ -258,7 +254,7 @@ void EngineGlobal::loadIRs()
258254
BinaryData::st_georges_far_wavSize,
259255
1.0f,
260256
false,
261-
startOffset,
257+
1776,
262258
{}
263259
});
264260

@@ -268,7 +264,7 @@ void EngineGlobal::loadIRs()
268264
BinaryData::lady_chapel_stalbans_wavSize,
269265
1.0f,
270266
false,
271-
startOffset,
267+
385,
272268
{}
273269
});
274270

@@ -278,7 +274,7 @@ void EngineGlobal::loadIRs()
278274
BinaryData::_1st_baptist_nashville_balcony_wavSize,
279275
1.0f,
280276
false,
281-
startOffset,
277+
1764,
282278
{}
283279
});
284280

@@ -288,7 +284,7 @@ void EngineGlobal::loadIRs()
288284
BinaryData::elveden_hall_suffolk_england_wavSize,
289285
0.1f,
290286
false,
291-
0,
287+
28,
292288
{}
293289
});
294290

@@ -298,7 +294,7 @@ void EngineGlobal::loadIRs()
298294
BinaryData::r1_nuclear_reactor_hall_wavSize,
299295
0.4f,
300296
false,
301-
startOffset,
297+
1995,
302298
{}
303299
});
304300

@@ -308,7 +304,7 @@ void EngineGlobal::loadIRs()
308304
BinaryData::york_uni_sportscentre_wavSize,
309305
0.4f,
310306
false,
311-
startOffset,
307+
1309,
312308
{}
313309
});
314310

@@ -318,7 +314,7 @@ void EngineGlobal::loadIRs()
318314
BinaryData::york_minster_wavSize,
319315
0.3f,
320316
false,
321-
startOffset,
317+
3098,
322318
{}
323319
});
324320

@@ -332,7 +328,8 @@ void EngineGlobal::loadIRs()
332328
std::unique_ptr<InputStream> stream = std::make_unique<MemoryInputStream>(ir.data, ir.size, false);
333329
std::unique_ptr<AudioFormatReader> reader{manager.createReaderFor(std::move(stream))};
334330
ir.waveform.setSize(reader->numChannels, (int)reader->lengthInSamples);
335-
reader->read(&ir.waveform, 0, ir.waveform.getNumSamples(), (juce::int64)ir.startOffset, true, true);
331+
const auto offset{ (juce::int64)ir.startOffset };
332+
reader->read(&ir.waveform, 0, ir.waveform.getNumSamples() - offset, offset, true, true);
336333

337334
ir.waveform.applyGain(ir.gain);
338335

0 commit comments

Comments
 (0)