Thanks, Jamey,
but alas - still not working:
I changed sample format to AFMT_S16_LE, and experimented with
setting channels to 1 and 2, and have set the speed to 8000 or 16000.
I usually get all zeros when I print out the buf[] array, sometimes
with the last two bytes nonzero, and every now and then a full non-zero
block. I assume this has to do with the way I read the dsp file, or the
mixer settings?
Kristof.
>>int sample = AFMT_U8;
>>int channels = 2;
>>int speed = 16000;
>>int ret;
>>unsigned char buf[1024];
>>int dsp = open("/dev/dsp", O_RDONLY);
>>if (dsp!=-1) {
>> ioctl(dsp, SNDCTL_DSP_SPEED, &speed);
>> ioctl(dsp, SNDCTL_DSP_CHANNELS, &channels);
>> ioctl(dsp, SNDCTL_DSP_SETFMT, &sample);
>> ret = read(dsp, buf, sizeof(buf));
>> for (int i=0; i<ret; i++)
>> fifo.add(buf[i]);
>> close(dsp);
>>}
>>printf("the noise volume is: %f", fifo.get_volume());
>>
>>
>>
>Only 16-bit audio format is supported by the hardware.
>
>
>Jamey
Received on Fri Jan 24 15:11:55 2003
This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:41:30 EDT