]> git.tdb.fi Git - libs/al.git/blob - source/buffer.cpp
Fix a typo in the copyright notice
[libs/al.git] / source / buffer.cpp
1 /* $Id$
2
3 This file is part of libmspal
4 Copyright © 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #include "buffer.h"
9 #include "sound.h"
10
11 using namespace std;
12
13 namespace Msp {
14 namespace AL {
15
16 Buffer::Buffer()
17 {
18         alGenBuffers(1, &id);
19 }
20
21 Buffer::~Buffer()
22 {
23         alDeleteBuffers(1, &id);
24 }
25
26 void Buffer::data(Format fmt, const void *dt, sizei size, sizei freq)
27 {
28         alBufferData(id, fmt, dt, size, freq);
29 }
30
31 void Buffer::load_data(const string &fn)
32 {
33         Sound sound;
34         sound.load(fn);
35
36         data(sound.get_format(), sound.get_data(), sound.get_size(), sound.get_frequency());
37 }
38
39 } // namespace AL
40 } // namespace Msp