Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
buffer.h
Go to the documentation of this file.
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2012, Polish Portal of Colobot (PPC)
3 // *
4 // * This program is free software: you can redistribute it and/or modify
5 // * it under the terms of the GNU General Public License as published by
6 // * the Free Software Foundation, either version 3 of the License, or
7 // * (at your option) any later version.
8 // *
9 // * This program is distributed in the hope that it will be useful,
10 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // * GNU General Public License for more details.
13 // *
14 // * You should have received a copy of the GNU General Public License
15 // * along with this program. If not, see http://www.gnu.org/licenses/.
16 
22 #pragma once
23 
24 #include "sound/sound.h"
25 #include "common/logger.h"
26 
27 #include "sound/oalsound/check.h"
28 
29 #include <string>
30 #include <vector>
31 #include <array>
32 
33 #include <al.h>
34 #include <sndfile.h>
35 
36 class Buffer
37 {
38 public:
39  Buffer();
40  ~Buffer();
41 
42  bool LoadFromFile(std::string, Sound);
43  bool IsLoaded();
44 
45  Sound GetSoundType();
46  ALuint GetBuffer();
47  float GetDuration();
48 
49 private:
50  ALuint m_buffer;
51  Sound m_sound;
52  bool m_loaded;
53  float m_duration;
54 };
55