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

Method Sound_Play

Source/PC/Sound_PC.cpp:123–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void cSound_PC::Sound_Play( int16 pTileset, int16 pSoundEffect, int16 pVolume, int16 pIndex) {
124 sChunkPlaying Playing;
125 auto eax = word_42316[pTileset][pSoundEffect];
126 if (!eax || !eax->size() || mSound == false )
127 return;
128
129 SDL_RWops *rw = SDL_RWFromMem( eax->data(), (int) eax->size() );
130
131 Playing.mCurrentChunk = Mix_LoadWAV_RW( rw, 1 );
132 Playing.mChannel = Mix_PlayChannel( -1, Playing.mCurrentChunk , 0 );
133 Mix_Volume(Playing.mChannel, pVolume );
134
135 if (Playing.mChannel == -1) {
136 Mix_FreeChunk( Playing.mCurrentChunk );
137 return;
138 }
139
140 mMixerChunks.push_back( Playing );
141}
142
143void cSound_PC::Music_PlayFile( const std::string& pFilename ) {
144

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected