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

Method audioBufferFill

Source/Amiga/Sound_Amiga.cpp:86–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86void cSound_Amiga::audioBufferFill( short *pBuffer, int pBufferSize ) {
87 memset(pBuffer, 0, pBufferSize);
88
89 if (SDL_LockMutex( mLock ) == 0) {
90
91 if (mCurrentMusic && !mCurrentMusic->endOfData())
92 mCurrentMusic->readBuffer( pBuffer, pBufferSize / 2 );
93
94 if (mCurrentSfx.size()) {
95 for ( auto SfxIT : mCurrentSfx) {
96 if (!SfxIT)
97 continue;
98
99 if (!SfxIT->endOfStream())
100 SfxIT->readBuffer( pBuffer, pBufferSize / 2 );
101 }
102
103 for ( auto SfxIT = mCurrentSfx.begin(); SfxIT != mCurrentSfx.end();) {
104
105 if ((*SfxIT) && (*SfxIT)->endOfStream()) {
106 delete (*SfxIT);
107
108 *SfxIT = 0;
109 }
110
111 ++SfxIT;
112 }
113 }
114 SDL_UnlockMutex( mLock );
115 }
116}
117
118// Prepare the local audio device
119bool cSound_Amiga::devicePrepare() {

Callers 1

cSound_AudioCallbackFunction · 0.80

Calls 6

endOfDataMethod · 0.80
readBufferMethod · 0.80
endOfStreamMethod · 0.80
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected