MCPcopy Create free account
hub / github.com/EasyRPG/Player / Create

Method Create

src/audio_secache.cpp:71–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71std::unique_ptr<AudioSeCache> AudioSeCache::Create(Filesystem_Stream::InputStream stream, std::string_view name) {
72 auto se = std::make_unique<AudioSeCache>();
73 se->name = ToString(name);
74
75 auto const it = cache.find(ToString(name));
76 if (it == cache.end()) {
77 // Not in cache
78 if (!stream) {
79 return {};
80 }
81
82 se->audio_decoder = AudioDecoder::Create(stream, false);
83
84 if (se->audio_decoder) {
85 if (!se->audio_decoder->Open(std::move(stream))) {
86 se->audio_decoder.reset();
87 }
88 }
89
90 if (!se->audio_decoder) {
91 return {};
92 }
93 }
94
95 return se;
96}
97
98void AudioSeCache::GetFormat(int& frequency, AudioDecoder::Format& format, int& channels) const {
99 if (!audio_decoder) {

Callers

nothing calls this directly

Calls 3

endMethod · 0.45
OpenMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected