File: sound.h

package info (click to toggle)
kball 0.0.20041216-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,992 kB
  • sloc: cpp: 4,276; makefile: 65; sh: 64; ansic: 43
file content (70 lines) | stat: -rw-r--r-- 1,940 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// -----------------------------------------------
// Sound System
// By Kronoman
// Copyright (c) 2004, Kronoman
// In loving memory of my father
// -----------------------------------------------
// sound.h
// -----------------------------------------------
// This system wraps around Allegro and DUMB,
// so I can use the high level sound routines,
// global adjust volume, disable volume, etc
// -----------------------------------------------
#ifndef _KRONO_SOUND_H
#define _KRONO_SOUND_H

#include <allegro.h> // Allegro : http://alleg.sf.net/
#include <aldumb.h>  // DUMB : http://dumb.sf.net/

class CSoundWrapper
{
	public:
		CSoundWrapper();
		~CSoundWrapper();
		
		// digital samples
		int play_sample(const SAMPLE *spl, int vol, int pan, int freq, int loop); // digital sample playing
		void set_volume_d(int v); // volume digital
		int get_volume_d();
	
		// music
		void music_load(DUH *dat); // call this before playing, dat should be a pointer to a music object of a datafile
		
		void music_start(); // start playing
		
		void music_pause(); // pause playback
		void music_resume(); // pause playback
		
		void music_poll(); // _must_ be called at regular intervals to hear the music
		
		void music_stop(); // stop playing
		
		void set_volume_m(int v); // volume music
		int get_volume_m();

		// for all the object
		void set_enabled(bool s);
		bool is_enabled();
		
		// for all the class
		static void global_set_volume(int v);
		static int global_get_volume();
		
		static void global_set_enabled(bool s);
		static bool global_is_enabled();
		
	private:
	// for this object
		bool enabled; // enable this object player (if false, nothing will be played)
		int volume_d; // volume, 0 to 255
		int volume_m; // volume music, 0 to 255

	// for all the class
		static bool global_enabled; // enables the sound system ?
		static int global_volume; // global volume, 0 to 255

		DUH *duh;
		AL_DUH_PLAYER *dp;
};

#endif