MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / iSndInit

Function iSndInit

src/SB/Core/gc/iSnd.cpp:517–587  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

515}
516
517void iSndInit()
518{
519 soundInited = 1;
520 AIInit(NULL);
521 ARInit(aram_array, 40);
522 ARQInit();
523 AXInit();
524 MIXInit();
525
526 for (S32 i = 0; i < 58; i++)
527 {
528 voices[i].voice = NULL;
529 voices[i].flags = 0;
530 }
531
532 for (S32 i = 0; i < 6; i++)
533 {
534 streams[i].vinf.voice = 0;
535 streams[i].vinf.flags = 0;
536 streams[i].source_a = 0;
537 streams[i].dest_a = 0;
538 streams[i].dest_b = 0;
539 streams[i].source_b = 0;
540 streams[i].xe4 = 0;
541 }
542
543 // FIXME: No idea what type this is, appears to only be used in this fuction.
544 ua_stream_buffer = (U32*)OSAllocFromHeap(the_heap, 0x18100);
545 stream_buffer = (U32*)(((U32)ua_stream_buffer + 0x1f) & ~0x1f);
546 U32* local_buffer = stream_buffer;
547 for (S32 i = 0; i < 0x100; i++)
548 {
549 local_buffer[i] = NULL;
550 }
551
552 silence_buffer = ARAlloc(0x400);
553 zero_point = silence_buffer;
554 zero_point *= 2;
555 zero_point += 2;
556 zero_end = zero_point + 0x800;
557
558 SoundFlags |= 0x1;
559
560 BOOL enabled = OSDisableInterrupts();
561 DCInvalidateRange((void*)silence_buffer, 0x400);
562 ARQRequest request;
563 ARQPostRequest(&request, 0, 0, 1, (u32)stream_buffer, silence_buffer, 0x400, arq_callback);
564 OSRestoreInterrupts(enabled);
565
566 while (SoundFlags != 0)
567 ;
568
569 char str_buf[0x20];
570 U32 r27 = 0;
571
572 struct Junk
573 {
574 U8 foo[0x4000];

Callers 1

xSndInitFunction · 0.85

Calls 11

AIInitFunction · 0.85
ARInitFunction · 0.85
ARQInitFunction · 0.85
AXInitFunction · 0.85
MIXInitFunction · 0.85
OSAllocFromHeapFunction · 0.85
ARAllocFunction · 0.85
OSDisableInterruptsFunction · 0.85
ARQPostRequestFunction · 0.85
sprintfFunction · 0.85
AXRegisterCallbackFunction · 0.85

Tested by

no test coverage detected