/*- * Copyright (c) 2007-2008 Ariff Abdullah * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SND_MATRIX_H_ #define _SND_MATRIX_H_ #undef SND_MULTICHANNEL #ifndef SND_OLDSTEREO #define SND_MULTICHANNEL 1 #endif #define SND_CHN_T_FL 0 /* Front Left */ #define SND_CHN_T_FR 1 /* Front Right */ #define SND_CHN_T_FC 2 /* Front Center */ #define SND_CHN_T_LF 3 /* Low Frequency */ #define SND_CHN_T_BL 4 /* Back Left */ #define SND_CHN_T_BR 5 /* Back Right */ #define SND_CHN_T_FLC 6 /* Front Left Center */ #define SND_CHN_T_FRC 7 /* Front Right Center */ #define SND_CHN_T_BC 8 /* Back Center */ #define SND_CHN_T_SL 9 /* Side Left */ #define SND_CHN_T_SR 10 /* Side Right */ #define SND_CHN_T_TC 11 /* Top Center */ #define SND_CHN_T_TFL 12 /* Top Front Left */ #define SND_CHN_T_TFC 13 /* Top Front Center */ #define SND_CHN_T_TFR 14 /* Top Front Right */ #define SND_CHN_T_TBL 15 /* Top Back Left */ #define SND_CHN_T_TBC 16 /* Top Back Center */ #define SND_CHN_T_TBR 17 /* Top Back Right */ #define SND_CHN_T_MAX 18 /* Maximum channels */ #define SND_CHN_LEFT_MASK \ ((1 << SND_CHN_T_FL) | \ (1 << SND_CHN_T_BL) | \ (1 << SND_CHN_T_FLC) | \ (1 << SND_CHN_T_SL) | \ (1 << SND_CHN_T_TFL) | \ (1 << SND_CHN_T_TBL)) #define SND_CHN_RIGHT_MASK \ ((1 << SND_CHN_T_FR) | \ (1 << SND_CHN_T_BR) | \ (1 << SND_CHN_T_FRC) | \ (1 << SND_CHN_T_SR) | \ (1 << SND_CHN_T_TFR) | \ (1 << SND_CHN_T_TBR)) #define SND_CHN_CENTER_MASK \ ((1 << SND_CHN_T_FC) | \ (1 << SND_CHN_T_BC) | \ (1 << SND_CHN_T_TC) | \ (1 << SND_CHN_T_TFC) | \ (1 << SND_CHN_T_TBC) | \ (1 << SND_CHN_T_LF)) /* XXX what?!? */ #define SND_CHN_T_VOL_0DB SND_CHN_T_MAX #define SND_CHN_T_VOL_MAX (SND_CHN_T_VOL_0DB + 1) #define SND_CHN_T_BEGIN SND_CHN_T_FL #define SND_CHN_T_STEP 1 #define SND_CHN_MIN 1 #ifdef SND_MULTICHANNEL #define SND_CHN_T_END SND_CHN_T_TBR #define SND_CHN_MAX SND_CHN_T_MAX #else #define SND_CHN_T_END SND_CHN_T_FR #define SND_CHN_MAX 2 #endif /* * Multichannel interleaved volume matrix. Each calculated value relative * to master and 0db will be stored in each CLASS + 1 as long as * chn_setvolume_matrix() or the equivalent CHN_SETVOLUME() macros is * used (see channel.c). */ #define SND_VOL_C_MASTER 0 #define SND_VOL_C_PCM 1 #define SND_VOL_C_PCM_VAL 2 #define SND_VOL_C_MAX 3 #define SND_VOL_C_BEGIN SND_VOL_C_PCM #define SND_VOL_C_END SND_VOL_C_PCM #define SND_VOL_C_STEP 2 #define SND_VOL_C_VAL(x) ((x) + 1) #define SND_VOL_0DB_MIN 1 #define SND_VOL_0DB_MAX 100 #define SND_VOL_0DB_MASTER 100 #define SND_VOL_0DB_PCM 45 #define SND_VOL_RESOLUTION 8 #define SND_VOL_FLAT (1 << SND_VOL_RESOLUTION) #define SND_VOL_CALC_SAMPLE(x, y) (((x) * (y)) >> SND_VOL_RESOLUTION) #define SND_VOL_CALC_VAL(x, y, z) \ (((((x)[y][z] << SND_VOL_RESOLUTION) / \ (x)[y][SND_CHN_T_VOL_0DB]) * \ (x)[SND_VOL_C_MASTER][z]) / \ (x)[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB]) \ #endif /* !_SND_MATRIX_H_ */