Realtime sound mixing
-
Does anyone know how, or have a link to a place that has info on how to do realtime mixing of wav files? I've gotten the mixing down, and it works fine, just have channels and "mix" them by adding bytes of the wav. My problem is that I'm doing this for a game, and because the output buffer is 1024 bytes, sometimes you can notice a delay between when the event (an explosion in this case) occurs and when the sound plays. But making the buffer short enough so that the delay isn't noticable is so short that my computer (pIII-450) can't keep up. Is there a way to access the data you've already passed to waveOutWrite? Or is there some other way I might be able to get rid of this stupid delay. (I know directsound can probably handle it, but I'm interested in a non-directx solution, if one exists.) -wP
-
Does anyone know how, or have a link to a place that has info on how to do realtime mixing of wav files? I've gotten the mixing down, and it works fine, just have channels and "mix" them by adding bytes of the wav. My problem is that I'm doing this for a game, and because the output buffer is 1024 bytes, sometimes you can notice a delay between when the event (an explosion in this case) occurs and when the sound plays. But making the buffer short enough so that the delay isn't noticable is so short that my computer (pIII-450) can't keep up. Is there a way to access the data you've already passed to waveOutWrite? Or is there some other way I might be able to get rid of this stupid delay. (I know directsound can probably handle it, but I'm interested in a non-directx solution, if one exists.) -wP
Hi, have you tried using more but shorter buffers ? Ok this will cause a higher use of the write functions - but shorter buffers have of course shorter delay in change. But wait - You are using 1024 Sample Buffers ? I guess for a game you are using 44,1k/16bit/mono ? That means the total play-time of the buffer is about 23ms. Therefor a change needs at least this time to appear. On the other side this time can only appear as a short chorusing effect because the time is to short for human hearing to notify 2 seperate sounds. I think you should not notify a delay. Maybe you have a great preformance loss in your wave-mixer ? You should check it out. To raise up speed you should not use the wave-event (don`t know if you did). Better use the WaveOutProc-CALLBACK. Then you should put the output routine in a seperate thread. Hope it helps Mario /// ---------------------- www.klangwerker.de mario@klangwerker.de ----------------------
-
Does anyone know how, or have a link to a place that has info on how to do realtime mixing of wav files? I've gotten the mixing down, and it works fine, just have channels and "mix" them by adding bytes of the wav. My problem is that I'm doing this for a game, and because the output buffer is 1024 bytes, sometimes you can notice a delay between when the event (an explosion in this case) occurs and when the sound plays. But making the buffer short enough so that the delay isn't noticable is so short that my computer (pIII-450) can't keep up. Is there a way to access the data you've already passed to waveOutWrite? Or is there some other way I might be able to get rid of this stupid delay. (I know directsound can probably handle it, but I'm interested in a non-directx solution, if one exists.) -wP
Hi, I would recommend having a quick look at the FMOD sound library. It's been around for a while, so is quite mature and stable. Have a look at www.fmod.org for further details. Hope this helps, Regards, Craig.
-
Does anyone know how, or have a link to a place that has info on how to do realtime mixing of wav files? I've gotten the mixing down, and it works fine, just have channels and "mix" them by adding bytes of the wav. My problem is that I'm doing this for a game, and because the output buffer is 1024 bytes, sometimes you can notice a delay between when the event (an explosion in this case) occurs and when the sound plays. But making the buffer short enough so that the delay isn't noticable is so short that my computer (pIII-450) can't keep up. Is there a way to access the data you've already passed to waveOutWrite? Or is there some other way I might be able to get rid of this stupid delay. (I know directsound can probably handle it, but I'm interested in a non-directx solution, if one exists.) -wP
am just curious ... is there a reason for not using directx? after all they have spent the past 6 years getting it kinda right i understand :suss: --- "every year we invent better idiot proof systems and every year they invent better idiots"