2 ** Copyright (C) 2006-2009 Erik de Castro Lopo <erikd@mega-nerd.com>
4 ** This program is free software; you can redistribute it and/or modify
5 ** it under the terms of the GNU General Public License as published by
6 ** the Free Software Foundation; either version 2 of the License, or
7 ** (at your option) any later version.
9 ** This program is distributed in the hope that it will be useful,
10 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ** GNU General Public License for more details.
14 ** You should have received a copy of the GNU General Public License
15 ** along with this program; if not, write to the Free Software
16 ** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
33 #define BUFFER_LEN (1024 * 1024)
34 #define BUFFER_COUNT (768)
36 static void largefile_test (int filetype, const char * filename) ;
41 largefile_test (SF_FORMAT_WAV, "largefile.wav") ;
42 largefile_test (SF_FORMAT_AIFF, "largefile.aiff") ;
48 largefile_test (int filetype, const char * filename)
49 { static float data [BUFFER_LEN] ;
54 print_test_name ("largefile_test", filename) ;
56 sfinfo.samplerate = 44100 ;
59 sfinfo.format = (filetype | SF_FORMAT_PCM_32) ;
61 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
63 for (k = 0 ; k < BUFFER_COUNT ; k++)
64 test_write_float_or_die (file, k, data, BUFFER_LEN, __LINE__) ;
68 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
70 if ((sfinfo.frames * sfinfo.channels) / BUFFER_LEN != BUFFER_COUNT)
71 { printf ("\n\nLine %d : bad frame count.\n", __LINE__) ;
82 } /* largefile_test */