This commit is contained in:
Ryzerth 2020-08-16 18:30:40 +02:00
parent cff5987329
commit e50ed1b960
2 changed files with 13 additions and 12 deletions

View File

@ -156,11 +156,11 @@ namespace io {
outputParams.suggestedLatency = Pa_GetDeviceInfo(outputParams.device)->defaultLowOutputLatency; outputParams.suggestedLatency = Pa_GetDeviceInfo(outputParams.device)->defaultLowOutputLatency;
PaError err; PaError err;
if (streamType == MONO) { if (streamType == MONO) {
err = Pa_OpenStream(&stream, NULL, &outputParams, _sampleRate, _bufferSize, NULL, err = Pa_OpenStream(&stream, NULL, &outputParams, _sampleRate, _bufferSize, 0,
(dev.channels == 2) ? _mono_to_stereo_callback : _mono_to_mono_callback, this); (dev.channels == 2) ? _mono_to_stereo_callback : _mono_to_mono_callback, this);
} }
else { else {
err = Pa_OpenStream(&stream, NULL, &outputParams, _sampleRate, _bufferSize, NULL, err = Pa_OpenStream(&stream, NULL, &outputParams, _sampleRate, _bufferSize, 0,
(dev.channels == 2) ? _stereo_to_stereo_callback : _stereo_to_mono_callback, this); (dev.channels == 2) ? _stereo_to_stereo_callback : _stereo_to_mono_callback, this);
} }

View File

@ -480,14 +480,6 @@ void drawWindow() {
spdlog::info("Changed input device: {0}", devId); spdlog::info("Changed input device: {0}", devId);
sourceName = soapy.devNameList[devId]; sourceName = soapy.devNameList[devId];
soapy.setDevice(soapy.devList[devId]); soapy.setDevice(soapy.devList[devId]);
if (soapy.gainList.size() == 0) {
return;
}
delete[] uiGains;
uiGains = new float[soapy.gainList.size()];
for (int i = 0; i < soapy.gainList.size(); i++) {
uiGains[i] = soapy.currentGains[i];
}
if (config::config["sourceSettings"].contains(sourceName)) { if (config::config["sourceSettings"].contains(sourceName)) {
loadSourceConfig(sourceName); loadSourceConfig(sourceName);
@ -499,8 +491,13 @@ void drawWindow() {
wtf.setBandwidth(sampleRate); wtf.setBandwidth(sampleRate);
wtf.setViewBandwidth(sampleRate); wtf.setViewBandwidth(sampleRate);
sigPath.setSampleRate(sampleRate); sigPath.setSampleRate(sampleRate);
for (int i = 0; i < soapy.gainList.size(); i++) {
uiGains[i] = soapy.gainRanges[i].minimum(); if (soapy.gainList.size() >= 0) {
delete[] uiGains;
uiGains = new float[soapy.gainList.size()];
for (int i = 0; i < soapy.gainList.size(); i++) {
uiGains[i] = soapy.currentGains[i];
}
} }
} }
setVFO(fSel.frequency); setVFO(fSel.frequency);
@ -594,12 +591,16 @@ void drawWindow() {
ImGui::PushItemWidth(menuColumnWidth); ImGui::PushItemWidth(menuColumnWidth);
bool running = stream->running; bool running = stream->running;
if (ImGui::Combo(("##_audio_dev_0_"+ name).c_str(), &stream->deviceId, stream->audio->devTxtList.c_str())) { if (ImGui::Combo(("##_audio_dev_0_"+ name).c_str(), &stream->deviceId, stream->audio->devTxtList.c_str())) {
spdlog::warn("Stopping audio stream");
audio::stopStream(name); audio::stopStream(name);
spdlog::warn("Setting device");
audio::setAudioDevice(name, stream->deviceId, stream->audio->devices[deviceId].sampleRates[0]); audio::setAudioDevice(name, stream->deviceId, stream->audio->devices[deviceId].sampleRates[0]);
if (running) { if (running) {
spdlog::warn("Starting stream");
audio::startStream(name); audio::startStream(name);
} }
stream->sampleRateId = 0; stream->sampleRateId = 0;
spdlog::warn("Done, saving config");
// Create config if it doesn't exist // Create config if it doesn't exist
if (!config::config["audio"].contains(name)) { if (!config::config["audio"].contains(name)) {