Re: [GD-General] Writing an audio mixer
Brought to you by:
vexxed72
From: Mads B. D. <ma...@ch...> - 2002-03-16 10:38:50
|
On Sat, 16 Mar 2002, Ignacio Casta=F1o wrote: > Hi, > I will be writting sound mixer next week, and I have to admit that I have= no > idea of sound programming. I could use sdl or any other library, but i ju= st > want to do that myself to learn how it's done. I've been looking for info > about sound programming witout much look, I've only found low level detai= ls > about the sound blaster :-( > So if somebody knows where to find a good tutorial about this, I would > really appreciate it. I do not know about tutorials, but I wrote my own mixer once in about 1000 lines of code. It used a seperate thread, because I thought that to be easier. The problem with my code was that I could only support mone 8 bit samples. This is easy to do. When you want to support stereo, or even more channels, and formats where the byte order is important (e.g. 16 bit samples), it begins to suck. Also, you need to support a number of different interfaces if you wish your code to work across platforms. > Anyway, I just can learn that by reading source code, for example, quake'= s > sound engine runs on every game update, while sdl's and minifmod's run in= a > different thread. Updating the audio in the game loop seems to be easier = to > me, at least i have to write less platform independant code, but it seems > that you have that work already done. On the other hand threaded audio se= ems > to be the right thing, since most libraries do that. Threaded is easier. For _ultimate_ performance, you want to schedule yourself, in this case from the game loop. But, seriously, who needs that? Carmack might, because he writes to highend metal, but the rest of us? You loose SMP benefits, etc. YMMV. Mads --=20 Mads Bondo Dydensborg. ma...@ch... I disapprove of what you say, but I will defend to the death your right to say it. - Beatrice Hall [pseudonym: S.G. Tallentyre], 1907 (many times wrongfully attributed to Voltaire) |