Lines Matching refs:file

86 		printf ("           trunc   - test file truncation\n") ;
229 { SNDFILE *file ;
246 if (! (file = sf_open (filename, SFM_WRITE, &sfinfo)))
255 if ((k = (unsigned int) sf_write_float (file, float_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
261 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
263 if ((k = (unsigned int) sf_write_float (file, float_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
268 sf_close (file) ;
271 if (! (file = sf_open (filename, SFM_READ, &sfinfo)))
284 { printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
289 { printf ("Line %d: Incorrect number of channels in file.\n", __LINE__) ;
294 if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
305 /* Seek to start of file, turn normalisation off, read float_data and check again. */
306 sf_seek (file, 0, SEEK_SET) ;
307 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_FALSE) ;
309 if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
320 /* Seek to start of file, turn normalisation on, read float_data and do final check. */
321 sf_seek (file, 0, SEEK_SET) ;
322 sf_command (file, SFC_SET_NORM_FLOAT, NULL, SF_TRUE) ;
324 if ((k = (unsigned int) sf_read_float (file, float_data, BUFFER_LEN)) != BUFFER_LEN)
336 sf_close (file) ;
345 { SNDFILE *file ;
362 if (! (file = sf_open (filename, SFM_WRITE, &sfinfo)))
370 /*-sf_command (file, "set-norm-double", "true", 0) ;-*/
372 if ((k = (unsigned int) sf_write_double (file, double_data, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
378 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
380 if ((k = (unsigned int) sf_write_double (file, double_data + BUFFER_LEN / 2, BUFFER_LEN / 2)) != BUFFER_LEN / 2)
385 sf_close (file) ;
387 if (! (file = sf_open (filename, SFM_READ, &sfinfo)))
400 { printf ("\n\nLine %d: Incorrect number of.frames in file. (%d => %" PRId64 ")\n", __LINE__, BUFFER_LEN, sfinfo.frames) ;
405 { printf ("Line %d: Incorrect number of channels in file.\n", __LINE__) ;
410 if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
421 /* Seek to start of file, turn normalisation off, read double_data and check again. */
422 sf_seek (file, 0, SEEK_SET) ;
423 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_FALSE) ;
425 if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
436 /* Seek to start of file, turn normalisation on, read double_data and do final check. */
437 sf_seek (file, 0, SEEK_SET) ;
438 sf_command (file, SFC_SET_NORM_DOUBLE, NULL, SF_TRUE) ;
440 if ((k = (unsigned int) sf_read_double (file, double_data, BUFFER_LEN)) != BUFFER_LEN)
452 sf_close (file) ;
557 { SNDFILE *file ;
581 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
583 test_writef_double_or_die (file, 0, double_data, frame_count, __LINE__) ;
585 sf_close (file) ;
587 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
595 { printf ("\n\nLine %d: Incorrect number of frames in file. (%" PRId64 " => %" PRId64 ")\n", __LINE__, frame_count, sfinfo.frames) ;
600 { printf ("Line %d: Incorrect number of channels in file.\n", __LINE__) ;
604 sf_command (file, SFC_CALC_SIGNAL_MAX, &peak, sizeof (peak)) ;
610 sf_command (file, SFC_CALC_NORM_SIGNAL_MAX, &peak, sizeof (peak)) ;
616 sf_close (file) ;
628 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
630 test_writef_double_or_die (file, 0, double_data, frame_count, __LINE__) ;
632 sf_close (file) ;
634 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
642 { printf ("\n\nLine %d: Incorrect number of.frames in file. (%" PRId64 " => %" PRId64 ")\n", __LINE__, frame_count, sfinfo.frames) ;
647 { printf ("Line %d: Incorrect number of channels in file.\n", __LINE__) ;
651 sf_command (file, SFC_CALC_SIGNAL_MAX, &peak, sizeof (peak)) ;
657 sf_command (file, SFC_CALC_NORM_SIGNAL_MAX, &peak, sizeof (peak)) ;
663 sf_close (file) ;
672 { SNDFILE *file ;
682 file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
684 test_write_int_or_die (file, 0, int_data, BUFFER_LEN, __LINE__) ;
687 if (sf_command (file, SFC_FILE_TRUNCATE, &len, sizeof (len)))
692 test_seek_or_die (file, 0, SEEK_CUR, len, 2, __LINE__) ;
693 test_seek_or_die (file, 0, SEEK_END, len, 2, __LINE__) ;
695 sf_close (file) ;
748 SNDFILE *file ;
757 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
758 if (sf_command (file, SFC_SET_INSTRUMENT, &write_inst, sizeof (write_inst)) == SF_FALSE)
762 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
763 sf_close (file) ;
767 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
768 if (sf_command (file, SFC_GET_INSTRUMENT, &read_inst, sizeof (read_inst)) == SF_FALSE)
773 check_log_buffer_or_die (file, __LINE__) ;
774 sf_close (file) ;
937 SNDFILE *file ;
963 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
964 if (sf_command (file, SFC_SET_CUE, &write_cue, sizeof (write_cue)) == SF_FALSE)
968 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
969 sf_close (file) ;
973 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
974 if (sf_command (file, SFC_GET_CUE, &read_cue, sizeof (read_cue)) == SF_FALSE)
979 check_log_buffer_or_die (file, __LINE__) ;
980 sf_close (file) ;
999 SNDFILE *file ;
1023 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1024 if (sf_command (file, SFC_SET_CUE, write_cue, (int) cues_size) == SF_FALSE)
1025 { printf ("\n\nLine %d : sf_command (SFC_SET_CUE) failed with %d cues, datasize %zu --> error: %s\n\n", __LINE__, count, cues_size, sf_strerror (file)) ;
1028 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1029 sf_close (file) ;
1033 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1035 if (sf_command (file, SFC_GET_CUE, read_cue, (int) cues_size) == SF_FALSE)
1036 { printf ("\n\nLine %d : sf_command (SFC_GET_CUE) failed with %d cues, datasize %zu --> error: %s\n\n", __LINE__, count, cues_size, sf_strerror (file)) ;
1039 check_log_buffer_or_die (file, __LINE__) ;
1040 sf_close (file) ;
1080 /* Read file making sure no channel map exists. */
1103 SNDFILE *file ;
1124 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1125 if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
1129 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1130 sf_close (file) ;
1134 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1135 if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
1140 check_log_buffer_or_die (file, __LINE__) ;
1141 sf_close (file) ;
1191 SNDFILE *file ;
1210 file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
1212 if (sf_command (file, SFC_SET_BROADCAST_INFO, &binfo, sizeof (binfo)) != SF_FALSE)
1216 sf_close (file) ;
1218 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1219 sf_close (file) ;
1229 SNDFILE *file ;
1247 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1248 if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
1253 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1254 sf_close (file) ;
1258 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1259 if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
1263 check_log_buffer_or_die (file, __LINE__) ;
1264 sf_close (file) ;
1299 SNDFILE *file ;
1323 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1324 if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
1329 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1330 sf_close (file) ;
1334 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1335 if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
1339 check_log_buffer_or_die (file, __LINE__) ;
1340 sf_close (file) ;
1357 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1358 if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
1363 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1364 sf_close (file) ;
1368 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1369 if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
1374 check_log_buffer_or_die (file, __LINE__) ;
1375 sf_close (file) ;
1403 SNDFILE *file ;
1432 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1433 if (sf_command (file, SFC_SET_BROADCAST_INFO, &bc_write, sizeof (bc_write)) == SF_FALSE)
1438 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1439 sf_close (file) ;
1443 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1444 if (sf_command (file, SFC_GET_BROADCAST_INFO, &bc_read, sizeof (bc_read)) == SF_FALSE)
1448 check_log_buffer_or_die (file, __LINE__) ;
1449 sf_close (file) ;
1466 SNDFILE *file ;
1498 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1499 if (sf_command (file, SFC_SET_CART_INFO, &ca_write, sizeof (ca_write)) == SF_FALSE)
1502 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1503 sf_close (file) ;
1507 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1508 if (sf_command (file, SFC_GET_CART_INFO, &ca_read, sizeof (ca_read)) == SF_FALSE)
1513 check_log_buffer_or_die (file, __LINE__) ;
1514 sf_close (file) ;
1627 SNDFILE *file ;
1657 file = test_open_file_or_die (filename, SFM_RDWR, &sfinfo, SF_TRUE, __LINE__) ;
1659 if (sf_command (file, SFC_SET_CART_INFO, &cinfo, sizeof (cinfo)) != SF_FALSE)
1663 sf_close (file) ;
1665 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1666 sf_close (file) ;
1678 { SNDFILE *file ;
1696 /* Write file without channel map. */
1697 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1698 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1699 sf_close (file) ;
1701 /* Read file making default channel map exists. */
1702 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1704 sf_command (file, SFC_GET_CHANNEL_MAP_INFO, channel_map_read, sizeof (channel_map_read)) == SF_FALSE,
1707 check_log_buffer_or_die (file, __LINE__) ;
1708 sf_close (file) ;
1715 /* Write file with a channel map. */
1716 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1718 sf_command (file, SFC_SET_CHANNEL_MAP_INFO, channel_map_write, sizeof (channel_map_write)) == SF_FALSE,
1721 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1722 sf_close (file) ;
1724 /* Read file making sure no channel map exists. */
1725 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1727 sf_command (file, SFC_GET_CHANNEL_MAP_INFO, channel_map_read, sizeof (channel_map_read)) != SF_TRUE,
1730 check_log_buffer_or_die (file, __LINE__) ;
1731 sf_close (file) ;
1748 SNDFILE *file ;
1772 file = test_open_file_or_die (filename, SFM_WRITE, &sfinfo, SF_TRUE, __LINE__) ;
1773 test_write_double_or_die (file, 0, double_data, BUFFER_LEN, __LINE__) ;
1774 sf_close (file) ;
1777 file = test_open_file_or_die (filename, SFM_READ, &sfinfo, SF_TRUE, __LINE__) ;
1779 needs_endswap = sf_command (file, SFC_RAW_DATA_NEEDS_ENDSWAP, NULL, 0) ;
1801 sf_close (file) ;