/* 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. */ /* testdouble.c This program tests double-precision floating-point reading and writing for the AIFF-C, WAVE, and NeXT .snd file formats. */ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "TestUtilities.h" static char sTestFileName[PATH_MAX]; const double 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}; const int SAMPLE_COUNT = sizeof (samples) / sizeof (samples[0]); void testdouble (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 double-precision floating-point audio data. */ const int fileFormats[] = { AF_FILE_AIFFC, AF_FILE_WAVE, AF_FILE_NEXTSND }; const int fileFormatCount = sizeof (fileFormats) / sizeof (fileFormats[0]); int i; for (i=0; i