tweak C1-era CARR
[openc2e.git] / SkeletonAudioBackend.h
blob4814987763458935e0b8dde08542e0dc6396e996
1 /*
2 * SkeletonAudioBackend.h
3 * openc2e
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 {
30 protected:
31 int refcnt;
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 {
39 protected:
40 AudioClip clip;
41 /* we don't track state here because, well, the clips don't support
42 * length values yet.
44 bool looping, muted;
45 float x, y, z, volume;
46 SkeletonAudioSource() { looping = false; muted = false; volume = 1.0f; }
48 public:
49 AudioClip getClip() { return clip; }
50 void setClip(AudioClip &ac) {
51 assert(getState() == SS_STOP);
52 clip = ac;
54 SourceState getState() {
55 return SS_STOP;
57 void play() { assert(clip); }
58 void stop() { }
59 void pause() { }
60 void fadeOut() { }
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; }
72 #endif
74 /* vim: set noet: */