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