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

Function isUncompressed

source/core/StarAudio.cpp:61–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59 }
60
61 bool isUncompressed(IODevicePtr device) {
62 const size_t sigLength = 4;
63 unique_ptr<char[]> riffSig(new char[sigLength + 1]()); // RIFF\0
64 unique_ptr<char[]> waveSig(new char[sigLength + 1]()); // WAVE\0
65
66 StreamOffset previousOffset = device->pos();
67 device->seek(0);
68 device->readFull(riffSig.get(), sigLength);
69 device->seek(4, IOSeek::Relative);
70 device->readFull(waveSig.get(), sigLength);
71 device->seek(previousOffset);
72 if (strcmp(riffSig.get(), "RIFF") == 0 && strcmp(waveSig.get(), "WAVE") == 0) { // bytes are magic
73 return true;
74 }
75 return false;
76 }
77
78 WaveData parseWav(IODevicePtr device) {
79 const size_t sigLength = 4;

Callers 1

AudioMethod · 0.85

Calls 4

readFullMethod · 0.80
posMethod · 0.45
seekMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected