[WINDOWS] Fix declaration of GUIDs (try 2). (#868)

Supersedes and closes #867.
This commit is contained in:
Carlo Bramini 2021-04-29 21:03:19 +02:00 committed by GitHub
parent 7b3c2b87f7
commit 10510e486b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 13 deletions

View file

@ -276,7 +276,7 @@ if ( WIN32 )
endif ( enable-network ) endif ( enable-network )
if ( enable-dsound AND HAVE_DSOUND_H ) if ( enable-dsound AND HAVE_DSOUND_H )
set ( WINDOWS_LIBS "${WINDOWS_LIBS};dsound" ) set ( WINDOWS_LIBS "${WINDOWS_LIBS};dsound;ksuser" )
set ( DSOUND_SUPPORT 1 ) set ( DSOUND_SUPPORT 1 )
endif () endif ()
@ -286,7 +286,7 @@ if ( WIN32 )
endif () endif ()
if ( enable-waveout AND HAVE_MMSYSTEM_H ) if ( enable-waveout AND HAVE_MMSYSTEM_H )
set ( WINDOWS_LIBS "${WINDOWS_LIBS};winmm" ) set ( WINDOWS_LIBS "${WINDOWS_LIBS};winmm;ksuser" )
set ( WAVEOUT_SUPPORT 1 ) set ( WAVEOUT_SUPPORT 1 )
endif () endif ()

View file

@ -227,22 +227,20 @@ new_fluid_dsound_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t fu
{ {
if(fluid_settings_str_equal(settings, "audio.sample-format", "float")) if(fluid_settings_str_equal(settings, "audio.sample-format", "float"))
{ {
GUID guid_float = {DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_IEEE_FLOAT)};
FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format"); FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format");
dev->write = fluid_synth_write_float_channels; dev->write = fluid_synth_write_float_channels;
/* sample container size in bits: 32 bits */ /* sample container size in bits: 32 bits */
format.Format.wBitsPerSample = 8 * sizeof(float); format.Format.wBitsPerSample = 8 * sizeof(float);
format.SubFormat = guid_float; format.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
format.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; format.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
} }
else if(fluid_settings_str_equal(settings, "audio.sample-format", "16bits")) else if(fluid_settings_str_equal(settings, "audio.sample-format", "16bits"))
{ {
GUID guid_pcm = {DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_PCM)};
FLUID_LOG(FLUID_DBG, "Selected 16 bit sample format"); FLUID_LOG(FLUID_DBG, "Selected 16 bit sample format");
dev->write = fluid_synth_write_s16_channels; dev->write = fluid_synth_write_s16_channels;
/* sample container size in bits: 16bits */ /* sample container size in bits: 16bits */
format.Format.wBitsPerSample = 8 * sizeof(short); format.Format.wBitsPerSample = 8 * sizeof(short);
format.SubFormat = guid_pcm; format.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
format.Format.wFormatTag = WAVE_FORMAT_PCM; format.Format.wFormatTag = WAVE_FORMAT_PCM;
} }
else else
@ -253,12 +251,11 @@ new_fluid_dsound_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t fu
} }
else else
{ {
GUID guid_float = {DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_IEEE_FLOAT)};
FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format"); FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format");
dev->write = fluid_dsound_write_processed_channels; dev->write = fluid_dsound_write_processed_channels;
/* sample container size in bits: 32 bits */ /* sample container size in bits: 32 bits */
format.Format.wBitsPerSample = 8 * sizeof(float); format.Format.wBitsPerSample = 8 * sizeof(float);
format.SubFormat = guid_float; format.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
format.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; format.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
dev->drybuf = FLUID_ARRAY(float*, audio_channels * 2); dev->drybuf = FLUID_ARRAY(float*, audio_channels * 2);
if(dev->drybuf == NULL) if(dev->drybuf == NULL)

View file

@ -26,7 +26,6 @@
#if WAVEOUT_SUPPORT #if WAVEOUT_SUPPORT
#include <mmsystem.h> #include <mmsystem.h>
#include <mmreg.h> #include <mmreg.h>
/* Those two includes are required on Windows 9x/ME */ /* Those two includes are required on Windows 9x/ME */
@ -300,22 +299,20 @@ new_fluid_waveout_audio_driver2(fluid_settings_t *settings, fluid_audio_func_t f
/* check the format */ /* check the format */
if(fluid_settings_str_equal(settings, "audio.sample-format", "float") || func) if(fluid_settings_str_equal(settings, "audio.sample-format", "float") || func)
{ {
GUID guid_float = {DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_IEEE_FLOAT)};
FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format"); FLUID_LOG(FLUID_DBG, "Selected 32 bit sample format");
sample_size = sizeof(float); sample_size = sizeof(float);
write_ptr = func ? fluid_waveout_write_processed_channels : fluid_synth_write_float_channels; write_ptr = func ? fluid_waveout_write_processed_channels : fluid_synth_write_float_channels;
wfx.SubFormat = guid_float; wfx.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
wfx.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; wfx.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
} }
else if(fluid_settings_str_equal(settings, "audio.sample-format", "16bits")) else if(fluid_settings_str_equal(settings, "audio.sample-format", "16bits"))
{ {
GUID guid_pcm = {DEFINE_WAVEFORMATEX_GUID(WAVE_FORMAT_PCM)};
FLUID_LOG(FLUID_DBG, "Selected 16 bit sample format"); FLUID_LOG(FLUID_DBG, "Selected 16 bit sample format");
sample_size = sizeof(short); sample_size = sizeof(short);
write_ptr = fluid_synth_write_s16_channels; write_ptr = fluid_synth_write_s16_channels;
wfx.SubFormat = guid_pcm; wfx.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
wfx.Format.wFormatTag = WAVE_FORMAT_PCM; wfx.Format.wFormatTag = WAVE_FORMAT_PCM;
} }
else else