Greg Berchin wrote: > > Hi, folks; > > I've been subscribed for a few weeks, sitting on the sidelines hoping that > I would come up to speed with time, but I find that it's not happening. I > just recently set up my first Linux system, (finally) installed the ALSA > drivers, and seem to have everything up and running. (Some UNIX experience > from long, long ago helped a lot.) But all of this is preliminary, and the > knowledge that I've acquired still hasn't prepared me for what I am > ultimately trying to do: incorporate my own realtime audio applications > into the PC. > > Writing the applications is the easy part for me; I have a Master's degree > in electrical engineering and have been writing DSP-based audio > applications in assembly and C for nearly a decade. So I know what I'm > doing, algorithmically speaking. But the part I'm having trouble with is > the specifics of how to retrieve the raw audio samples from the sound card > and how to send the processed audio samples to the sound card. I am not > familiar enough with how a Linux PC operates to even know where to look. I > see references to "threaded applications" and "callback routines"; I have > to admit that I don't know what they mean. So let me explain what threaded applications and callbacks are. It's offtopic, because general to computing, so i've marked the mail as such. Threads are a special kind of process. I think you know what a process is. It's a unit of execution, with its own program counter, own stack, own machine state (processor registers), etc. When multiple processes are to be executed on one processor, (and it's always the case on a PC) the operating system has to periodically switch between them - say every 20 ms - to make them appear executing simultanously. The difference between a thread and a process is that two threads can have the same address space, and two processes don't. If a thread writes to a variable, then a related thread can read it. Processes are protected against modifying each other address space. Another difference is that it takes less time for the operating system to switch between threads than between processes. A callback function is an ordinary C function, that you pass to another library. Actually you pass a pointer to the function. So the library can call your function when an event occurs. Tis means the library calls you back. It's like an interrupt routine. But it's not hardware that calls your code. And callbacks are less asynchronous. They are called when you call into that library. Some libraries may call your function in a separate thread, but that's documented. hope i could help you get going, :-) herbert
