Skip to content

Commit

Permalink
fix COM model in Windows audio drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
ValleyBell committed Mar 1, 2021
1 parent e925bad commit 7f84cd7
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if(MSVC)
set(Iconv_LIBRARY "${PROJECT_SOURCE_DIR}/libs/iconv/lib/libiconv.lib" CACHE FILEPATH "iconv library")

if(NOT MSVC_VERSION LESS 1400)
add_definitions("/D _CRT_SECURE_NO_WARNINGS")
add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
endif()
endif()

Expand Down
2 changes: 1 addition & 1 deletion audio/AudDrv_DSound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ UINT8 DSound_Start(void* drvObj, UINT32 deviceID, AUDIO_OPTS* options, void* aud
drv->bufSegCount = options->numBuffers ? options->numBuffers : 10;
drv->bufSize = drv->bufSegSize * drv->bufSegCount;

retVal = CoInitialize(NULL); // call again, in case Init() was called by another thread
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED); // call again, in case Init() was called by another thread
if (! (retVal == S_OK || retVal == S_FALSE))
return AERR_API_ERR;

Expand Down
6 changes: 3 additions & 3 deletions audio/AudDrv_WASAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ UINT8 WASAPI_IsAvailable(void)
UINT8 resVal;

resVal = 0;
retVal = CoInitialize(NULL);
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (! (retVal == S_OK || retVal == S_FALSE))
return 0;

Expand Down Expand Up @@ -159,7 +159,7 @@ UINT8 WASAPI_Init(void)
deviceList.devNames = NULL;
devListIDs = NULL;

retVal = CoInitialize(NULL);
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (! (retVal == S_OK || retVal == S_FALSE))
return AERR_API_ERR;

Expand Down Expand Up @@ -384,7 +384,7 @@ UINT8 WASAPI_Start(void* drvObj, UINT32 deviceID, AUDIO_OPTS* options, void* aud
bufTime = (REFERENCE_TIME)10000000 * drv->bufSmpls * drv->bufCount;
bufTime = (bufTime + options->sampleRate / 2) / options->sampleRate;

retVal = CoInitialize(NULL); // call again, in case Init() was called by another thread
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED); // call again, in case Init() was called by another thread
if (! (retVal == S_OK || retVal == S_FALSE))
return AERR_API_ERR;

Expand Down
4 changes: 2 additions & 2 deletions audio/AudDrv_XAudio2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ UINT8 XAudio2_Init(void)
deviceList.devNames = NULL;
devListIDs = NULL;

retVal = CoInitialize(NULL);
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (! (retVal == S_OK || retVal == S_FALSE))
return AERR_API_ERR;

Expand Down Expand Up @@ -290,7 +290,7 @@ UINT8 XAudio2_Start(void* drvObj, UINT32 deviceID, AUDIO_OPTS* options, void* au
drv->bufSize = drv->waveFmt.nBlockAlign * drv->bufSmpls;
drv->bufCount = options->numBuffers ? options->numBuffers : 10;

retVal = CoInitialize(NULL); // call again, in case Init() was called by another thread
retVal = CoInitializeEx(NULL, COINIT_MULTITHREADED); // call again, in case Init() was called by another thread
if (! (retVal == S_OK || retVal == S_FALSE))
return AERR_API_ERR;

Expand Down
1 change: 0 additions & 1 deletion emu/cores/fmopn2612.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,6 @@ INLINE void FM_KEYON(FM_OPN2 *OPN, FM_CH *CH , int s )
SLOT->key = 1;
}

INLINE void refresh_fc_eg_slot(FM_OPN2 *OPN, FM_SLOT *SLOT , int fc , int kc );
INLINE void FM_KEYOFF(FM_OPN2 *OPN, FM_CH *CH , int s )
{
FM_SLOT *SLOT = &CH->SLOT[s];
Expand Down
2 changes: 1 addition & 1 deletion player/playerbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct PLR_SONG_INFO
UINT32 tickRateDiv; // internal ticks per second: denumerator
// 1 second = 1 tick * tickMult / tickDiv
UINT32 songLen; // song length in ticks
UINT32 loopTick; // tick position where the loop begins
UINT32 loopTick; // tick position where the loop begins (-1 = no loop)
UINT32 deviceCnt; // number of used sound devices
};

Expand Down

0 comments on commit 7f84cd7

Please sign in to comment.