MCPcopy Create free account
hub / github.com/SFML/SFML / openFromFile

Method openFromFile

src/SFML/Audio/OutputSoundFile.cpp:54–79  ·  view source on GitHub ↗

///////////////////////////////////////////////////////

Source from the content-addressed store, hash-verified

52
53////////////////////////////////////////////////////////////
54bool OutputSoundFile::openFromFile(const std::filesystem::path& filename,
55 unsigned int sampleRate,
56 unsigned int channelCount,
57 const std::vector<SoundChannel>& channelMap)
58{
59 // If the file is already open, first close it
60 close();
61
62 // Find a suitable writer for the file type
63 m_writer = SoundFileFactory::createWriterFromFilename(filename);
64 if (!m_writer)
65 {
66 // Error message generated in called function.
67 return false;
68 }
69
70 // Pass the stream to the reader
71 if (!m_writer->open(filename, sampleRate, channelCount, channelMap))
72 {
73 err() << "Failed to open output sound file from file (writer open failure)" << std::endl;
74 close();
75 return false;
76 }
77
78 return true;
79}
80
81
82////////////////////////////////////////////////////////////

Callers

nothing calls this directly

Calls 2

closeFunction · 0.85
openMethod · 0.45

Tested by

no test coverage detected