Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
audio.h
Go to the documentation of this file.
00001 /*
00002  * audio.h
00003  * Copyright 2009 John Lindgren
00004  *
00005  * This file is part of Audacious.
00006  *
00007  * Audacious is free software: you can redistribute it and/or modify it under
00008  * the terms of the GNU General Public License as published by the Free Software
00009  * Foundation, version 2 or version 3 of the License.
00010  *
00011  * Audacious is distributed in the hope that it will be useful, but WITHOUT ANY
00012  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
00013  * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License along with
00016  * Audacious. If not, see <http://www.gnu.org/licenses/>.
00017  *
00018  * The Audacious team does not consider modular code linking to Audacious or
00019  * using our public API to be a derived work.
00020  */
00021 
00022 #ifndef AUDACIOUS_AUDIO_H
00023 #define AUDACIOUS_AUDIO_H
00024 
00025 #include <glib.h>
00026 
00027 /* 24-bit integer samples are padded to 32-bit; high byte is always 0 */
00028 enum {
00029  FMT_FLOAT,
00030  FMT_S8, FMT_U8,
00031  FMT_S16_LE, FMT_S16_BE, FMT_U16_LE, FMT_U16_BE,
00032  FMT_S24_LE, FMT_S24_BE, FMT_U24_LE, FMT_U24_BE,
00033  FMT_S32_LE, FMT_S32_BE, FMT_U32_LE, FMT_U32_BE};
00034 
00035 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
00036 #define FMT_S16_NE FMT_S16_LE
00037 #define FMT_U16_NE FMT_U16_LE
00038 #define FMT_S24_NE FMT_S24_LE
00039 #define FMT_U24_NE FMT_U24_LE
00040 #define FMT_S32_NE FMT_S32_LE
00041 #define FMT_U32_NE FMT_U32_LE
00042 #else
00043 #define FMT_S16_NE FMT_S16_BE
00044 #define FMT_U16_NE FMT_U16_BE
00045 #define FMT_S24_NE FMT_S24_BE
00046 #define FMT_U24_NE FMT_U24_BE
00047 #define FMT_S32_NE FMT_S32_BE
00048 #define FMT_U32_NE FMT_U32_BE
00049 #endif
00050 
00051 #define FMT_SIZEOF(f) \
00052  (f == FMT_FLOAT ? sizeof (gfloat) : f <= FMT_U8 ? 1 : f <= FMT_U16_BE ? 2 : 4)
00053 
00054 void audio_from_int (void * in, gint format, gfloat * out, gint samples);
00055 void audio_to_int (gfloat * in, void * out, gint format, gint samples);
00056 void audio_amplify (gfloat * data, gint channels, gint frames, gfloat * factors);
00057 
00058 #endif