MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MainLoop

Method MainLoop

src/sound/allegro_s.cpp:27–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static int _buffer_size;
26
27void 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

Callers

nothing calls this directly

Calls 1

MxMixSamplesFunction · 0.85

Tested by

no test coverage detected