Lines Matching refs:file
60 printf (" aiff - test AIFF file PEAK chunk\n") ;
61 printf (" caf - test CAF file PEAK chunk\n") ;
62 printf (" wav - test WAV file peak chunk\n") ;
116 { SNDFILE *file ;
140 /* Write a file with PEAK chunks. */
141 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, 0, __LINE__) ;
144 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
145 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
146 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
152 test_write_double_or_die (file, 0, data + count * BUFFER_LEN / 4, BUFFER_LEN / 4, BUFFER_LEN / 4) ;
154 sf_close (file) ;
156 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, 0, __LINE__) ;
164 { printf ("\n\nLine %d: Incorrect number of frames in file. (%d => %ld)\n", __LINE__, frames, (long) sfinfo.frames) ;
169 { printf ("\n\nLine %d: Incorrect number of channels in file.\n", __LINE__) ;
174 if (sf_command (file, SFC_GET_SIGNAL_MAX, data, sizeof (double)) == SF_FALSE)
184 if (sf_command (file, SFC_GET_MAX_ALL_CHANNELS, data, sizeof (double) * sfinfo.channels) == SF_FALSE)
196 sf_command (file, SFC_GET_LOG_INFO, log_buffer, LOG_BUFFER_SIZE) ;
205 sf_close (file) ;
207 /* Write a file ***without*** PEAK chunks. */
208 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, 0, __LINE__) ;
211 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
212 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
213 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_FALSE) ;
219 test_write_double_or_die (file, 0, data + count * BUFFER_LEN / 4, BUFFER_LEN / 4, BUFFER_LEN / 4) ;
221 sf_close (file) ;
223 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, 0, __LINE__) ;
226 if (sf_command (file, SFC_GET_SIGNAL_MAX, data, sizeof (double)))
231 if (sf_command (file, SFC_GET_MAX_ALL_CHANNELS, data, sizeof (double) * sfinfo.channels))
238 sf_command (file, SFC_GET_LOG_INFO, log_buffer, LOG_BUFFER_SIZE) ;
246 { printf ("\n\nLine %d: Should not have a PEAK chunk in this file.\n\n", __LINE__) ;
251 sf_close (file) ;
317 { SNDFILE *file ;
333 /* Open the file, add peak chunk and write samples with value 0.1. */
334 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_FALSE, __LINE__) ;
336 sf_command (file, SFC_SET_ADD_PEAK_CHUNK, NULL, SF_TRUE) ;
338 test_write_double_or_die (file, 0, small_data, ARRAY_LEN (small_data), __LINE__) ;
340 sf_close (file) ;
343 file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_FALSE, __LINE__) ;
348 test_write_double_or_die (file, 0, small_data, ARRAY_LEN (small_data), __LINE__) ;
350 sf_command (file, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (max_peak)) ;
352 sf_close (file) ;
356 /* Open the file and test the values written to the PEAK chunk. */
357 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_FALSE, __LINE__) ;
362 sf_command (file, SFC_GET_SIGNAL_MAX, &max_peak, sizeof (double)) ;
364 sf_close (file) ;