1 //------------------------------------------------------------------------------ 2 // Copyright (c) 2001-2002, OpenBeOS 3 // 4 // Permission is hereby granted, free of charge, to any person obtaining a 5 // copy of this software and associated documentation files (the "Software"), 6 // to deal in the Software without restriction, including without limitation 7 // the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 // and/or sell copies of the Software, and to permit persons to whom the 9 // Software is furnished to do so, subject to the following conditions: 10 // 11 // The above copyright notice and this permission notice shall be included in 12 // all copies or substantial portions of the Software. 13 // 14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 // DEALINGS IN THE SOFTWARE. 21 // 22 // File Name: GameSound.cpp 23 // Author: Christopher ML Zumwalt May (cdzumwalt@dsl-only.net) 24 // Description: Declarations for game sounds 25 //------------------------------------------------------------------------------ 26 27 #if !defined(_GAME_SOUND_DEFS_H) 28 #define _GAME_SOUND_DEFS_H 29 30 #include <SupportDefs.h> 31 32 typedef int32 gs_id; 33 34 #define B_GS_CUR_API_VERSION B_BEOS_VERSION 35 #define B_GS_MIN_API_VERSION 0x100 36 37 // invalid sound handle 38 #define B_GS_INVALID_SOUND ((gs_id)-1) 39 40 // gs_id for the main mix buffer 41 #define B_GS_MAIN_SOUND ((gs_id)-2) 42 43 44 enum //fixme renumber to real error messages 45 { 46 B_GS_BAD_HANDLE = -99999, 47 B_GS_NO_SOUNDS, 48 B_GS_NO_HARDWARE, 49 B_GS_ALREADY_COMMITTED, 50 B_GS_READ_ONLY_VALUE 51 }; 52 53 54 struct gs_audio_format 55 { /* same as media_raw_audio_format */ 56 enum format { /* for "format" */ 57 B_GS_U8 = 0x11, /* 128 == mid, 1 == bottom, 255 == top */ 58 B_GS_S16 = 0x2, /* 0 == mid, -32767 == bottom, +32767 == top */ 59 B_GS_F = 0x24, /* 0 == mid, -1.0 == bottom, 1.0 == top */ 60 B_GS_S32 = 0x4 /* 0 == mid, 0x80000001 == bottom, 0x7fffffff == top */ 61 }; 62 float frame_rate; 63 uint32 channel_count; /* 1 or 2, mostly */ 64 uint32 format; /* for compressed formats, go to media_encoded_audio_format */ 65 uint32 byte_order; /* 2 for little endian, 1 for big endian */ 66 size_t buffer_size; /* size of each buffer -- NOT GUARANTEED */ 67 }; 68 69 70 // 71 enum gs_attributes 72 { 73 B_GS_NO_ATTRIBUTE = 0, // when there is no attribute 74 B_GS_MAIN_GAIN = 1, // 0 == 0 dB, -6.0 == -6 dB (gs_id ignored) 75 B_GS_CD_THROUGH_GAIN, // 0 == 0 dB, -12.0 == -12 dB (gs_id ignored) 76 // but which CD? 77 B_GS_GAIN = 128, // 0 == 0 dB, -1.0 == -1 dB, +10.0 == +10 dB 78 B_GS_PAN, // 0 == middle, -1.0 == left, +1.0 == right 79 B_GS_SAMPLING_RATE, // 44100.0 == 44.1 kHz 80 B_GS_LOOPING, // 0 == no 81 B_GS_FIRST_PRIVATE_ATTRIBUTE = 90000, 82 B_GS_FIRST_USER_ATTRIBUTE = 100000 83 }; 84 struct gs_attribute 85 { 86 int32 attribute; // which attribute 87 bigtime_t duration; // how long of time to ramp over for the change 88 float value; // where the value stops changing 89 uint32 flags; // whatever flags are for the attribute 90 }; 91 struct gs_attribute_info 92 { 93 int32 attribute; 94 float granularity; 95 float minimum; 96 float maximum; 97 }; 98 99 100 #endif // _GAME_SOUND_DEFS_H 101