MCPcopy Create free account
hub / github.com/audacity/audacity / open

Method open

lib-src/libscorealign/audiofilereader.cpp:56–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54
55
56bool Audio_file_reader::open(const char *filename, Scorealign &sa, bool verbose)
57{
58 bytes_per_frame = 0; // initialize now in case an error occurs
59 name[0] = 0;
60 bzero(&sf_info, sizeof(sf_info));
61 sf = sf_open(filename, SFM_READ, &sf_info);
62 if (!sf) {
63#ifdef WIN32
64 /* windows-specific code to report error opening file */
65 char *msg;
66 DWORD code = GetLastError();
67 DWORD code2 = FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
68 FORMAT_MESSAGE_FROM_SYSTEM,
69 0, code, 0, (LPSTR) &msg, 0, 0);
70 printf("Error string: %s\n", msg);
71 LocalFree(msg);
72#endif
73 return false;
74 }
75 strncpy(name, filename, MAX_NAME_LEN);
76 name[MAX_NAME_LEN] = 0; // just in case
77 total_frames = (long) sf_seek(sf, 0, SEEK_END);
78 sf_seek(sf, 0, SEEK_SET);
79 // we're going to read floats, but they might be multi-channel...
80 bytes_per_frame = sf_info.channels * sizeof(float);
81 calculate_parameters(sa, verbose);
82 return true;
83}
84
85
86void Audio_file_reader::close()

Callers 15

align_filesFunction · 0.45
archiveMethod · 0.45
checkMethod · 0.45
readf_win32Function · 0.45
writef_win32Function · 0.45
h_file_win32Function · 0.45
test_file_equalsFunction · 0.45
cached_hash_fileFunction · 0.45
make_tarfileMethod · 0.45
extract_tarMethod · 0.45
initFunction · 0.45
archiveMethod · 0.45

Calls

no outgoing calls

Tested by 6

test_file_equalsFunction · 0.36
test_file_equalsFunction · 0.36
test_file_equalsFunction · 0.36
test_file_equalsFunction · 0.36
test_file_equalsFunction · 0.36
test33Function · 0.36