forked from eu07/maszyna
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSound.h
69 lines (60 loc) · 1.71 KB
/
Sound.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
This Source Code Form is subject to the
terms of the Mozilla Public License, v.
2.0. If a copy of the MPL was not
distributed with this file, You can
obtain one at
http://mozilla.org/MPL/2.0/.
*/
#ifndef SoundH
#define SoundH
#include <stack>
#undef EOF
#include <objbase.h>
//#include <initguid.h>
//#include <commdlg.h>
#include <mmreg.h>
#include <dsound.h>
//#include "resource.h"
#include "WavRead.h"
typedef LPDIRECTSOUNDBUFFER PSound;
// inline Playing(PSound Sound)
//{
//}
class TSoundContainer
{
public:
int Concurrent;
int Oldest;
char Name[80];
LPDIRECTSOUNDBUFFER DSBuffer;
float fSamplingRate; // czêstotliwoœæ odczytana z pliku
int iBitsPerSample; // ile bitów na próbkê
TSoundContainer *Next;
std::stack<LPDIRECTSOUNDBUFFER> DSBuffers;
LPDIRECTSOUNDBUFFER GetUnique(LPDIRECTSOUND pDS);
TSoundContainer(LPDIRECTSOUND pDS, char *Directory, char *strFileName, int NConcurrent);
~TSoundContainer();
};
class TSoundsManager
{
private:
static LPDIRECTSOUND pDS;
static LPDIRECTSOUNDNOTIFY pDSNotify;
// static char Directory[80];
static int Count;
static TSoundContainer *First;
static TSoundContainer *__fastcall LoadFromFile(char *Dir, char *Name, int Concurrent);
public:
// TSoundsManager(HWND hWnd);
// static void Init(HWND hWnd, char *NDirectory);
static void Init(HWND hWnd);
~TSoundsManager();
static void Free();
static void Init(char *Name, int Concurrent);
static void LoadSounds(char *Directory);
static LPDIRECTSOUNDBUFFER GetFromName(char *Name, bool Dynamic, float *fSamplingRate = NULL);
static void RestoreAll();
};
//---------------------------------------------------------------------------
#endif