mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2025-01-31 13:40:35 +00:00
Fix minor bug in windows audio driver (#680)
This commit is contained in:
parent
b55884b273
commit
b5da68393c
2 changed files with 4 additions and 8 deletions
|
@ -27,12 +27,9 @@
|
||||||
|
|
||||||
#if DSOUND_SUPPORT
|
#if DSOUND_SUPPORT
|
||||||
|
|
||||||
#define INITGUID
|
|
||||||
|
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
#include <dsound.h>
|
#include <dsound.h>
|
||||||
|
|
||||||
#define NOBITMAP
|
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
|
||||||
static DWORD WINAPI fluid_dsound_audio_run(LPVOID lpParameter);
|
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 */
|
/* number of channels in a frame */
|
||||||
format.Format.nChannels = synth->audio_channels * 2;
|
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",
|
FLUID_LOG(FLUID_ERR, "Channels number %d exceed internal limit %d",
|
||||||
format.Format.nChannels, DSOUND_MAX_STEREO_CHANNELS * 2);
|
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
|
/* CreateSoundBuffer accepts only format.dwChannelMask compatible with
|
||||||
format.Format.nChannels
|
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 */
|
/* Finish to initialize dev structure */
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
|
||||||
#define NOBITMAP
|
|
||||||
#include <mmreg.h>
|
#include <mmreg.h>
|
||||||
|
|
||||||
/* Number of buffers in the chain */
|
/* 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 */
|
/* Initialize the format structure */
|
||||||
wfx.Format.nChannels = synth->audio_channels * 2;
|
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",
|
FLUID_LOG(FLUID_ERR, "Channels number %d exceed internal limit %d",
|
||||||
wfx.Format.nChannels, WAVEOUT_MAX_STEREO_CHANNELS * 2);
|
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.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
|
||||||
wfx.Format.cbSize = 22;
|
wfx.Format.cbSize = 22;
|
||||||
wfx.Samples.wValidBitsPerSample = wfx.Format.wBitsPerSample;
|
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 */
|
/* Calculate the length of a single buffer */
|
||||||
lenBuffer = (MS_BUFFER_LENGTH * wfx.Format.nAvgBytesPerSec + 999) / 1000;
|
lenBuffer = (MS_BUFFER_LENGTH * wfx.Format.nAvgBytesPerSec + 999) / 1000;
|
||||||
|
|
Loading…
Reference in a new issue