Hi Martin, You make like to try the alsa developers mailing list, "If you would like to work on the driver, library or an ALSA application." https://www.alsa-project.org/wiki/Mailing-lists On Sun, Dec 03, 2023 at 02:21:04PM -0600, Martin McCormick wrote: > I have written some sound recording programs in c, gcc to be > exact, and I want to modernize them to take advantage of the > better capabilities provided by alsa than one gets using the > older oss or Open Sound System API of days gone bye. > > If one searches on the web for examples, there are > several bits of sample code that use alsa functions rather than > /dev/dsp-based activity which the oss apps used. > > Every one I have tried fails in exactly the same way to > compile. > > For those who don't write your own programs, this > messagecan be skipped but I am hoping somebody can suggest what I > might be doing wrong since all samples reference snd_pcm > functions such as snd_pcm_open, etc. All need a specific alsa > library called with > #include <alsa/asoundlib.h> > > That library is on the Raspberry pI and the desktop > systems I have tried these sample code blocks on. > > Both the Raspberry pI and the HP work station that uses > the AMD64 processor appear to be working normally but when I try > to compile anybody's test code, I always get errors like the > following: > > /usr/bin/ld: /tmp/ccTjr3cU.o: in function `main': > tester.c:(.text+0x3c): undefined reference to `snd_pcm_stream_name' > /usr/bin/ld: tester.c:(.text+0x79): undefined reference to `snd_pcm_access_name' > > This means that gcc can't find any of those missing > functions. There were several more lines, all referring to > snd_pcm_ calls but you get the idea. Any snd_pcm_call produces a > squawk like the 2 I just showed. > > The author of the sample says: > > line. Some ALSA library functions use the dlopen function and > floating-point operations, so you also may need to add -ldl and -lm. > > I ended up with the command > > gcc -lasound -ldl -lm tester.c > Which changed nothing and produced exactly the same > complaints. > > So, has anybody running debian bullseye on a Raspberry pI > or the same on a 64-bit desktop gotten alsa code to compile? > > I have looked for -dev versions of alsa libraries which > are the ones you want if you are programming and there are a > bunch but none of them touches those errors or I wouldn't be > posting this question to this and one other group. > > The alsa libraries allow one to more easily setup a sound > card to provide digital audio in several formats with several > sample rates that some sound cards won't give you in Linux either > because of hardware limitations or the fact that the Linux driver > is not fully compatible with the sound card. > > The older sound programs I wrote let a PC or Raspberry pI store > audio from a police scanner or short wave radio on to a file and > only record when there is sound. They are always recording but > the recording app sees silence on the line so just throws those > samples away. A very small buffer keeps the last fraction of a > second of silence before the sound started in order not to clip > it off. > > I'll keep much of the old program but use the alsa > routines to feed the audio in instead of /dev/dspx where x is the > sound card in question. > > Thanks > > Martin McCormick > > -- > You received this message because you are subscribed to the Google Groups "blinux-list@xxxxxxxxxx" group. > To unsubscribe from this group and stop receiving emails from it, send an email to blinux-list+unsubscribe@xxxxxxxxxx. > -- Joel Roth -- You received this message because you are subscribed to the Google Groups "blinux-list@xxxxxxxxxx" group. To unsubscribe from this group and stop receiving emails from it, send an email to blinux-list+unsubscribe@xxxxxxxxxx.