|
Rockbox mail archiveSubject: Re: Anyone up for ALSA?Re: Anyone up for ALSA?
From: Dave Hooper <dave_at_beermex.com>
Date: Wed, 13 Jul 2005 23:27:07 +0100 One idea - rather than using snd_pcm_open would it be possible to just open /dev/dsp? (e.g. the same way the irivermidi code works when running on C - pasted below hopefully) Just a thought .. all of that snd_pcm_xxx looks more complex than I suspect it needs to be void initSound() { //OSS Stuff, set the sampling rate, etc: 48000, Mono, 16bit fd=open("/dev/dsp", O_WRONLY); // | O_NONBLOCK); int arg, status; int bit, samp, ch; arg = 16; // sample size status = ioctl(fd, SOUND_PCM_WRITE_BITS, &arg); status = ioctl(fd, SOUND_PCM_READ_BITS, &arg); bit=arg; arg = 1; //Number of channels, 1=mono status = ioctl(fd, SOUND_PCM_WRITE_CHANNELS, &arg); status = ioctl(fd, SOUND_PCM_READ_CHANNELS, &arg); ch=arg; arg = SAMPLE_RATE; //Yeah. sampling rate status = ioctl(fd, SOUND_PCM_WRITE_RATE, &arg); status = ioctl(fd, SOUND_PCM_READ_RATE, &arg); samp=arg; //Print out what we *actually* got.. not that the program //pays attention to these values anyway printf("\nDSP Says:\n%dHz %dCh %dbit", samp, ch, bit); } ----- Original Message ----- From: "Daniel Stenberg" <daniel_at_rockbox.org> To: "Rockbox" <rockbox_at_cool.haxx.se> Sent: Wednesday, July 13, 2005 10:56 PM Subject: Anyone up for ALSA? > Howdy > > I just wrote up a first stab at providing sound in the X11 (on Linux) > simulator. It doesn't work. :-/ > > Even though the code is still very basic and crappy, I fell over some > annoying ALSA initialization issues which aren't really my standard > neighbourhood issues so I thought I'd cry for help at once... > > The problem is this: > > I wrote a tiny little stand-alone app first that uses ALSA fine and that > plays PCM data (and I can hear the glitch in my speakers when it plays > some random stack data). But when I convert that very same code into a > function for Rockbox (there's a new PCM playback thread started that will > deal with all the ALSA/PCM playback stuff) the initial call to > snd_pcm_open() fails and it prints this informative blurb on stderr: > > ALSA lib conf.c:2715:(snd_config_hooks) id of field i is not and integer > ALSA lib conf.c:3052:(snd_config_update_r) hooks failed, removing > configuration > cannot open audio device default (Invalid argument) > > Here's this first patch: > > http://daniel.haxx.se/rockbox/alsa-1.patch > > 1. Beware, it is not even close to fit for commit yet > > 2. You need to edit your main Makefile and add "-lasound" along the libs > to > link with. > > Anyone? > > -- > Daniel Stenberg -- http://www.rockbox.org/ -- http://daniel.haxx.se/ > _______________________________________________ > http://cool.haxx.se/mailman/listinfo/rockbox > _______________________________________________ http://cool.haxx.se/mailman/listinfo/rockbox Received on 2005-07-14 Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy |