@@ -13,26 +13,30 @@ void CAudioReverb::Init ( const EAudChanConf eNAudioChannelConf, const int iNSte
1313{
1414 eAudioChannelConf = eNAudioChannelConf;
1515 iStereoBlockSizeSam = iNStereoBlockSizeSam;
16+
17+ // Jamulus uses interleaved stereo, mverb operates on a 2-dimensional array instead
18+ // Calculate the number of frames for each channel ( iStereoBlockSizeSam / 2 )
19+ numFrames = iStereoBlockSizeSam >> 1 ;
20+
21+ // These buffers get filled with dry signal and are then passed to mverb
22+ // They need to be vectors as the windows builds fail when arrays are used
23+ bufL.resize ( numFrames );
24+ bufR.resize ( numFrames );
25+
26+ mverb->setSampleRate ( static_cast <float > ( SYSTEM_SAMPLE_RATE_HZ ) );
27+ loadPreset ();
1628}
1729
1830void CAudioReverb::loadPreset ()
1931{
2032 for ( int i = 0 ; i < MVerb<float >::NUM_PARAMS ; i++ )
2133 {
22- mverb. setParameter ( i, presets[iPreset][i] );
34+ mverb-> setParameter ( i, presets[iPreset][i] );
2335 }
2436}
2537
2638void CAudioReverb::Process ( CVector<int16_t >& vecsStereoInOut, const bool bReverbOnLeftChan, const float fReverbGain )
2739{
28- // Jamulus uses interleaved stereo, mverb operates on a 2-dimensional array instead
29- // Calculate the number of frames for each channel ( iStereoBlockSizeSam / 2 )
30- const int numFrames = iStereoBlockSizeSam >> 1 ;
31-
32- // These buffers get filled with dry signal and are then passed to mverb
33- // They need to be vectors as the windows builds fail when arrays are used
34- std::vector<float > bufL ( numFrames );
35- std::vector<float > bufR ( numFrames );
3640
3741 // One buffer to pass to mverb's process function
3842 float * fInput [2 ] = { bufL.data (), bufR.data () };
@@ -55,7 +59,7 @@ void CAudioReverb::Process ( CVector<int16_t>& vecsStereoInOut, const bool bReve
5559 }
5660 }
5761
58- mverb. process ( fInput , fInput , numFrames );
62+ mverb-> process ( fInput , fInput , numFrames );
5963
6064 for ( int i = 0 , j = 0 ; j < numFrames; i += 2 , j++ )
6165 {
0 commit comments