summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-09-10 08:24:22 -0700
committerGeorge Hazan <ghazan@miranda.im>2022-09-10 08:24:22 -0700
commit0c4cc90c2531453769df27acc0d3e524ca90e0de (patch)
tree7ebaf3cf3cd9746af90b91b903907cba43ce93ed
parent42dfc34b0a700db3206ca4850af5a517f318a54c (diff)
Skin_PlaySound / Skin_PlaySoundFile to return error value
-rw-r--r--src/mir_app/src/sounds.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 2a38d9b164..8da80075df 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -409,10 +409,16 @@ static int Skin_PlaySoundDefault(WPARAM wParam, LPARAM lParam)
{
wchar_t *pszFile = (wchar_t*)lParam;
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);
+ int flags;
+ if (pszFile) {
+ flags = SND_ASYNC | SND_FILENAME | SND_NOSTOP;
+ if (wParam & SPS_LOOP)
+ flags |= SND_LOOP;
+ }
+ else flags = 0;
+
+ if (!PlaySoundW(pszFile, nullptr, flags))
+ return 1;
}
return 0;
@@ -423,11 +429,10 @@ MIR_APP_DLL(int) Skin_PlaySoundFile(const wchar_t *pwszFileName, int flags)
if (pwszFileName) {
wchar_t tszFull[MAX_PATH];
PathToAbsoluteW(pwszFileName, tszFull);
- NotifyEventHooks(hPlayEvent, flags, (LPARAM)tszFull);
+ return NotifyEventHooks(hPlayEvent, flags, (LPARAM)tszFull);
}
- else NotifyEventHooks(hPlayEvent, flags, 0);
-
- return 0;
+
+ return NotifyEventHooks(hPlayEvent, flags, 0);
}
MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName, int flags)
@@ -446,8 +451,7 @@ MIR_APP_DLL(int) Skin_PlaySound(const char *pszSoundName, int flags)
if (wszFilePath == nullptr)
return 1;
- Skin_PlaySoundFile(wszFilePath, flags);
- return 0;
+ return Skin_PlaySoundFile(wszFilePath, flags);
}
int LoadSkinSounds(void)