-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoundBuffer.h
62 lines (52 loc) · 2.06 KB
/
SoundBuffer.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
/********************************************************************************************
*********************************************************************************************
Aaron's Tic-Tac-Toe Clone
A 2 player verison of Tic-Tac-Toe game that's played on a console screen.
Copyright (C) 2012 Aaron Gagern
This file is part of Aaron's Tic-Tac-Toe Clone.
Aaron's Tic-Tac-Toe Clone is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Aaron's Tic-Tac-Toe Clone is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Aaron's Tic-Tac-Toe Clone. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************************
********************************************************************************************/
#pragma once
#include <windows.h>
#include <xaudio2.h>
#include <fstream>
#include <memory>
#include <string>
#include <sstream>
#include "ExceptionClass.h"
#include "ErrorTypes.h"
typedef std::unique_ptr<BYTE> bytePtr;
typedef std::unique_ptr<XAUDIO2_BUFFER> xa2BufferPtr;
typedef std::unique_ptr<WAVEFORMATEX> wFormatPtr;
//Add support for other sound/music file types, especially ogg
class SoundBuffer
{
public:
SoundBuffer() throw();
SoundBuffer(const SoundBuffer &sb) throw();
~SoundBuffer() throw();
SoundBuffer& operator=(const SoundBuffer &sb) throw();
const xa2BufferPtr GetXA2Buffer() const;
const wFormatPtr GetWFormat() const;
bool LoadFile(const char *soundFile);
void InitializeSoundBuffer();
//Container Variables
private:
ErrorTypes err;
//Regular Variables
private:
WAVEFORMATEX format_;
XAUDIO2_BUFFER buffer_;
bytePtr soundData_;
bool isSoundBufferInitialized_;
};