When debugging audio problems with HelenOS HD Audio driver in VirtualBox, I noticed that HD Audio driver does not actually report the rates/formats supported by the audio device, nor does it set them. So I tried to implement it. Soon I ran into problems (Hound crashing), but mainly the audio device interface is not up to the task. It just expects the audio device to be something like a Sound Blaster, basically being able to set any rate from a (min, max) interval. (In reality, SB can only set the rate approximately.
Also note that I found that we round the rates to multiples of 100 Hz when communicating to Hound. Oh my. In the end I found out that Hound never sets any other format than the default 44100Hz / stereo / 16-bit, because it starts playing even before any stream is started, so it has no way of knowing what format to set.
So I'm not sure if it even makes sense to improve the driver within the scope of the current audio framework, which is severely limited. Even while developing the HD Audio driver I realized that it's a poor match for HelenOS audio architecture. Here's a compiled list of problems encountered so far:
- Each sound card / audio device can only have up to one input and one output (HD Audio can have mutiple).
- Both input and output must support the same rates/formats (can be different in HD Audio).
- Audio device is expected to support basically any rate in some (min, max) interval (but HD Audio only supports a short list of specific rates).
- Rate is passed from client to server in multiples of 100 Hz.
- Audio playback starts as soon as client connects, even if no streams are playing. This means we don't know what the format will be, so we pick default format (and we cannot convert rates).
- Everything thus plays at 44100Hz / 16 bits / stereo.
No comments:
Post a Comment