David
but it's limited and unstable
Kirn
I thought the problem was that you didn't have working audio drivers
David
problem is the kernel side of things
David
the audio stack is complex and very picky
Kirn
which would be easily solved by porting UniAud from OS/2 (it's a port of Linux ALSA and it's drivers to OS/2)
Kirn
hmm
David
the effort needed to convert UniAud into an NT Driver would probably outweight the effort of fixing the existing audio stack
David
if you know both how audio systems work, and how kernels work
Kirn
I don't really think so... OS/2's audio API is quite similar to the Windows API model
Kirn
I understand, to a certain degree, how kernels work
Kirn
audio systems, not so much, except from the userland side
David
well my knowledge is rudimentary so I can't really give you a proper description
Kirn
About 10 years ago, I worked with a friend to write a rather crappy multitasking kernel for PCs
David
but think of it as: an audio device has a series of "pins", which can be inputs or outputs
David
and they support a number of configurations (sample formats, sample rates, etc)
Kirn
heh
David
and then have some buffers around
Kirn
sounds like the crap I put up with when writing a crappy ALSA output "driver" for PsyMP3 years ago... which I scrapped for having SDL just handle everything
David
then an audio stream is composed of a bunch of buffers, a pin, and a configuration
David
the audio stack has to manage who owns which pins, has to maintain the buffers full, etc
Kirn
SDL's audio model involves a buffer and a configuration
David
while also tracking the hardware state, timings and such
Kirn
the pin bit is handled by the library
Kirn
also, it's callback-based, so the timing is also handled by the library... was a hell of a lot simpler than trying to use ALSA directly
David
then on top of that, add the mixer component, which has to keep track of virtual "pins", and which configuration they are currently using, so that it can do the necessary conversions, before adding the data together into one output
Kirn
i've also played with OSS on Linux and FreeBSD, and Sun AudioIO on NetBSD and Solaris
David
yep, in windows
David
there's more than one api
Kirn
I know
Kirn
I played with Windows waveOut stuff a little
Kirn
like 8 years ago
David
ah high level, there's waveOut, which uses synchronization objects (sortof a semaphore) to signal when a buffer is empty and ready to be filled in
Kirn
thought it was brain-damaged
David
at low-level, I think both KS and WASAPI work with callbacks instead
Kirn
hmm
David
DSound is mostly a library that interfaces with kernel streams
David
(it has a kernel-side server)
David
and XAudio2 is purely high-level:
Kirn
what little I saw of kernel streams looked more like ALSA/OSS
David
in NT5 it wraps DSound, and in NT6 is uses WASAPI
Kirn
i.e. less brain-damaged than waveOut
David
yep
David
but at thesame time
David
you get brain damage when trying to configure the stream
David
since all the low-level configuration details have to be negotiated by hand
Kirn
This is true
David
which is why WASAPI is so awesome and reactosshould implement it even if it's not NT6 ;P
Kirn
This is why, for PsyMP3, I simply decided to use SDL's audio API
Kirn
even on Linux, you have to negotiate by hand
Kirn
especially if you're running on an old Pentium 2 box with an ancient Sound Blaster that can only do 22.050kHz sampling with 8-bit samples
Kirn
SDL lets you just declare what you're producing and it'll resample as necessary
Kirn
(if you're wondering what's with the ancient P2 box, well, I had a bunch of old machines around when I was writing PsyMP3 and was using as many of them as possible for testing because I was, and still am, a shit programmer)
David
yepseems like ALSA is on a similar level of complexity
David
https://github.com/PCSX2/pcsx2/blob/master/3rdparty/portaudio/src/hostapi/alsa/pa_linux_alsa.c — 4000loc
David
https://github.com/PCSX2/pcsx2/blob/master/3rdparty/portaudio/src/hostapi/wasapi/pa_win_wasapi.c — 4300loc
David
https://github.com/PCSX2/pcsx2/blob/master/3rdparty/portaudio/src/hostapi/wdmks/pa_win_wdmks.c — 5800loc
Kirn
My friend Mattis helped me quite a bit
David
KS is definitely WAY more complex ;P
Kirn
also
Kirn
LOC count is meaningless
David
this is lines excluding comments, required to perform the same functions
Kirn
so?
David
it's not quite pointless
Kirn
for determing actual code complexity, it is.
David
if you need over 1500 lines more in order to maintain and configure a stream
David
sure but I can't measure it in "wtf/minute" ;P
David
although, even if the complexity wasn't higher, you can't deny it's messier ;P
David
no, I don't think this originated in xkcd, even if it seems to be attributed to him
David
https://blog.codinghorror.com/content/images/uploads/2009/02/6a0120a85dcdae970b012877707a45970c-pi.png
Kirn
http://i.imgur.com/J1svNp7.jpg
Kirn
oh, yeah, that
Kirn
:D
David
http://www.osnews.com/story/19266/WTFs_m
David
this seems to be the source
Kirn
you should see the Bézier curve code I wrote when I was completely fucked up on a lot of drugs
Kirn
It does work, and works perfectly
Kirn
but I have no idea how it works
David
I wrote a quadratic interpolation curve before i knew it had a name ;P
David
in my VB6 days