Fix minor bug in windows audio driver (#680)

This commit is contained in:
jjceresa 2020-10-04 12:39:54 +02:00 committed by GitHub
parent b55884b273
commit b5da68393c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 8 deletions

View file

@ -27,12 +27,9 @@
#if DSOUND_SUPPORT
#define INITGUID
#include <mmsystem.h>
#include <dsound.h>
#define NOBITMAP
#include <mmreg.h>
static DWORD WINAPI fluid_dsound_audio_run(LPVOID lpParameter);
@ -238,7 +235,7 @@ new_fluid_dsound_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
/* number of channels in a frame */
format.Format.nChannels = synth->audio_channels * 2;
if(synth->audio_groups > DSOUND_MAX_STEREO_CHANNELS)
if(synth->audio_channels > DSOUND_MAX_STEREO_CHANNELS)
{
FLUID_LOG(FLUID_ERR, "Channels number %d exceed internal limit %d",
format.Format.nChannels, DSOUND_MAX_STEREO_CHANNELS * 2);
@ -260,7 +257,7 @@ new_fluid_dsound_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
/* CreateSoundBuffer accepts only format.dwChannelMask compatible with
format.Format.nChannels
*/
format.dwChannelMask = channel_mask_speakers[synth->audio_groups - 1];
format.dwChannelMask = channel_mask_speakers[synth->audio_channels - 1];
}
/* Finish to initialize dev structure */

View file

@ -27,7 +27,6 @@
#include <mmsystem.h>
#define NOBITMAP
#include <mmreg.h>
/* Number of buffers in the chain */
@ -304,7 +303,7 @@ new_fluid_waveout_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
/* Initialize the format structure */
wfx.Format.nChannels = synth->audio_channels * 2;
if(synth->audio_groups > WAVEOUT_MAX_STEREO_CHANNELS)
if(synth->audio_channels > WAVEOUT_MAX_STEREO_CHANNELS)
{
FLUID_LOG(FLUID_ERR, "Channels number %d exceed internal limit %d",
wfx.Format.nChannels, WAVEOUT_MAX_STEREO_CHANNELS * 2);
@ -319,7 +318,7 @@ new_fluid_waveout_audio_driver(fluid_settings_t *settings, fluid_synth_t *synth)
wfx.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
wfx.Format.cbSize = 22;
wfx.Samples.wValidBitsPerSample = wfx.Format.wBitsPerSample;
wfx.dwChannelMask = channel_mask_speakers[synth->audio_groups - 1];
wfx.dwChannelMask = channel_mask_speakers[synth->audio_channels - 1];
/* Calculate the length of a single buffer */
lenBuffer = (MS_BUFFER_LENGTH * wfx.Format.nAvgBytesPerSec + 999) / 1000;