MCPcopy Create free account
hub / github.com/bbc/audiowaveform / createAudioFileReader

Function createAudioFileReader

src/OptionHandler.cpp:54–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52//------------------------------------------------------------------------------
53
54static std::unique_ptr<AudioFileReader> createAudioFileReader(
55 const boost::filesystem::path& input_filename,
56 const FileFormat::FileFormat input_format,
57 const Options& options)
58{
59 std::unique_ptr<AudioFileReader> reader;
60
61 if (input_format == FileFormat::Wav ||
62 input_format == FileFormat::Flac ||
63 input_format == FileFormat::Ogg ||
64 input_format == FileFormat::Opus) {
65 reader.reset(new SndFileAudioFileReader);
66 }
67 else if (input_format == FileFormat::Mp3) {
68 reader.reset(new Mp3AudioFileReader);
69 }
70 else if (input_format == FileFormat::Raw) {
71 SndFileAudioFileReader* sndfile_audio_file_reader = new SndFileAudioFileReader;
72 reader.reset(sndfile_audio_file_reader);
73
74 sndfile_audio_file_reader->configure(
75 options.getRawAudioChannels(),
76 options.getRawAudioSampleRate(),
77 options.getRawAudioFormat()
78 );
79 }
80 else {
81 throwError("Unknown file type: %1%", input_filename);
82 }
83
84 return reader;
85}
86
87//------------------------------------------------------------------------------
88

Callers 4

getDurationFunction · 0.85
convertAudioFormatMethod · 0.85
generateWaveformDataMethod · 0.85
renderWaveformImageMethod · 0.85

Calls 5

resetMethod · 0.80
configureMethod · 0.80
getRawAudioChannelsMethod · 0.80
getRawAudioSampleRateMethod · 0.80
throwErrorFunction · 0.70

Tested by

no test coverage detected