MCPcopy Create free account
hub / github.com/doldecomp/mkdd / headerLoad

Method headerLoad

libs/JSystem/JAudio/System/JASAramStream.cpp:277–341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275}
276
277bool JASAramStream::headerLoad(u32 p1, int p2) {
278 if (sFatalErrorFlag) {
279 return false;
280 }
281 if (mCancelled) {
282 return false;
283 }
284 if (DVDReadPrio(&mDvdFileInfo, sReadBuffer, sizeof(Header), 0, 1) < 0) {
285#line 420
286 JUT_WARNING_F2("%s", "DVDReadPrio Failed");
287 sFatalErrorFlag = true;
288 return false;
289 }
290
291 Header *header = (Header*)sReadBuffer;
292 JUT_ASSERT(header->tag == 'STRM');
293 JUT_ASSERT(header->format <= 1);
294 JUT_ASSERT(header->bits == 16);
295 JUT_ASSERT(header->channels <= sChannelMax);
296 JUT_ASSERT(header->block_size == sBlockSize);
297 mFormat = header->format;
298 mChannelNum = header->channels;
299 mSampleRate = header->_10;
300 mLoop = header->loop != 0;
301 mLoopStart = header->loop_start;
302 mLoopEnd = header->loop_end;
303 mVolume = header->_28 / 127.0f;
304 mFreeBlockCount = 0;
305 mBlock = 0;
306 mAramBlock = 0;
307 mBlockCount = (p1 / sBlockSize) / header->channels;
308 mBufCount = mBlockCount;
309 //JUT_ASSERT(mBufCount > 0);
310 mBufCount--;
311 if (mBufCount < 3) {
312#line 448
313 JUT_WARNING_F2("%s", "Too few Buffer-Size");
314 }
315 mAramBlockCount = mBufCount;
316 u32 samples = (mLoopEnd - 1U) / getBlockSamples();
317 if (samples <= mBufCount && mLoop) {
318#line 457
319 JUT_WARNING_F2("%s", "Too few samples for Loop-buffer");
320 }
321 if (p2 < 0 || p2 > mAramBlockCount) {
322 p2 = mAramBlockCount;
323 }
324 if (mCancelled != 0) {
325 return false;
326 }
327 TaskData data;
328 data.stream = this;
329 data._4 = mAramBlockCount - 1;
330 data._8 = p2;
331 if (!sLoadThread->sendCmdMsg(firstLoadTask, &data, 0xc)) {
332#line 472
333 JUT_WARNING_F2("%s", "sendCmdMsg firstLoadTask Failed");
334 sFatalErrorFlag = true;

Callers 1

headerLoadTaskMethod · 0.80

Calls 2

DVDReadPrioFunction · 0.85
sendCmdMsgMethod · 0.80

Tested by

no test coverage detected