2 * SkeletonAudioBackend.h
5 * Created by Bryan Donlan on Sun Aug 12 2007.
6 * Copyright (c) 2007 Bryan Donlan. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
20 #ifndef SKELETONAUDIOBACKEND_H
21 #define SKELETONAUDIOBACKEND_H 1
23 #include "AudioBackend.h"
25 /* This header exists to provide a skeleton implementation for new
26 * audio backends. Normally client code should not include it.
29 class SkeletonAudioBuffer
: public AudioBuffer
{
32 SkeletonAudioBuffer() { refcnt
= 0; }
33 friend class NullBackend
;
34 void add_ref() { refcnt
++; }
35 void del_ref() { assert(refcnt
); refcnt
--; if (!refcnt
) delete this; }
38 class SkeletonAudioSource
: public AudioSource
{
41 /* we don't track state here because, well, the clips don't support
45 float x
, y
, z
, volume
;
46 SkeletonAudioSource() { looping
= false; muted
= false; volume
= 1.0f
; }
49 AudioClip
getClip() { return clip
; }
50 void setClip(AudioClip
&ac
) {
51 assert(getState() == SS_STOP
);
54 SourceState
getState() {
57 void play() { assert(clip
); }
61 void setPos(float x_
, float y_
, float z_
) { x
= x_
; y
= y_
; z
= z_
; }
62 void getPos(float &x_
, float &y_
, float &z_
) { x_
= x
; y_
= y
; z_
= z
; }
63 void setVelocity(float, float) { }
64 bool isLooping() { return looping
; }
65 void setLooping(bool l
) { looping
= l
; }
66 void setVolume(float v
) { volume
= v
; }
67 float getVolume() { return volume
; }
68 bool isMuted() { return muted
; }
69 void setMute(bool m
) { muted
= m
; }