MCPcopy Create free account
hub / github.com/TASEmulators/fceux / FCEU_WriteWaveData

Function FCEU_WriteWaveData

src/wave.cpp:18–55  ·  view source on GitHub ↗

Checking whether the file exists before wiping it out is left up to the reader..err...I mean, the driver code, if it feels so inclined(I don't feel so). */

Source from the content-addressed store, hash-verified

16 so).
17*/
18void FCEU_WriteWaveData(int32 *Buffer, int Count)
19{
20 //mbg merge 7/17/06 changed to alloca
21 //int16 temp[Count]; /* Yay. Is this the first use of this "feature" of C in FCE Ultra? */
22 int16 *temp = (int16*)alloca(Count*2);
23
24 int16 *dest;
25 int x;
26
27#ifndef __WIN_DRIVER__
28 if(!soundlog) return;
29#else
30 if(!soundlog && !FCEUI_AviIsRecording()) return;
31#endif
32
33 dest=temp;
34 x=Count;
35
36 //mbg 7/28/06 - we appear to be guaranteeing little endian
37 while(x--)
38 {
39 int16 tmp=*Buffer;
40
41 *(uint8 *)dest=(((uint16)tmp)&255);
42 *(((uint8 *)dest)+1)=(((uint16)tmp)>>8);
43 dest++;
44 Buffer++;
45 }
46 if(soundlog)
47 wsize+=fwrite(temp,1,Count*sizeof(int16),soundlog);
48
49 #ifdef __WIN_DRIVER__
50 if(FCEUI_AviIsRecording())
51 {
52 FCEUI_AviSoundUpdate((void*)temp, Count);
53 }
54 #endif
55}
56
57int FCEUI_EndWaveRecord()
58{

Callers 1

FlushEmulateSoundFunction · 0.85

Calls 2

FCEUI_AviSoundUpdateFunction · 0.85
FCEUI_AviIsRecordingFunction · 0.50

Tested by

no test coverage detected