bgp/ncd: владение conn через NCD-handle в senders_list; call audio route persist + incoming call sound
This commit is contained in:
1 parent
b11e77e4c0
commit
b483335c06
17 files changed
+185
-48
No files matched your search
@@ -56,6 +56,7 @@ void SoundManager::shutdown() {
|
||||
if (m_engine) { ma_engine_uninit(m_engine); delete m_engine; m_engine = nullptr; }
|
||||
DEBUG_DEBUG(DEBUG_CATEGORY_GENERAL, "SoundManager: after ma_engine_uninit");
|
||||
m_initialized = false;
|
||||
m_loopName.clear();
|
||||
}
|
||||
|
||||
void SoundManager::setEnabled(bool enabled) { m_enabled = enabled; }
|
||||
@@ -151,6 +152,39 @@ void SoundManager::play(const QString& name) {
|
||||
ma_sound_start(s);
|
||||
}
|
||||
|
||||
void SoundManager::playLoop(const QString& name) {
|
||||
if (!m_enabled) return;
|
||||
if (!m_initialized) { DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "SoundManager::playLoop: not initialized"); return; }
|
||||
|
||||
EventSettings es = m_eventSettings.value(name);
|
||||
if (!es.enabled) return;
|
||||
|
||||
auto it = m_sounds.find(name);
|
||||
if (it == m_sounds.end()) {
|
||||
DEBUG_WARN(DEBUG_CATEGORY_DEBUG, "SoundManager::playLoop: sound '%s' not loaded", qPrintable(name));
|
||||
return;
|
||||
}
|
||||
|
||||
ma_sound* s = it->sound;
|
||||
ma_sound_stop(s);
|
||||
ma_sound_seek_to_pcm_frame(s, 0);
|
||||
ma_sound_set_volume(s, m_volume * es.volume);
|
||||
ma_sound_set_looping(s, MA_TRUE);
|
||||
ma_sound_start(s);
|
||||
m_loopName = name;
|
||||
}
|
||||
|
||||
void SoundManager::stopLoop() {
|
||||
if (m_loopName.isEmpty()) return;
|
||||
auto it = m_sounds.find(m_loopName);
|
||||
m_loopName.clear();
|
||||
if (it == m_sounds.end()) return;
|
||||
ma_sound* s = it->sound;
|
||||
ma_sound_stop(s);
|
||||
ma_sound_set_looping(s, MA_FALSE);
|
||||
ma_sound_seek_to_pcm_frame(s, 0);
|
||||
}
|
||||
|
||||
ma_context* SoundManager::context() {
|
||||
return m_context;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user