/* Audio File Library Copyright (C) 2001, Silicon Graphics, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ /* testfloat.c This program tests floating-point reading and writing for the AIFF-C, WAVE, NeXT .snd, and IRCAM file formats. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "TestUtilities.h" static char sTestFileName[PATH_MAX]; const float samples[] = {1.0, 0.6, -0.3, 0.95, 0.2, -0.6, 0.9, 0.4, -0.22, 0.125, 0.1, -0.4}; #define SAMPLE_COUNT (sizeof (samples) / sizeof (float)) void testfloat (int fileFormat); void cleanup (void) { unlink(sTestFileName); } void ensure (int condition, const char *message) { if (!condition) { printf("%s.\n", message); cleanup(); exit(EXIT_FAILURE); } } int main (int argc, char **argv) { /* These file formats support floating-point audio data. */ int fileFormatCount = 4; int fileFormats[] = {AF_FILE_AIFFC, AF_FILE_WAVE, AF_FILE_NEXTSND, AF_FILE_IRCAM}; char *formatNames[] = {"AIFF-C", "WAVE", "NeXT .snd", "IRCAM"}; int i; for (i=0; i