MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / Audio

Method Audio

source/core/StarAudio.cpp:513–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

511};
512
513Audio::Audio(IODevicePtr device, String name) {
514 m_name = name;
515 if (!device->isOpen())
516 device->open(IOMode::Read);
517
518 if (isUncompressed(device)) {
519 WaveData data = parseWav(device);
520 #ifdef STAR_STREAM_AUDIO
521 m_uncompressed = make_shared<UncompressedAudioImpl>(std::move(data.device), data.channels, data.sampleRate, data.dataSize);
522 #else
523 m_uncompressed = make_shared<UncompressedAudioImpl>(std::move(data.byteArray), data.channels, data.sampleRate);
524 #endif
525 } else {
526 m_compressed = make_shared<CompressedAudioImpl>(device);
527 if (!m_compressed->open())
528 throw AudioException("File does not appear to be a valid ogg bitstream");
529 }
530}
531
532Audio::Audio(Audio const& audio) {
533 *this = audio;

Callers

nothing calls this directly

Calls 4

isUncompressedFunction · 0.85
parseWavFunction · 0.85
isOpenMethod · 0.45
openMethod · 0.45

Tested by

no test coverage detected