summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-09-10 07:11:37 -0700
committerGeorge Hazan <ghazan@miranda.im>2022-09-10 07:11:37 -0700
commita929d4c862a60c9abc1b6e9fe507831326f232dc (patch)
treeebdfd47a4781e11e1501c6ff8a0e62000feda4a0 /src/mir_app
parentf0585b3e81a1a0a9cfde43313cadf0ee72daad27 (diff)
fixes #3192 (VoiceService: звук звонка воспроизводится лишь один раз)
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/src/sounds.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 54b8b00ca6..2a38d9b164 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -408,24 +408,29 @@ int CMPluginBase::addSound(const char *pszName, const wchar_t *pwszSection, cons
static int Skin_PlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
wchar_t *pszFile = (wchar_t*)lParam;
- if (pszFile && (db_get_b(0, "Skin", "UseSound", 0) || (int)wParam == 1))
- PlaySound(pszFile, nullptr, SND_ASYNC | SND_FILENAME | SND_NOSTOP);
+ if (db_get_b(0, "Skin", "UseSound", 0) || (wParam & SPS_FORCEPLAY) != 0) {
+ int flags = SND_ASYNC | SND_FILENAME | SND_NOSTOP;
+ if (wParam & SPS_LOOP)
+ flags |= SND_LOOP;
+ PlaySoundW(pszFile, nullptr, flags);
+ }
return 0;
}
-MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName)
+MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName, int flags)
{
- if (pwszFileName == nullptr)
- return 1;
-
- wchar_t tszFull[MAX_PATH];
- PathToAbsoluteW(pwszFileName, tszFull);
- NotifyEventHooks(hPlayEvent, 0, (LPARAM)tszFull);
+ if (pwszFileName) {
+ wchar_t tszFull[MAX_PATH];
+ PathToAbsoluteW(pwszFileName, tszFull);
+ NotifyEventHooks(hPlayEvent, flags, (LPARAM)tszFull);
+ }
+ else NotifyEventHooks(hPlayEvent, flags, 0);
+
return 0;
}
-MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName)
+MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName, int flags)
{
if (pszSoundName == nullptr)
return 1;
@@ -441,7 +446,7 @@ MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName)
if (wszFilePath == nullptr)
return 1;
- Skin_PlaySoundFile(wszFilePath);
+ Skin_PlaySoundFile(wszFilePath, flags);
return 0;
}