| 52 | //------------------------------------------------------------------------------ |
| 53 | |
| 54 | static 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 |
no test coverage detected