Re: Once again multi channel sound...
- From: "Alessandro Angeli" <nobody@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 16 Mar 2008 01:31:15 -0400
From: "Gottfried Lesigang"
My problem is that I'm not very experienced with sound
programming. this feature is a key-feature for my
application, but it's just about 2% of my code ;-)
At the moment I'm dveloping with C# in VS. For the sound
I'm using DirectShow.Net. My free time is very limited...
Learning advanced sound programming is quite a challenge!
Splitting or mixing uncompressed PCM audio channels is not
very advanced. Each channel is a sequence of fixed size
samples (e.g. the sample of 16-bit PCM are short ints). The
samples of each channel are interleaved in the buffer in a
fixed pattern (e.g. if you have 4 channels, the pattern in
the buffer is 123412341234, where the numbers represent
channels 1 to 4).
So, if you for example want to mix 2 x 16-bit stereo buffers
into 1 x 16-bit 4-channel buffer, you just read 2 shorts
from buffer #1 and write them to the target buffer, than 2
short from buffer #2, them buffer #1 again and so on...
The only care you need to take is about filling the
WAVEFORMATEX structure: if you have more than 2 channels,
you need to use WAVEFORMATEXTENSIBLE (which is a special
form of WAVEFORMATEX) instead of a plain WAVEFORMATEX. Some
audio components may accept a plain WAVEFORMATEX with
nChannels > 2, but it is not standard.
--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm
.
- Follow-Ups:
- Re: Once again multi channel sound...
- From: Gottfried Lesigang
- Re: Once again multi channel sound...
- References:
- Once again multi channel sound...
- From: Gottfried Lesigang
- Re: Once again multi channel sound...
- From: Sam Brown
- Re: Once again multi channel sound...
- From: Gottfried Lesigang
- Once again multi channel sound...
- Prev by Date: Re: streaming audio basics
- Next by Date: Re: streaming audio basics
- Previous by thread: Re: Once again multi channel sound...
- Next by thread: Re: Once again multi channel sound...
- Index(es):
Relevant Pages
|