MCPcopy Create free account
hub / github.com/diasurgical/devilution / SFileDdaBeginEx

Function SFileDdaBeginEx

SourceX/storm/storm.cpp:83–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81}
82
83BOOL SFileDdaBeginEx(HANDLE hFile, DWORD flags, DWORD mask, unsigned __int32 lDistanceToMove,
84 signed __int32 volume, signed int pan, int a7)
85{
86 DWORD bytestoread = SFileGetFileSize(hFile, 0);
87 char *SFXbuffer = (char *)malloc(bytestoread);
88 SFileReadFile(hFile, SFXbuffer, bytestoread, NULL, NULL);
89
90 SDL_RWops *rw = SDL_RWFromConstMem(SFXbuffer, bytestoread);
91 if (rw == NULL) {
92 SDL_Log(SDL_GetError());
93 return false;
94 }
95 SFileChunk = Mix_LoadWAV_RW(rw, 1);
96 free(SFXbuffer);
97
98 Mix_Volume(0, MIX_MAX_VOLUME - MIX_MAX_VOLUME * volume / VOLUME_MIN);
99 int panned = 255 - 255 * abs(pan) / 10000;
100 Mix_SetPanning(0, pan <= 0 ? 255 : panned, pan >= 0 ? 255 : panned);
101 Mix_PlayChannel(0, SFileChunk, 0);
102
103 return true;
104}
105
106BOOL SFileDdaDestroy()
107{

Callers 1

stream_playFunction · 0.85

Calls 3

SFileGetFileSizeFunction · 0.85
SFileReadFileFunction · 0.85
SDL_LogFunction · 0.85

Tested by

no test coverage detected