Debian Codegraph @

libmve/movie_sound.cpp

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Descent Developers
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include <functional>
20 #include "movie_sound.h"cxx . . $ `<file>/libmve/movie_sound.h`/
21
22 namespace D3cxx . . $ D3/ {
23
24 MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::MovieSoundDevicecxx . . $ D3/MovieSoundDevice#MovieSoundDevice(48b93216585987e2).(int sample_rate, uint16_tcxx . . $ uint16_t# sample_size, uint8_tcxx . . $ uint8_t# channels, uint32_tcxx . . $ uint32_t# buf_size,
25 bool is_compressed) {
26 SDL_AudioFormat format = (sample_size == 2) ? AUDIO_S16LSBcxx . . $ `<external>/178947386371380387/SDL_audio.h:94:9`! : AUDIO_U8cxx . . $ `<external>/178947386371380387/SDL_audio.h:91:9`!;
27 SDL_AudioSpec spec;
28 spec.freq = sample_rate;
29 spec.format = format;
30 spec.channels = channels;
31 spec.size = buf_size;
32 spec.callback = nullptr;
33 spec.userdata = this;
34
35 m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id. = SDL_OpenAudioDevice(nullptr, 0, &spec, nullptr, 0);
36 m_is_compressedcxx . . $ D3/ISoundDevice#m_is_compressed. = is_compressed;
37 m_sample_sizecxx . . $ D3/MovieSoundDevice#m_sample_size. = sample_size;
38 };
39
40 MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::~cxx . . $ D3/MovieSoundDevice#`~MovieSoundDevice`(ced63f7c635d850d).MovieSoundDevicecxx . . $ D3/MovieSoundDevice#() {
41 if (m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id. > 0) {
42 SDL_CloseAudioDevice(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id.);
43 m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id. = 0;
44 }
45 }
46
47 void MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::FillBuffercxx . . $ D3/MovieSoundDevice#FillBuffer(4c1d9d34c3551872).(char *stream, int len) const {
48 SDL_QueueAudio(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id., stream, len);
49 };
50
51 void MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::Playcxx . . $ D3/MovieSoundDevice#Play(49f6e7a06ebc5aa8).() { SDL_PauseAudioDevice(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id., 0); }
52
53 void MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::Stopcxx . . $ D3/MovieSoundDevice#Stop(49f6e7a06ebc5aa8).() { SDL_PauseAudioDevice(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id., 1); }
54
55 void MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::Lockcxx . . $ D3/MovieSoundDevice#Lock(49f6e7a06ebc5aa8).() { SDL_LockAudioDevice(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id.); }
56
57 void MovieSoundDevicecxx . . $ D3/MovieSoundDevice#::Unlockcxx . . $ D3/MovieSoundDevice#Unlock(49f6e7a06ebc5aa8).() { SDL_UnlockAudioDevice(m_device_idcxx . . $ D3/MovieSoundDevice#m_device_id.); }
58
59 } // namespace D3