xref: /haiku/headers/os/game/GameSoundDefs.h (revision edad811b963e9d524417216d54cd800a95afefd4)
1 /*
2  *  Copyright 2020, Haiku, Inc. All Rights Reserved.
3  *  Distributed under the terms of the MIT License.
4  */
5 #ifndef _GAME_SOUND_DEFS_H
6 #define _GAME_SOUND_DEFS_H
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 typedef int32 gs_id;
13 
14 #define B_GS_CUR_API_VERSION B_BEOS_VERSION
15 #define B_GS_MIN_API_VERSION 0x100
16 #define B_GS_INVALID_SOUND ((gs_id)-1)
17 #define B_GS_MAIN_SOUND ((gs_id)-2)
18 
19 
20 enum {
21 	B_GS_BAD_HANDLE = -99999,
22 	B_GS_NO_SOUNDS,
23 	B_GS_NO_HARDWARE,
24 	B_GS_ALREADY_COMMITTED,
25 	B_GS_READ_ONLY_VALUE
26 };
27 
28 
29 struct gs_audio_format {
30 	enum format {
31 		B_GS_U8 = 0x11,
32 		B_GS_S16 = 0x2,
33 		B_GS_F = 0x24,
34 		B_GS_S32 = 0x4
35 	};
36 	float	frame_rate;
37 	uint32	channel_count;
38 	uint32	format;
39 	uint32	byte_order;
40 	size_t	buffer_size;
41 };
42 
43 
44 enum gs_attributes {
45 	B_GS_NO_ATTRIBUTE = 0,
46 	B_GS_MAIN_GAIN = 1,
47 	B_GS_CD_THROUGH_GAIN,
48 	B_GS_GAIN = 128,
49 	B_GS_PAN,
50 	B_GS_SAMPLING_RATE,
51 	B_GS_LOOPING,
52 	B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000,
53 	B_GS_FIRST_USER_ATTRIBUTE = 100000
54 };
55 
56 
57 struct gs_attribute {
58 	int32		attribute;
59 	bigtime_t	duration;
60 	float		value;
61 	uint32		flags;
62 };
63 
64 
65 struct gs_attribute_info {
66 	int32	attribute;
67 	float	granularity;
68 	float	minimum;
69 	float	maximum;
70 };
71 
72 
73 #endif
74