-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsound.cpp
More file actions
30 lines (25 loc) · 780 Bytes
/
sound.cpp
File metadata and controls
30 lines (25 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include "sound.h"
DWORD openAlias(std::wstring fileName, std::wstring alias)
{
fileName = L"Open \"snds/" + fileName + L"\" alias " + alias;
return mciSendString(fileName.c_str(), NULL, 0, NULL);
}
DWORD playAlias(std::wstring alias)
{
alias = L"play " + alias + L" from 1"; //alias becomes the send string
return mciSendString(alias.c_str(), NULL, 0, NULL);
}
DWORD closeAlias(std::wstring alias)
{
alias = L"close " + alias;
return mciSendString(alias.c_str(), NULL, 0, NULL);
}
DWORD playFile(std::wstring fileName, bool loop) //.wav files can't be looped
{
fileName = L"play \"snds/" + fileName + L"\"" + ((loop) ? L" repeat" : L""); //fileName becomes the send string
return mciSendString(fileName.c_str(), NULL, 0, NULL);
}
DWORD stopSound()
{
return NULL;
}