xref: /haiku/headers/os/game/GameSoundDefs.h (revision 4c2bc7e83c660cbc266d50f3d924115268912656)
1 /*******************************************************************************
2 /
3 /	File:			GameSoundDefs.h
4 /
5 /   Description:    Definitions of common types and constants for the gamesound kit.
6 /
7 /	Copyright 1999, Be Incorporated, All Rights Reserved
8 /
9 *******************************************************************************/
10 
11 #if !defined(_GAME_SOUND_DEFS_H)
12 #define _GAME_SOUND_DEFS_H
13 
14 #include <SupportDefs.h>
15 
16 typedef int32 gs_id;
17 
18 #define B_GS_CUR_API_VERSION B_BEOS_VERSION
19 #define B_GS_MIN_API_VERSION 0x100
20 
21 //	invalid sound handle
22 #define B_GS_INVALID_SOUND ((gs_id)-1)
23 
24 //	gs_id for the main mix buffer
25 #define B_GS_MAIN_SOUND ((gs_id)-2)
26 
27 
28 enum	//fixme	renumber to real error messages
29 {
30 	B_GS_BAD_HANDLE = -99999,
31 	B_GS_NO_SOUNDS,
32 	B_GS_NO_HARDWARE,
33 	B_GS_ALREADY_COMMITTED,
34 	B_GS_READ_ONLY_VALUE
35 };
36 
37 
38 struct gs_audio_format
39 {		/* same as media_raw_audio_format */
40 	enum format {	/* for "format" */
41 		B_GS_U8 = 0x11,			/* 128 == mid, 1 == bottom, 255 == top */
42 		B_GS_S16 = 0x2,			/* 0 == mid, -32767 == bottom, +32767 == top */
43 		B_GS_F = 0x24,			/* 0 == mid, -1.0 == bottom, 1.0 == top */
44 		B_GS_S32 = 0x4			/* 0 == mid, 0x80000001 == bottom, 0x7fffffff == top */
45 	};
46 	float		frame_rate;
47 	uint32		channel_count;		/* 1 or 2, mostly */
48 	uint32		format;				/* for compressed formats, go to media_encoded_audio_format */
49 	uint32		byte_order;			/* 2 for little endian, 1 for big endian */
50 	size_t		buffer_size;		/* size of each buffer -- NOT GUARANTEED */
51 };
52 
53 
54 //
55 enum gs_attributes
56 {
57 	B_GS_NO_ATTRIBUTE = 0,			//	when there is no attribute
58 	B_GS_MAIN_GAIN = 1,				//	0 == 0 dB, -6.0 == -6 dB (gs_id ignored)
59 	B_GS_CD_THROUGH_GAIN,			//	0 == 0 dB, -12.0 == -12 dB (gs_id ignored)
60 										//	but which CD?
61 	B_GS_GAIN = 128,				//	0 == 0 dB, -1.0 == -1 dB, +10.0 == +10 dB
62 	B_GS_PAN,						//	0 == middle, -1.0 == left, +1.0 == right
63 	B_GS_SAMPLING_RATE,				//	44100.0 == 44.1 kHz
64 	B_GS_LOOPING,					//	0 == no
65 	B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000,
66 	B_GS_FIRST_USER_ATTRIBUTE = 100000
67 };
68 struct gs_attribute
69 {
70 		int32		attribute;		//	which attribute
71 		bigtime_t	duration;		//	how long of time to ramp over for the change
72 		float		value;			//	where the value stops changing
73 		uint32		flags;			//	whatever flags are for the attribute
74 };
75 struct gs_attribute_info
76 {
77 		int32		attribute;
78 		float		granularity;
79 		float		minimum;
80 		float		maximum;
81 };
82 
83 
84 #endif	//	_GAME_SOUND_DEFS_H
85