PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.43k stars 295 forks source link

DirectSound : can't use combined channelMask with paWinDirectSoundUseChannelMask flag. Just noise #949

Open Edynamic1977 opened 1 month ago

Edynamic1977 commented 1 month ago

Hello,

I've an issue with portaudio 19.6 stable.

you can find PaStreamParameters initialization below :

Targeted Soundcards : TASCAM 208i and TASCAM HR 4x4 US

PaWinDirectSoundStreamInfo oDSStreamInfoOutput; oDSStreamInfoOutput.size = sizeof(PaWinDirectSoundStreamInfo); oDSStreamInfoOutput.hostApiType = paDirectSound; oDSStreamInfoOutput.version = 2; oDSStreamInfoOutput.flags = paWinDirectSoundUseChannelMask; oDSStreamInfoOutput.framesPerBuffer = 4096;

oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x10 | 0x20; //for TASCAM HR 4x4 US oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x200 | 0x400; //for TASCAM 208i

PaStreamParameters* oOutputParameters = new PaStreamParameters(); oOutputParameters->device = CARD_ID

oOutputParameters->channelCount = 4;//for TASCAM HR 4x4 US oOutputParameters->channelCount = 8;//for TASCAM 208i

oOutputParameters->sampleFormat = paInt16; oOutputParameters->suggestedLatency = 0.120F; oOutputParameters->hostApiSpecificStreamInfo = &oDSStreamInfoOutput;

I can just use one channel with channelCount = 1

All is OK with this code with internal realtek soundcard

PaWinDirectSoundStreamInfo oDSStreamInfoOutput; oDSStreamInfoOutput.size = sizeof(PaWinDirectSoundStreamInfo); oDSStreamInfoOutput.hostApiType = paDirectSound; oDSStreamInfoOutput.version = 2; oDSStreamInfoOutput.flags = paWinDirectSoundUseChannelMask; oDSStreamInfoOutput.framesPerBuffer = 4096; oDSStreamInfoOutput.channelMask = 0x1 | 0x2;

PaStreamParameters* oOutputParameters = new PaStreamParameters(); oOutputParameters->device = CARD_ID oOutputParameters->channelCount = 1; oOutputParameters->sampleFormat = paInt16; oOutputParameters->suggestedLatency = 0.120F; oOutputParameters->hostApiSpecificStreamInfo = &oDSStreamInfoOutput;

RossBencina commented 1 month ago

Your masks seem strange to me. What about these masks:

- oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x10 | 0x20; //for TASCAM HR 4x4 US
+ oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x4 | 0x8; //for TASCAM HR 4x4 US

- oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x200 | 0x400; //for TASCAM 208i
+ oDSStreamInfoOutput.channelMask = 0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80; //for TASCAM 208i