MCPcopy Create free account
hub / github.com/OneLoneCoder/olcPixelGameEngine / LoadAudioSample

Method LoadAudioSample

extensions/olcPGEX_Sound.h:336–347  ·  view source on GitHub ↗

Load a 16-bit WAVE file @ 44100Hz ONLY into memory. A sample ID number is returned if successful, otherwise -1

Source from the content-addressed store, hash-verified

334 // Load a 16-bit WAVE file @ 44100Hz ONLY into memory. A sample ID
335 // number is returned if successful, otherwise -1
336 int SOUND::LoadAudioSample(std::string sWavFile, olc::ResourcePack *pack)
337 {
338
339 olc::SOUND::AudioSample a(sWavFile, pack);
340 if (a.bSampleValid)
341 {
342 vecAudioSamples.push_back(a);
343 return (unsigned int)vecAudioSamples.size();
344 }
345 else
346 return -1;
347 }
348
349 // Add sample 'id' to the mixers sounds to play list
350 void SOUND::PlaySample(int id, bool bLoop)

Callers

nothing calls this directly

Calls 2

push_backMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected