Author Topic: Split stereo Microphone channels.  (Read 166 times)

johnvantelli

  • Posts: 63
Split stereo Microphone channels.
« on: 15 Mar '18 - 10:23 »
I'm using a mixer to merge a song channel and a stereo microphone input with wasapi.
All works fine and now I would like to add a second input channel.
Before add a new soundcard I'd like to know if there's a way to use a stereo microphone as two independent mono channels.

This is the mixer:

Code: [Select]
fMixer := BASS_Mixer_StreamCreate(WasapiInfo.freq, WasapiInfo.chans,
     0 or BASS_SAMPLE_FLOAT or BASS_STREAM_DECODE);

the mic stream is created with 2 channels:
Code: [Select]
  fMicStream := BASS_StreamCreate(WasapiInfo.freq, WasapiInfo.chans,
    BASS_STREAM_DECODE or BASS_SAMPLE_FLOAT, STREAMPROC_PUSH, nil);

and this is my wasapi input proc:

Code: [Select]
function WasapiProcINPUT(buffer: Pointer; length: Dword; user: Pointer)
  : Dword; stdcall;
begin
  BASS_StreamPutData(fMicStream, buffer, length);
  Result := 1;
end;




Ian @ un4seen

  • Administrator
  • Posts: 20772
Re: Split stereo Microphone channels.
« Reply #1 on: 15 Mar '18 - 16:43 »
You can use splitter streams to separate the channels, eg. call BASS_Split_StreamCreate on the "fMicStream" handle and plug the splitter (not fMicStream) into the mixer. For example, like this:

Code: [Select]
int chanmap[2] = {0, -1}; // want the 1st/left channel only
splitter = BASS_Split_StreamCreate(fMicStream, BASS_STREAM_DECODE, chanmap); // create the splitter
BASS_Mixer_StreamAddChannel(fMixer, splitter, 0); // plug it into the mixer

Please see the documentation for details on the mentioned functions.