Subject: NetBSD/amiga audio questions: sampling rates, screenmodes, and the low-pass filter/LED state
To: None <port-amiga@netbsd.org>
From: Chris Edwards <cme@ihug.co.nz>
List: port-amiga
Date: 10/03/2001 19:51:36
Hi again,
I have a couple of sound-related NetBSD/amiga questions. I've been =
thinking of setting up my A1200 as an MP3 player, streaming the files =
over the network. Now, I remember the need under AmigaDOS to use the =
scan-doubled AGA screen modes in order to be able to play audio at high =
(e.g. 44.1 kHz) sampling rates, and this was true for Linux on the 1200 =
as well. However, NetBSD's aucc sound driver seems to limit the =
playback period to 124 ticks, so even in VGA or dblpal you only get ~29 =
kHz at most:
/* transform frequency to period, adjust bounds */
static u_int
freqtoper(u_int freq) {
u_int per=3Declockfreq*5/freq;
if (per<124)
per=3D124; /* must have at least 124 ticks between samples */
Wouldn't this only be necessary when the system is using a plain old =
PAL/NTSC screenmode? I was curious what would happen if you set the =
limit to, say, 80 ticks, which I figure should allow 44.1 kHz playback =
on a PAL machine, so I tried it out, and, well, it seems to work just =
fine (although a 50 MHz '060 is only just fast enough to run mpg123 at =
this rate). Of course, you have to set the display to a high hsync =
screenmode, either with iteconfig or at boot time (loadbsd -A), =
otherwise everything slows down again. So, is there anything =
potentially "bad" about loosening the restriction on the period in this =
way (or even removing it altogether)?
My second question is about the low-pass audio filter (and the =
corresponding power LED brightness) on many Amiga models. It seems that =
NetBSD just leaves the filter in whatever state it's in when it's =
booted, which is on (LED bright) on my 1200. It would be nice for there =
to be a kernel option to set the initial filter state to "off", since =
playing audio in 14-bit at 44.1 kHz with the filter on is a bit =
pointless! Sure, you could boot into AmigaDOS and run an LED toggler =
program before booting into NetBSD, but I figure setting it in the =
kernel would have some advantages. Anyway, I worked out I probably =
needed to use the following code:
ciaa.pra |=3D CIAA_PRA_LED; /* Turn off the low-pass audio filter. */
which I inserted at an appropriate-looking place in =
/sys/arch/amiga/amiga/amiga_init.c (line 980, just after the keyboard =
interrupts get enabled??), and that seemed to do the trick. Is this an =
appropriate way to do this? Would it be easy to add a new kernel option =
for it?
I was thinking perhaps even nicer would be a new option to loadbsd or a =
userland program to toggle the filter state at will, but that would be =
where I'd start getting lost! Any thoughts?
--
Chris Edwards
cme at ihug dot co dot nz