Subject: [linux-audio-dev] what the windows/macos world faces
From: Paul Davis (pbd_AT_Op.Net)
Date: Sat Sep 15 2001 - 04:10:03 EEST
its still unbelievable to me that anyone would be choosing
to work in an environment in which a pointer overrun in
an application can crash the entire program ...
------- Forwarded Message
From: elided ....
To: elided ....
Subject: Buffered plugin problems
Hi,
I am implementing a plugin that uses a lookahead algorithm (and hence =
buffers the input) and am experiencing crashing problems. I am buffering =
the input in a circular buffer and am applying processing to samples =
slightly before the current read sample from input. This all works fine =
until I kill off cubase - and then it crashes and my whole computer =
freezes up.=20
The type of code I am using is as follows:
long bufCounter, delayedCounter;=20
bufCounter initialised to 0, delayedCounter initialised to =
(bufCounter-delay)%bufSize
Inside my main processReplacing loop:
// pick up old values from last buffer iteration for output
oldL =3D bufferL[bufCounter];
oldR =3D bufferR[bufCounter];
// stick in latest values
bufferL[bufCounter] =3D (*in1++);
bufferR[bufCounter]=3D(*in2++);
// some analysis etc that results in a new gain modification to the =
signal, based on the latest read signals
bufferL[delayedCounter] =3D blah;
bufferR[delayedCounter] =3D blah;
bufCounter++;
if bufCounter =3D=3D bufSize bufCounter=3D0;
delayedCounter++;
if delayedCounter =3D=3D bufSize delayedCounter=3D0;
(*out1++) =3D oldL;
(*out2++) =3D oldR;
This gives me a circular system that allows varying delay times to react =
to the input signal, (delay's probably the wrong word as it is modifying =
the signal based on the input slightly later in the stream!!), and I've =
made sure that the delay time can never be as large as the buffer.
All this works perfectly while cubase is running, but as soon as I close =
cubase my computer crashes......... If I remove the reference to the =
bufferX[delayedCounter] lines everything runs smoothly, and I'm =
modulus'ing the counters so that they are always between 0 and bufSize-1 =
(buffers are created in the constructor of size bufSize). So the delay =
Counter references seem to become illegal at some point. I was wondering =
if it has anything to do with the fact that the input is delayed..... =
and there's some kill-off clause that I'm not covering.
Any help much appreciated!!
Cheers,
[ elided ]
------- End of Forwarded Message
This archive was generated by hypermail 2b28 : Sat Sep 15 2001 - 04:12:34 EEST