source: roaraudio/include/roaraudio/units.h @ 3209:bd194f02c828

Last change on this file since 3209:bd194f02c828 was 3209:bd194f02c828, checked in by phi, 14 years ago

+speeds, better vallues

File size: 2.6 KB
Line 
1//units.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010
5 *
6 *  This file is part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU Lesser General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio 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 Lesser General Public License for more details.
18 *
19 *  You should have received a copy of the GNU Lesser General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 *  NOTE: Even though this file is LGPLed it (may) include GPLed files
24 *  so the license of this file is/may therefore downgraded to GPL.
25 *  See HACKING for details.
26 */
27
28#ifndef _ROARAUDIO_UNITS_H_
29#define _ROARAUDIO_UNITS_H_
30
31/* suffix: */
32#define _MICRO  (1/1000000)
33#define _MILI   (1/1000)
34#define _ONE    1
35#define _KILO   1000
36#define _MEGA   (_KILO*_KILO)
37#define _GIGA   (_KILO*_MEGA)
38#define _TERA   (_KILO*_GIGA)
39
40
41/* Time: */
42#ifndef _SEC
43#if defined(_UNITS_T_BASE_MSEC)
44#define _SEC  1000
45#elif defined(_UNITS_T_BASE_USEC)
46#define _SEC  1000000
47//#elif defined(_UNITS_T_BASE_SEC)
48#else
49#define _SEC  1
50#endif
51#endif
52
53#define _MIN  (60*_SEC)
54#define _HOUR (60*_MIN)
55
56#define _MSEC (_SEC*_MILI)
57#define _USEC (_SEC*_MICRO)
58
59
60/* distance */
61#ifndef _METER
62#if defined(_UNITS_D_BASE_MMETER)
63#define _METER 1000
64#elif defined(_UNITS_D_BASE_UMETER)
65#define _METER 1000000
66//#elif defined(_UNITS_D_BASE_METER)
67#else
68#define _METER 1
69#endif
70#endif
71
72#define _AE    (149597870691LL     *_METER)
73#define _LJ    (9460730472580800LL *_METER)
74#define _PC    (30856804413117847LL*_METER) /* TODO: FIXME: get a more corret value */
75
76
77/* speed */
78#define _MPS                   (_METER/_SEC)
79#define _KMPH                  (_KILO*_METER/_HOUR)
80#define _SPEED_OF_SOUND_AIR    (343 *_MPS)
81#define _SPEED_OF_SOUND_WATER  (1407*_MPS)
82#define _SPEED_OF_SOUND        _SPEED_OF_SOUND_AIR
83#define _SPEED_OF_LIGHT_VACUUM (299792458LL*_MPS)
84#define _SPEED_OF_LIGHT        _SPEED_OF_LIGHT_VACUUM
85
86
87/* Bits -> Bytes: */
88#define _BIT2BYTE(x) (((int)((x)/8)) + ((x) % 8 ? 1 : 0))
89#define _BYTE2BIT(x) ((x)*8)
90
91#define _8BIT  _BIT2BYTE(8)
92#define _16BIT _BIT2BYTE(16)
93#define _24BIT _BIT2BYTE(24)
94#define _32BIT _BIT2BYTE(32)
95#define _64BIT _BIT2BYTE(64)
96
97
98#endif
99
100//ll
Note: See TracBrowser for help on using the repository browser.