1/*
2 *  Copyright 2001-2002, Haiku Inc. All Rights Reserved.
3 *  Distributed under the terms of the MIT License.
4 *
5 * Author:
6 *		Christopher ML Zumwalt May (zummy@users.sf.net)
7 */
8#ifndef _GAME_SOUND_DEFS_H
9#define _GAME_SOUND_DEFS_H
10
11
12#include <SupportDefs.h>
13
14
15typedef int32 gs_id;
16
17#define B_GS_CUR_API_VERSION B_BEOS_VERSION
18#define B_GS_MIN_API_VERSION 0x100
19
20// invalid sound handle
21#define B_GS_INVALID_SOUND ((gs_id)-1)
22
23// gs_id for the main mix buffer
24#define B_GS_MAIN_SOUND ((gs_id)-2)
25
26
27enum {
28	B_GS_BAD_HANDLE = -99999,
29	B_GS_NO_SOUNDS,
30	B_GS_NO_HARDWARE,
31	B_GS_ALREADY_COMMITTED,
32	B_GS_READ_ONLY_VALUE
33};
34
35
36struct gs_audio_format {
37	// same as media_raw_audio_format
38	enum format {	// for "format"
39		B_GS_U8 = 0x11,			// 128 == mid, 1 == bottom, 255 == top
40		B_GS_S16 = 0x2,			// 0 == mid, -32767 == bottom, +32767 == top
41		B_GS_F = 0x24,			// 0 == mid, -1.0 == bottom, 1.0 == top
42		B_GS_S32 = 0x4			// 0 == mid, 0x80000001 == bottom,
43								// 0x7fffffff == top
44	};
45	float		frame_rate;
46	uint32		channel_count;	// 1 or 2, mostly
47	uint32		format;			// for compressed formats, go to
48								// 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
54enum gs_attributes {
55	B_GS_NO_ATTRIBUTE = 0,		// when there is no attribute
56	B_GS_MAIN_GAIN = 1,			// 0 == 0 dB, -6.0 == -6 dB (gs_id ignored)
57	B_GS_CD_THROUGH_GAIN,		// 0 == 0 dB, -12.0 == -12 dB (gs_id ignored)
58								//	but which CD?
59	B_GS_GAIN = 128,			// 0 == 0 dB, -1.0 == -1 dB, +10.0 == +10 dB
60	B_GS_PAN,					// 0 == middle, -1.0 == left, +1.0 == right
61	B_GS_SAMPLING_RATE,			// 44100.0 == 44.1 kHz
62	B_GS_LOOPING,				// 0 == no
63	B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000,
64	B_GS_FIRST_USER_ATTRIBUTE = 100000
65};
66
67
68struct gs_attribute {
69		int32		attribute;	// which attribute
70		bigtime_t	duration;	// how long of time to ramp over for the change
71		float		value;		// where the value stops changing
72		uint32		flags;		// whatever flags are for the attribute
73};
74
75
76struct gs_attribute_info {
77		int32		attribute;
78		float		granularity;
79		float		minimum;
80		float		maximum;
81};
82
83
84#endif	// _GAME_SOUND_DEFS_H
85