Audacious  $Id:Doxyfile42802007-03-2104:39:00Znenolod$
audio.h
Go to the documentation of this file.
00001 /*
00002  * audio.h
00003  * Copyright 2009-2011 John Lindgren
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions are met:
00007  *
00008  * 1. Redistributions of source code must retain the above copyright notice,
00009  *    this list of conditions, and the following disclaimer.
00010  *
00011  * 2. Redistributions in binary form must reproduce the above copyright notice,
00012  *    this list of conditions, and the following disclaimer in the documentation
00013  *    provided with the distribution.
00014  *
00015  * This software is provided "as is" and without any warranty, express or
00016  * implied. In no event shall the authors be liable for any damages arising from
00017  * the use of this software.
00018  */
00019 
00020 #ifndef LIBAUDCORE_AUDIO_H
00021 #define LIBAUDCORE_AUDIO_H
00022 
00023 /* 24-bit integer samples are padded to 32-bit; high byte is always 0 */
00024 enum {
00025  FMT_FLOAT,
00026  FMT_S8, FMT_U8,
00027  FMT_S16_LE, FMT_S16_BE, FMT_U16_LE, FMT_U16_BE,
00028  FMT_S24_LE, FMT_S24_BE, FMT_U24_LE, FMT_U24_BE,
00029  FMT_S32_LE, FMT_S32_BE, FMT_U32_LE, FMT_U32_BE};
00030 
00031 #if 1
00032 #define FMT_S16_NE FMT_S16_BE
00033 #define FMT_U16_NE FMT_U16_BE
00034 #define FMT_S24_NE FMT_S24_BE
00035 #define FMT_U24_NE FMT_U24_BE
00036 #define FMT_S32_NE FMT_S32_BE
00037 #define FMT_U32_NE FMT_U32_BE
00038 #else
00039 #define FMT_S16_NE FMT_S16_LE
00040 #define FMT_U16_NE FMT_U16_LE
00041 #define FMT_S24_NE FMT_S24_LE
00042 #define FMT_U24_NE FMT_U24_LE
00043 #define FMT_S32_NE FMT_S32_LE
00044 #define FMT_U32_NE FMT_U32_LE
00045 #endif
00046 
00047 #define FMT_SIZEOF(f) ((f) == FMT_FLOAT ? sizeof (float) : (f) <= FMT_U8 ? 1 : (f) <= FMT_U16_BE ? 2 : 4)
00048 
00049 void audio_from_int (const void * in, int format, float * out, int samples);
00050 void audio_to_int (const float * in, void * out, int format, int samples);
00051 void audio_amplify (float * data, int channels, int frames, float * factors);
00052 
00053 #endif /* LIBAUDCORE_AUDIO_H */