~ubuntu-branches/ubuntu/quantal/zaz/quantal

« back to all changes in this revision

Viewing changes to src/audiobuffer.h

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2009-08-31 20:08:58 UTC
  • Revision ID: james.westby@ubuntu.com-20090831200858-54lcmcrna6dwk3wr
Tags: upstream-0.2.9+dfsg1
ImportĀ upstreamĀ versionĀ 0.2.9+dfsg1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Zaz
 
3
 * Copyright (C) Remigiusz Dybka 2009 <remigiusz.dybka@gmail.com>
 
4
 *
 
5
 Zaz is free software: you can redistribute it and/or modify it
 
6
 under the terms of the GNU General Public License as published by the
 
7
 Free Software Foundation, either version 3 of the License, or
 
8
 (at your option) any later version.
 
9
 
 
10
 Zaz is distributed in the hope that it will be useful, but
 
11
 WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
13
 See the GNU General Public License for more details.
 
14
 
 
15
 You should have received a copy of the GNU General Public License along
 
16
 with this program.  If not, see <http://www.gnu.org/licenses/>.
 
17
 */
 
18
 
 
19
#ifndef __AUDIOBUFFER_H__
 
20
#define __AUDIOBUFFER_H__
 
21
 
 
22
#include "sample.h"
 
23
 
 
24
namespace Scenes
 
25
{
 
26
    class AudioBuffer
 
27
    {
 
28
            friend class Mixer;
 
29
        private:
 
30
            Sample *sample;
 
31
            uint offset;
 
32
            uint length;
 
33
            bool playing;
 
34
            bool loop;
 
35
            int pan, vol;
 
36
            bool streaming;
 
37
            uint bufflen;
 
38
            Sint16 *buff;
 
39
            uint PanAndMix(uint req_length = 0);
 
40
 
 
41
        public:
 
42
            Sample *getSample()
 
43
            {
 
44
                return sample;
 
45
            };
 
46
            Sint16 *getMix(uint requested_length, uint &returned_length);
 
47
            void Play(Sample *smpl, int vol, int pan, bool loop);
 
48
            void Stop();
 
49
 
 
50
            bool operator==(const Sample *s)
 
51
            {
 
52
                if (sample == s)
 
53
                    return true;
 
54
 
 
55
                return false;
 
56
            };
 
57
 
 
58
            void Reset(); // useful if we don't want that sample requeued (because it's deleted)
 
59
 
 
60
            AudioBuffer();
 
61
            ~AudioBuffer();
 
62
    };
 
63
}
 
64
 
 
65
#endif // __AUDIOBUFFER_H__