Mercurial > hg > audiostuff
comparison spandsp-0.0.6pre17/src/spandsp/telephony.h @ 4:26cd8f1ef0b1
import spandsp-0.0.6pre17
| author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
|---|---|
| date | Fri, 25 Jun 2010 15:50:58 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 3:c6c5a16ce2f2 | 4:26cd8f1ef0b1 |
|---|---|
| 1 /* | |
| 2 * SpanDSP - a series of DSP components for telephony | |
| 3 * | |
| 4 * telephony.h - some very basic telephony definitions | |
| 5 * | |
| 6 * Written by Steve Underwood <steveu@coppice.org> | |
| 7 * | |
| 8 * Copyright (C) 2003 Steve Underwood | |
| 9 * | |
| 10 * All rights reserved. | |
| 11 * | |
| 12 * This program is free software; you can redistribute it and/or modify | |
| 13 * it under the terms of the GNU Lesser General Public License version 2.1, | |
| 14 * as published by the Free Software Foundation. | |
| 15 * | |
| 16 * This program is distributed in the hope that it will be useful, | |
| 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 * GNU Lesser General Public License for more details. | |
| 20 * | |
| 21 * You should have received a copy of the GNU Lesser General Public | |
| 22 * License along with this program; if not, write to the Free Software | |
| 23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
| 24 * | |
| 25 * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $ | |
| 26 */ | |
| 27 | |
| 28 #if !defined(_SPANDSP_TELEPHONY_H_) | |
| 29 #define _SPANDSP_TELEPHONY_H_ | |
| 30 | |
| 31 #if defined(_M_IX86) || defined(_M_X64) | |
| 32 #if defined(LIBSPANDSP_EXPORTS) | |
| 33 #define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall | |
| 34 #define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl | |
| 35 #define SPAN_DECLARE_DATA __declspec(dllexport) | |
| 36 #else | |
| 37 #define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall | |
| 38 #define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl | |
| 39 #define SPAN_DECLARE_DATA __declspec(dllimport) | |
| 40 #endif | |
| 41 #elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__)) | |
| 42 #define SPAN_DECLARE(type) __attribute__((visibility("default"))) type | |
| 43 #define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type | |
| 44 #define SPAN_DECLARE_DATA __attribute__((visibility("default"))) | |
| 45 #else | |
| 46 #define SPAN_DECLARE(type) /**/ type | |
| 47 #define SPAN_DECLARE_NONSTD(type) /**/ type | |
| 48 #define SPAN_DECLARE_DATA /**/ | |
| 49 #endif | |
| 50 | |
| 51 #define SAMPLE_RATE 8000 | |
| 52 | |
| 53 /* This is based on A-law, but u-law is only 0.03dB different */ | |
| 54 #define DBM0_MAX_POWER (3.14f + 3.02f) | |
| 55 #define DBM0_MAX_SINE_POWER (3.14f) | |
| 56 /* This is based on the ITU definition of dbOv in G.100.1 */ | |
| 57 #define DBOV_MAX_POWER (0.0f) | |
| 58 #define DBOV_MAX_SINE_POWER (-3.02f) | |
| 59 | |
| 60 /*! \brief A handler for pure receive. The buffer cannot be altered. */ | |
| 61 typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len); | |
| 62 | |
| 63 /*! \brief A handler for receive, where the buffer can be altered. */ | |
| 64 typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len); | |
| 65 | |
| 66 /*! \brief A handler for missing receive data fill-in. */ | |
| 67 typedef int (span_rx_fillin_handler_t)(void *s, int len); | |
| 68 | |
| 69 /*! \brief A handler for transmit, where the buffer will be filled. */ | |
| 70 typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len); | |
| 71 | |
| 72 #define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000)) | |
| 73 #define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE)) | |
| 74 | |
| 75 #if !defined(FALSE) | |
| 76 #define FALSE 0 | |
| 77 #endif | |
| 78 #if !defined(TRUE) | |
| 79 #define TRUE (!FALSE) | |
| 80 #endif | |
| 81 | |
| 82 #if defined(__cplusplus) | |
| 83 /* C++ doesn't seem to have sane rounding functions/macros yet */ | |
| 84 #if !defined(WIN32) | |
| 85 #define lrint(x) ((long int) (x)) | |
| 86 #define lrintf(x) ((long int) (x)) | |
| 87 #endif | |
| 88 #endif | |
| 89 | |
| 90 #endif | |
| 91 /*- End of file ------------------------------------------------------------*/ |
