MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / Sound_Voc_Load

Method Sound_Voc_Load

Source/PC/Sound_PC2.cpp:141–162  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139}
140
141void cSound_PC2::Sound_Voc_Load() {
142
143 for (auto File : gSoundEffects) {
144
145 auto file = g_Resource->fileGet(File);
146
147 SDL_AudioCVT cvt;
148 SDL_BuildAudioCVT(&cvt, AUDIO_U8, 1, 8000, AUDIO_U8, 2, 22050);
149 SDL_assert(cvt.needed);
150
151 cvt.len = (int) file->size();
152 cvt.buf = (Uint8 *)SDL_malloc(cvt.len * cvt.len_mult);
153
154 memcpy(cvt.buf, file->data(), file->size());
155
156 SDL_ConvertAudio(&cvt);
157
158 Mix_Chunk* chunk = Mix_QuickLoad_RAW(cvt.buf, cvt.len_cvt);
159 mSoundEffects.push_back(chunk);
160 //SDL_free(cvt.buf);
161 }
162}
163
164// Prepare the local audio device
165bool cSound_PC2::devicePrepare() {

Callers

nothing calls this directly

Calls 3

fileGetMethod · 0.45
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected