| 25 | static int _buffer_size; |
| 26 | |
| 27 | void SoundDriver_Allegro::MainLoop() |
| 28 | { |
| 29 | /* We haven't opened a stream yet */ |
| 30 | if (_stream == nullptr) return; |
| 31 | |
| 32 | void *data = get_audio_stream_buffer(_stream); |
| 33 | /* We don't have to fill the stream yet */ |
| 34 | if (data == nullptr) return; |
| 35 | |
| 36 | /* Mix the samples */ |
| 37 | MxMixSamples(data, _buffer_size); |
| 38 | |
| 39 | /* Allegro sound is always unsigned, so we need to correct that */ |
| 40 | uint16_t *snd = (uint16_t*)data; |
| 41 | for (int i = 0; i < _buffer_size * 2; i++) snd[i] ^= 0x8000; |
| 42 | |
| 43 | /* Tell we've filled the stream */ |
| 44 | free_audio_stream_buffer(_stream); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * There are multiple modules that might be using Allegro and |
nothing calls this directly
no test coverage detected