source: roaraudio/include/roaraudio/units.h @ 3206:4b32b3c5db0b

Last change on this file since 3206:4b32b3c5db0b was 3206:4b32b3c5db0b, checked in by phi, 14 years ago

added a new header file with common units

File size: 2.0 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#if defined(_UNITS_T_BASE_MSEC)
43#define _SEC  1000
44#elif defined(_UNITS_T_BASE_USEC)
45#define _SEC  1000000
46//#elif defined(_UNITS_T_BASE_SEC)
47#else
48#define _SEC  1
49#endif
50
51#define _MIN  (60*_SEC)
52#define _HOUR (60*_MIN)
53
54#define _MSEC (_SEC*_MILI)
55#define _USEC (_SEC*_MICRO)
56
57
58/* distance */
59#define _METER 1
60#define _AE    (149597870691*_METER)
61#define _LJ    (9460730472580800*_METER)
62#define _PC    (3.2615668*_LJ)
63
64/* Bits -> Bytes: */
65#define _BIT2BYTE(x) (((int)((x)/8)) + ((x) % 8 ? 1 : 0))
66#define _BYTE2BIT(x) ((x)*8)
67
68#define _8BIT  _BIT2BYTE(8)
69#define _16BIT _BIT2BYTE(16)
70#define _24BIT _BIT2BYTE(24)
71#define _32BIT _BIT2BYTE(32)
72#define _64BIT _BIT2BYTE(64)
73
74
75#endif
76
77//ll
Note: See TracBrowser for help on using the repository browser.