MCPcopy Create free account
hub / github.com/bulletphysics/bullet3 / init

Method init

examples/TinyAudio/b3SoundEngine.cpp:50–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48}
49
50void b3SoundEngine::init(int maxNumSoundSources, bool useRealTimeDac)
51{
52 for (int i = 0; i < maxNumSoundSources; i++)
53 {
54 b3SoundSource* source = new b3SoundSource();
55 m_data->m_soundSources.push_back(source);
56 m_data->m_listener.addSoundSource(source);
57 }
58
59 this->m_data->m_useRealTimeDac = useRealTimeDac;
60
61 if (useRealTimeDac)
62 {
63 RtAudioFormat format = (sizeof(double) == 8) ? RTAUDIO_FLOAT64 : RTAUDIO_FLOAT32;
64 RtAudio::StreamParameters parameters;
65 parameters.deviceId = m_data->m_dac.getDefaultOutputDevice();
66 parameters.nChannels = 2;
67
68 unsigned int bufferFrames = RT_BUFFER_SIZE;
69 double sampleRate = m_data->m_listener.getSampleRate();
70
71 m_data->m_dac.openStream(&parameters, NULL, format, (unsigned int)sampleRate, &bufferFrames, &b3AudioListener::tick,
72 (void*)m_data->m_listener.getTickData());
73
74 m_data->m_dac.startStream();
75 }
76}
77
78void b3SoundEngine::exit()
79{

Callers 3

initPhysicsMethod · 0.45
mainFunction · 0.45

Calls 7

addSoundSourceMethod · 0.80
openStreamMethod · 0.80
getTickDataMethod · 0.80
push_backMethod · 0.45
getSampleRateMethod · 0.45
startStreamMethod · 0.45

Tested by

no test coverage detected