[LAD] Adding a c timer to Kluppe

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linux Audio Developers <linux-audio-dev@...>
Date: Tuesday, April 20, 2010 - 4:51 pm

Hi,

I'm trying to add a threaded timer to kluppes looperdata.c
looperdata_calc_sample_stereo function so that I can add a delayed
restart to the loop process.

Can anyone tell me why the "while" statement in the following code locks
up the audio stream for the loop it is being run on? I end up with a
buzz throughout the delay period instead of a nice quiet delay period.

#include
#include
#include

/* This flag controls termination of the main loop. */
volatile sig_atomic_t isdelay_countdown = 1;

/* The signal handler just clears the flag and re-enables itself. */
void catch_alarm (int sig){
isdelay_countdown = 0;
signal (sig, catch_alarm);
}

vol = data->vol;

if(data->playbackdelay > 0){

/* Establish a handler for SIGALRM signals. */
signal (SIGALRM, catch_alarm);

isdelay_countdown = 1;

/* Call alarm to countdown length of
playbackdelay */
alarm ((int)data->playbackdelay);

/* Check the flag once in a while to see when to
quit. */
while(isdelay_countdown){
looperdata_set_vol(data,0);
data->isplaying = 0;
}

}

/* return to start of loop */

looperdata_set_vol(data,vol);
data->isplaying = 1;
data->playindex += data->loopstart - data->loopend;

--
Patrick Shirkey
Boost Hardware Ltd

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lists.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[LAD] Adding a c timer to Kluppe, Patrick Shirkey, (Tue Apr 20, 4:51 pm)
Re: [LAD] Adding a c timer to Kluppe, Niels Mayer, (Tue Apr 20, 5:44 pm)
Re: [LAD] Adding a c timer to Kluppe, Patrick Shirkey, (Wed Apr 21, 1:09 am)
Re: [LAD] Adding a c timer to Kluppe, Louigi Verona, (Wed Apr 21, 5:07 am)
Re: [LAD] Adding a c timer to Kluppe, Patrick Shirkey, (Wed Apr 21, 5:34 am)
Re: [LAD] Adding a c timer to Kluppe, Louigi Verona, (Wed Apr 21, 5:44 am)
Re: [LAD] Adding a c timer to Kluppe, Patrick Shirkey, (Wed Apr 21, 6:12 am)
Re: [LAD] Adding a c timer to Kluppe, Louigi Verona, (Wed Apr 21, 7:50 am)
Re: [LAD] Adding a c timer to Kluppe, Patrick Shirkey, (Wed Apr 21, 10:31 am)