The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/sound/pcm/matrix.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 2007-2009 Ariff Abdullah <ariff@FreeBSD.org>
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/8.3/sys/dev/sound/pcm/matrix.h 193640 2009-06-07 19:12:08Z ariff $
   27  */
   28 
   29 #ifndef _SND_MATRIX_H_
   30 #define _SND_MATRIX_H_
   31 
   32 #undef SND_MULTICHANNEL
   33 #ifndef SND_OLDSTEREO
   34 #define SND_MULTICHANNEL        1
   35 #endif
   36 
   37 /*
   38  * XXX = unused, but part of the definition (will be used someday, maybe).
   39  */
   40 #define SND_CHN_T_FL            0       /* Front Left         */
   41 #define SND_CHN_T_FR            1       /* Front Right        */
   42 #define SND_CHN_T_FC            2       /* Front Center       */
   43 #define SND_CHN_T_LF            3       /* Low Frequency      */
   44 #define SND_CHN_T_BL            4       /* Back Left          */
   45 #define SND_CHN_T_BR            5       /* Back Right         */
   46 #define SND_CHN_T_FLC           6       /* Front Left Center  XXX */
   47 #define SND_CHN_T_FRC           7       /* Front Right Center XXX */
   48 #define SND_CHN_T_BC            8       /* Back Center        */
   49 #define SND_CHN_T_SL            9       /* Side Left          */
   50 #define SND_CHN_T_SR            10      /* Side Right         */
   51 #define SND_CHN_T_TC            11      /* Top Center         XXX */
   52 #define SND_CHN_T_TFL           12      /* Top Front Left     XXX */
   53 #define SND_CHN_T_TFC           13      /* Top Front Center   XXX */
   54 #define SND_CHN_T_TFR           14      /* Top Front Right    XXX */
   55 #define SND_CHN_T_TBL           15      /* Top Back Left      XXX */
   56 #define SND_CHN_T_TBC           16      /* Top Back Center    XXX */
   57 #define SND_CHN_T_TBR           17      /* Top Back Right     XXX */
   58 #define SND_CHN_T_MAX           18      /* Maximum channels   */
   59 
   60 #define SND_CHN_T_ZERO          (SND_CHN_T_MAX + 1)     /* Zero samples */
   61 
   62 #define SND_CHN_T_LABELS        {                                       \
   63          "fl",  "fr",  "fc",  "lf",  "bl",  "br",                       \
   64         "flc", "frc",  "bc",  "sl",  "sr",  "tc",                       \
   65         "tfl", "tfc", "tfr", "tbl", "tbc", "tbr"                        \
   66 }
   67 
   68 #define SND_CHN_T_NAMES {                                               \
   69         "Front Left", "Front Right", "Front Center",                    \
   70         "Low Frequency Effects",                                        \
   71         "Back Left", "Back Right",                                      \
   72         "Front Left Center", "Front Right Center",                      \
   73         "Back Center",                                                  \
   74         "Side Left", "Side Right",                                      \
   75         "Top Center",                                                   \
   76         "Top Front Left", "Top Front Center", "Top Front Right",        \
   77         "Top Back Left", "Top Back Center", "Top Back Right"            \
   78 }
   79 
   80 #define SND_CHN_T_MASK_FL       (1 << SND_CHN_T_FL)
   81 #define SND_CHN_T_MASK_FR       (1 << SND_CHN_T_FR)
   82 #define SND_CHN_T_MASK_FC       (1 << SND_CHN_T_FC)
   83 #define SND_CHN_T_MASK_LF       (1 << SND_CHN_T_LF)
   84 #define SND_CHN_T_MASK_BL       (1 << SND_CHN_T_BL)
   85 #define SND_CHN_T_MASK_BR       (1 << SND_CHN_T_BR)
   86 #define SND_CHN_T_MASK_FLC      (1 << SND_CHN_T_FLC)
   87 #define SND_CHN_T_MASK_FRC      (1 << SND_CHN_T_FRC)
   88 #define SND_CHN_T_MASK_BC       (1 << SND_CHN_T_BC)
   89 #define SND_CHN_T_MASK_SL       (1 << SND_CHN_T_SL)
   90 #define SND_CHN_T_MASK_SR       (1 << SND_CHN_T_SR)
   91 #define SND_CHN_T_MASK_TC       (1 << SND_CHN_T_TC)
   92 #define SND_CHN_T_MASK_TFL      (1 << SND_CHN_T_TFL)
   93 #define SND_CHN_T_MASK_TFC      (1 << SND_CHN_T_TFC)
   94 #define SND_CHN_T_MASK_TFR      (1 << SND_CHN_T_TFR)
   95 #define SND_CHN_T_MASK_TBL      (1 << SND_CHN_T_TBL)
   96 #define SND_CHN_T_MASK_TBC      (1 << SND_CHN_T_TBC)
   97 #define SND_CHN_T_MASK_TBR      (1 << SND_CHN_T_TBR)
   98 
   99 #define SND_CHN_LEFT_MASK       (SND_CHN_T_MASK_FL  |                   \
  100                                  SND_CHN_T_MASK_BL  |                   \
  101                                  SND_CHN_T_MASK_FLC |                   \
  102                                  SND_CHN_T_MASK_SL  |                   \
  103                                  SND_CHN_T_MASK_TFL |                   \
  104                                  SND_CHN_T_MASK_TBL)
  105 
  106 #define SND_CHN_RIGHT_MASK      (SND_CHN_T_MASK_FR  |                   \
  107                                  SND_CHN_T_MASK_BR  |                   \
  108                                  SND_CHN_T_MASK_FRC |                   \
  109                                  SND_CHN_T_MASK_SR  |                   \
  110                                  SND_CHN_T_MASK_TFR |                   \
  111                                  SND_CHN_T_MASK_TBR)
  112 
  113 #define SND_CHN_CENTER_MASK     (SND_CHN_T_MASK_FC  |                   \
  114                                  SND_CHN_T_MASK_BC  |                   \
  115                                  SND_CHN_T_MASK_TC  |                   \
  116                                  SND_CHN_T_MASK_TFC |                   \
  117                                  SND_CHN_T_MASK_TBC |                   \
  118                                  SND_CHN_T_MASK_LF)     /* XXX what?!? */
  119 
  120 /*
  121  * Matrix identity.
  122  */
  123 
  124 /* 1 @ Mono 1.0 */
  125 #define SND_CHN_MATRIX_1_0      0
  126 #define SND_CHN_MATRIX_1        SND_CHN_MATRIX_1_0
  127 
  128 /* 2 @ Stereo 2.0 */
  129 #define SND_CHN_MATRIX_2_0      1
  130 #define SND_CHN_MATRIX_2        SND_CHN_MATRIX_2_0      
  131 
  132 /* 3 @ 2.1 (lfe), 3.0 (rear center, DEFAULT) */
  133 #define SND_CHN_MATRIX_2_1      2
  134 #define SND_CHN_MATRIX_3_0      3
  135 #define SND_CHN_MATRIX_3        SND_CHN_MATRIX_3_0
  136 
  137 /* 4 @ 4.0 Quadraphonic */
  138 #define SND_CHN_MATRIX_4_0      4
  139 #define SND_CHN_MATRIX_4        SND_CHN_MATRIX_4_0
  140 
  141 /* 5 @ 4.1 (lfe), 5.0 (center, DEFAULT) */
  142 #define SND_CHN_MATRIX_4_1      5
  143 #define SND_CHN_MATRIX_5_0      6
  144 #define SND_CHN_MATRIX_5        SND_CHN_MATRIX_5_0
  145 
  146 /* 6 @ 5.1 (lfe, DEFAULT), 6.0 (rear center) */
  147 #define SND_CHN_MATRIX_5_1      7
  148 #define SND_CHN_MATRIX_6_0      8
  149 #define SND_CHN_MATRIX_6        SND_CHN_MATRIX_5_1
  150 
  151 /* 7 @ 6.1 (lfe) */
  152 #define SND_CHN_MATRIX_6_1      9
  153 #define SND_CHN_MATRIX_7        SND_CHN_MATRIX_6_1
  154 
  155 /* 8 @ 7.1 (lfe) */
  156 #define SND_CHN_MATRIX_7_1      10
  157 #define SND_CHN_MATRIX_8        SND_CHN_MATRIX_7_1
  158 
  159 #define SND_CHN_MATRIX_MAX      11
  160 
  161 #define SND_CHN_MATRIX_BEGIN    SND_CHN_MATRIX_1_0
  162 #define SND_CHN_MATRIX_END      SND_CHN_MATRIX_7_1
  163 
  164 /* Custom matrix identity */
  165 #define SND_CHN_MATRIX_DRV              -4      /* driver own identity   */
  166 #define SND_CHN_MATRIX_PCMCHANNEL       -3      /* PCM channel identity  */
  167 #define SND_CHN_MATRIX_MISC             -2      /* misc, custom defined  */
  168 #define SND_CHN_MATRIX_UNKNOWN          -1      /* unknown               */
  169 
  170 #define SND_CHN_T_VOL_0DB       SND_CHN_T_MAX
  171 #define SND_CHN_T_VOL_MAX       (SND_CHN_T_VOL_0DB + 1)
  172 
  173 #define SND_CHN_T_BEGIN         SND_CHN_T_FL
  174 #define SND_CHN_T_END           SND_CHN_T_TBR
  175 #define SND_CHN_T_STEP          1
  176 #define SND_CHN_MIN             1
  177 
  178 #ifdef SND_MULTICHANNEL
  179 #define SND_CHN_MAX             8
  180 #else
  181 #define SND_CHN_MAX             2
  182 #endif
  183 
  184 /*
  185  * Multichannel interleaved volume matrix. Each calculated value relative
  186  * to master and 0db will be stored in each CLASS + 1 as long as
  187  * chn_setvolume_matrix() or the equivalent CHN_SETVOLUME() macros is
  188  * used (see channel.c).
  189  */
  190 #define SND_VOL_C_MASTER        0
  191 #define SND_VOL_C_PCM           1
  192 #define SND_VOL_C_PCM_VAL       2
  193 #define SND_VOL_C_MAX           3
  194 
  195 #define SND_VOL_C_BEGIN         SND_VOL_C_PCM
  196 #define SND_VOL_C_END           SND_VOL_C_PCM
  197 #define SND_VOL_C_STEP          2
  198 
  199 #define SND_VOL_C_VAL(x)        ((x) + 1)
  200 
  201 #define SND_VOL_0DB_MIN         1
  202 #define SND_VOL_0DB_MAX         100
  203 
  204 #define SND_VOL_0DB_MASTER      100
  205 #define SND_VOL_0DB_PCM         45
  206 
  207 #define SND_VOL_RESOLUTION      8
  208 #define SND_VOL_FLAT            (1 << SND_VOL_RESOLUTION)
  209 
  210 #define SND_VOL_CALC_SAMPLE(x, y)       (((x) * (y)) >> SND_VOL_RESOLUTION)
  211 
  212 #define SND_VOL_CALC_VAL(x, y, z)                                       \
  213                         (((((x)[y][z] << SND_VOL_RESOLUTION) /          \
  214                          (x)[y][SND_CHN_T_VOL_0DB]) *                   \
  215                          (x)[SND_VOL_C_MASTER][z]) /                    \
  216                          (x)[SND_VOL_C_MASTER][SND_CHN_T_VOL_0DB])      \
  217 
  218 #endif  /* !_SND_MATRIX_H_ */

Cache object: 86cbcc7a0f3d80c66e9da395ba9e1f9d


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.