Mercurial > audio-send
view OpenAL32/Include/bs2b.h @ 1:c41d773a85fb
moved org files, ignored html files
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:03:35 -0700 |
parents | f9476ff7637e |
children |
line wrap: on
line source
1 /*-2 * Copyright (c) 2005 Boris Mikhaylov3 *4 * Permission is hereby granted, free of charge, to any person obtaining5 * a copy of this software and associated documentation files (the6 * "Software"), to deal in the Software without restriction, including7 * without limitation the rights to use, copy, modify, merge, publish,8 * distribute, sublicense, and/or sell copies of the Software, and to9 * permit persons to whom the Software is furnished to do so, subject to10 * the following conditions:11 *12 * The above copyright notice and this permission notice shall be13 * included in all copies or substantial portions of the Software.14 *15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.22 */24 #ifndef BS2B_H25 #define BS2B_H27 /* Number of crossfeed levels */28 #define BS2B_CLEVELS 330 /* Normal crossfeed levels */31 #define BS2B_HIGH_CLEVEL 332 #define BS2B_MIDDLE_CLEVEL 233 #define BS2B_LOW_CLEVEL 135 /* Easy crossfeed levels */36 #define BS2B_HIGH_ECLEVEL BS2B_HIGH_CLEVEL + BS2B_CLEVELS37 #define BS2B_MIDDLE_ECLEVEL BS2B_MIDDLE_CLEVEL + BS2B_CLEVELS38 #define BS2B_LOW_ECLEVEL BS2B_LOW_CLEVEL + BS2B_CLEVELS40 /* Default crossfeed levels */41 #define BS2B_DEFAULT_CLEVEL BS2B_HIGH_ECLEVEL42 /* Default sample rate (Hz) */43 #define BS2B_DEFAULT_SRATE 4410045 #ifdef __cplusplus46 extern "C" {47 #endif /* __cplusplus */49 struct bs2b {50 int level; /* Crossfeed level */51 int srate; /* Sample rate (Hz) */53 /* Lowpass IIR filter coefficients */54 double a0_lo;55 double b1_lo;57 /* Highboost IIR filter coefficients */58 double a0_hi;59 double a1_hi;60 double b1_hi;62 /* Global gain against overloading */63 double gain;65 /* Buffer of last filtered sample.66 * [0] - first channel, [1] - second channel67 */68 struct t_last_sample {69 double asis[2];70 double lo[2];71 double hi[2];72 } last_sample;73 };75 /* Clear buffers and set new coefficients with new crossfeed level value.76 * level - crossfeed level of *LEVEL values.77 */78 void bs2b_set_level(struct bs2b *bs2b, int level);80 /* Return current crossfeed level value */81 int bs2b_get_level(struct bs2b *bs2b);83 /* Clear buffers and set new coefficients with new sample rate value.84 * srate - sample rate by Hz.85 */86 void bs2b_set_srate(struct bs2b *bs2b, int srate);88 /* Return current sample rate value */89 int bs2b_get_srate(struct bs2b *bs2b);91 /* Clear buffer */92 void bs2b_clear(struct bs2b *bs2b);94 /* Return 1 if buffer is clear */95 int bs2b_is_clear(struct bs2b *bs2b);97 /* Crossfeeds one stereo sample that are pointed by sample.98 * [0] - first channel, [1] - second channel.99 * Returns crossfided samle by sample pointer.100 */102 /* sample poits to floats */103 void bs2b_cross_feed(struct bs2b *bs2b, float *sample);105 #ifdef __cplusplus106 } /* extern "C" */107 #endif /* __cplusplus */109 #endif /* BS2B_H */