1 // ------------------------------------------------------------------------ 2 // sample-specs.h: Sample value defaults and constants. 3 // Copyright (C) 1999-2004 Kai Vehmanen 4 // 5 // Attributes: 6 // eca-style-version: 2 7 // public-libecasound-API: yes 8 // 9 // This program is free software; you can redistribute it and/or modify 10 // it under the terms of the GNU General Public License as published by 11 // the Free Software Foundation; either version 2 of the License, or 12 // (at your option) any later version. 13 // 14 // This program is distributed in the hope that it will be useful, 15 // but WITHOUT ANY WARRANTY; without even the implied warranty of 16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 // GNU General Public License for more details. 18 // 19 // You should have received a copy of the GNU General Public License 20 // along with this program; if not, write to the Free Software 21 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 // ------------------------------------------------------------------------ 23 24 #ifndef INCLUDED_SAMPLE_SPECS_H 25 #define INCLUDED_SAMPLE_SPECS_H 26 27 /** 28 * Sample value defaults and constants. 29 */ 30 namespace SAMPLE_SPECS { 31 32 /** 33 * Type used to represent one sample value; should 34 * be a floating point value (floating-point type) 35 */ 36 typedef float sample_t; 37 38 /** 39 * Type used to represent position in sample 40 * frames (signed integer). 41 */ 42 #if defined _ISOC99_SOURCE || defined _ISOC9X_SOURCE || defined __GNUG__ 43 typedef long long int sample_pos_t; 44 #else 45 typedef long int sample_pos_t; 46 #endif 47 48 /** 49 * Type used to represent sample rate values (signed integer). 50 */ 51 typedef long int sample_rate_t; 52 53 /** 54 * Type used to identify individual channels (signed integer). 55 */ 56 typedef int channel_t; 57 58 static const sample_t silent_value = 0.0f; // do not change! 59 static const sample_t max_amplitude = 1.0f; 60 static const sample_t impl_max_value = silent_value + max_amplitude; 61 static const sample_t impl_min_value = silent_value - max_amplitude; 62 63 static const channel_t ch_left = 0; 64 static const channel_t ch_right = 1; 65 } 66 67 #endif 68