[3327] | 1 | //channels.c: |
---|
| 2 | |
---|
| 3 | /* |
---|
| 4 | * Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2010 |
---|
| 5 | * |
---|
| 6 | * This file is part of libroardsp a 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 General Public License version 3 |
---|
| 12 | * as published by the Free Software Foundation. |
---|
| 13 | * |
---|
| 14 | * libroardsp 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 General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU 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 | */ |
---|
| 24 | |
---|
| 25 | #include "libroardsp.h" |
---|
| 26 | |
---|
[3328] | 27 | static struct { |
---|
| 28 | int id; |
---|
| 29 | char * name; |
---|
| 30 | char * sn; |
---|
| 31 | } _g_chans[] = { |
---|
| 32 | {ROARDSP_CHAN_NONE, "NONE", "NONE" }, |
---|
| 33 | {ROARDSP_CHAN_FRONT_LEFT, "FRONT_LEFT", "FL" }, |
---|
| 34 | {ROARDSP_CHAN_FRONT_RIGHT, "FRONT_RIGHT", "FR" }, |
---|
| 35 | {ROARDSP_CHAN_SIDE_LEFT, "SIDE_LEFT", "SL" }, |
---|
| 36 | {ROARDSP_CHAN_SIDE_RIGHT, "SIDE_RIGHT", "SR" }, |
---|
| 37 | {ROARDSP_CHAN_BACK_LEFT, "BACK_LEFT", "BL" }, |
---|
| 38 | {ROARDSP_CHAN_BACK_RIGHT, "BACK_RIGHT", "BR" }, |
---|
| 39 | {ROARDSP_CHAN_FRONT_CENTER, "FRONT_CENTER", "FC" }, |
---|
| 40 | {ROARDSP_CHAN_SIDE_CENTER, "SIDE_CENTER", "SC" }, |
---|
| 41 | {ROARDSP_CHAN_BACK_CENTER, "BACK_CENTER", "BC" }, |
---|
| 42 | {ROARDSP_CHAN_LEFT, "LEFT", "L" }, // alias |
---|
| 43 | {ROARDSP_CHAN_RIGHT, "RIGHT", "R" }, // alias |
---|
| 44 | {ROARDSP_CHAN_CENTER, "CENTER", "C" }, // alias |
---|
| 45 | {ROARDSP_CHAN_MONO, "MONO", "M" }, // alias |
---|
| 46 | {ROARDSP_CHAN_MS_MID, "MS_MID", "MID" }, |
---|
| 47 | {ROARDSP_CHAN_MS_SIDE, "MS_SIDE", "SIDE" }, |
---|
| 48 | {ROARDSP_CHAN_LFE, "LFE", "LFE" }, |
---|
| 49 | {ROARDSP_CHAN_EOL, NULL, NULL} |
---|
| 50 | }; |
---|
| 51 | |
---|
| 52 | char * roardsp_chan2str (int chan) { |
---|
| 53 | int i; |
---|
| 54 | |
---|
| 55 | for (i = 0; _g_chans[i].id != ROARDSP_CHAN_EOL; i++) |
---|
| 56 | if ( _g_chans[i].id == chan ) |
---|
| 57 | return _g_chans[i].name; |
---|
| 58 | |
---|
| 59 | return NULL; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | int roardsp_str2chan(char * str) { |
---|
| 63 | int i; |
---|
| 64 | |
---|
| 65 | for (i = 0; _g_chans[i].id != ROARDSP_CHAN_EOL; i++) |
---|
| 66 | if ( !strcasecmp(_g_chans[i].name, str) || !strcasecmp(_g_chans[i].sn, str) ) |
---|
| 67 | return _g_chans[i].id; |
---|
| 68 | |
---|
| 69 | return -1; |
---|
| 70 | } |
---|
[3327] | 71 | |
---|
| 72 | //ll |
---|