| 84 | } |
| 85 | |
| 86 | void 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 |
| 119 | bool cSound_Amiga::devicePrepare() { |
no test coverage detected