fix: voice playback coordinate bug + debug logging + device name encoding
- messagedelegate: editorEvent now adjusts me->pos() by option.rect.topLeft() - voiceplayback: enhanced debug logging for file open/decode/play - messagelist: debug voice file path + exists check - inputbar: debug mediaDir path on record - sound_manager: debug in playRawPcm, decodeDeviceName() for mixed encodings - voiceencoder: debug file write path
This commit is contained in:
1 parent
324d285145
commit
01012675d0
6 files changed
+45
-9
No files matched your search
@@ -141,7 +141,11 @@ ma_context* SoundManager::context() {
|
||||
}
|
||||
|
||||
void SoundManager::playRawPcm(const int16_t* pcm, int sampleCount, int sampleRate, int channels) {
|
||||
if (!m_engine || !m_initialized) return;
|
||||
if (!m_engine || !m_initialized) {
|
||||
qWarning("SoundManager::playRawPcm: not initialized (engine=%p init=%d)", (void*)m_engine, m_initialized);
|
||||
return;
|
||||
}
|
||||
qDebug("SoundManager::playRawPcm: %d samples %dHz %dch vol=%.2f", sampleCount, sampleRate, channels, m_volume);
|
||||
|
||||
ma_audio_buffer_config bufCfg = ma_audio_buffer_config_init(
|
||||
ma_format_s16, (ma_uint32)channels, (ma_uint64)sampleCount, pcm, NULL);
|
||||
@@ -165,7 +169,14 @@ void SoundManager::playRawPcm(const int16_t* pcm, int sampleCount, int sampleRat
|
||||
|
||||
ma_sound_set_volume(sound, m_volume);
|
||||
ma_sound_start(sound);
|
||||
qDebug("SoundManager: playing PCM (%d samples, %dHz, %dch)", sampleCount, sampleRate, channels);
|
||||
qDebug("SoundManager::playRawPcm: started");
|
||||
}
|
||||
|
||||
static QString decodeDeviceName(const char* name) {
|
||||
QString s = QString::fromUtf8(name);
|
||||
if (s.contains(QChar(0xFFFD)))
|
||||
s = QString::fromLocal8Bit(name);
|
||||
return s;
|
||||
}
|
||||
|
||||
QVector<SoundManager::DeviceInfo> SoundManager::enumeratePlaybackDevices() {
|
||||
@@ -177,7 +188,7 @@ QVector<SoundManager::DeviceInfo> SoundManager::enumeratePlaybackDevices() {
|
||||
ma_uint32 count = 0;
|
||||
if (ma_context_get_devices(ctx, &pDevices, &count, nullptr, nullptr) != MA_SUCCESS) return result;
|
||||
for (ma_uint32 i = 0; i < count; i++)
|
||||
result.append({QString::fromLocal8Bit(pDevices[i].name), pDevices[i].isDefault != MA_FALSE});
|
||||
result.append({decodeDeviceName(pDevices[i].name), pDevices[i].isDefault != MA_FALSE});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -190,6 +201,6 @@ QVector<SoundManager::DeviceInfo> SoundManager::enumerateCaptureDevices() {
|
||||
ma_uint32 count = 0;
|
||||
if (ma_context_get_devices(ctx, nullptr, nullptr, &pDevices, &count) != MA_SUCCESS) return result;
|
||||
for (ma_uint32 i = 0; i < count; i++)
|
||||
result.append({QString::fromLocal8Bit(pDevices[i].name), pDevices[i].isDefault != MA_FALSE});
|
||||
result.append({decodeDeviceName(pDevices[i].name), pDevices[i].isDefault != MA_FALSE});
|
||||
return result;
|
||||
}
|
||||
Reference in new issue
Block a user