mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2024-12-27 11:28:29 +01:00
Tuned rtaudio sink
This commit is contained in:
parent
127d6bf0a7
commit
49cf3af769
@ -40,6 +40,8 @@ public:
|
|||||||
if (info.isDefaultOutput) { devId = devList.size(); }
|
if (info.isDefaultOutput) { devId = devList.size(); }
|
||||||
devList.push_back(info);
|
devList.push_back(info);
|
||||||
deviceIds.push_back(i);
|
deviceIds.push_back(i);
|
||||||
|
txtDevList += info.name;
|
||||||
|
txtDevList += '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,15 +68,15 @@ public:
|
|||||||
void menuHandler() {
|
void menuHandler() {
|
||||||
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
float menuWidth = ImGui::GetContentRegionAvailWidth();
|
||||||
|
|
||||||
// ImGui::SetNextItemWidth(menuWidth);
|
ImGui::SetNextItemWidth(menuWidth);
|
||||||
// if (ImGui::Combo(("##_rtaudio_sink_dev_"+_streamName).c_str(), &devListId, txtDevList.c_str())) {
|
if (ImGui::Combo(("##_rtaudio_sink_dev_"+_streamName).c_str(), &devId, txtDevList.c_str())) {
|
||||||
// // TODO: Load SR from config
|
// TODO: Load SR from config
|
||||||
// if (running) {
|
if (running) {
|
||||||
// doStop();
|
doStop();
|
||||||
// doStart();
|
doStart();
|
||||||
// }
|
}
|
||||||
// // TODO: Save to config
|
// TODO: Save to config
|
||||||
// }
|
}
|
||||||
|
|
||||||
// AudioDevice_t* dev = devices[devListId];
|
// AudioDevice_t* dev = devices[devListId];
|
||||||
|
|
||||||
@ -95,7 +97,7 @@ private:
|
|||||||
parameters.deviceId = deviceIds[devId];
|
parameters.deviceId = deviceIds[devId];
|
||||||
parameters.nChannels = 2;
|
parameters.nChannels = 2;
|
||||||
unsigned int sampleRate = 48000;
|
unsigned int sampleRate = 48000;
|
||||||
unsigned int bufferFrames = sampleRate / 200;
|
unsigned int bufferFrames = sampleRate / 60;
|
||||||
RtAudio::StreamOptions opts;
|
RtAudio::StreamOptions opts;
|
||||||
opts.flags = RTAUDIO_MINIMIZE_LATENCY;
|
opts.flags = RTAUDIO_MINIMIZE_LATENCY;
|
||||||
|
|
||||||
@ -108,7 +110,10 @@ private:
|
|||||||
}
|
}
|
||||||
catch ( RtAudioError& e ) {
|
catch ( RtAudioError& e ) {
|
||||||
spdlog::error("Could not open audio device");
|
spdlog::error("Could not open audio device");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spdlog::info("RtAudio stream open");
|
||||||
}
|
}
|
||||||
|
|
||||||
void doStop() {
|
void doStop() {
|
||||||
@ -120,7 +125,7 @@ private:
|
|||||||
audio.stopStream();
|
audio.stopStream();
|
||||||
audio.closeStream();
|
audio.closeStream();
|
||||||
monoPacker.out.clearReadStop();
|
monoPacker.out.clearReadStop();
|
||||||
stereoPacker.out.clearWriteStop();
|
stereoPacker.out.clearReadStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData) {
|
static int callback( void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames, double streamTime, RtAudioStreamStatus status, void *userData) {
|
||||||
|
Loading…
Reference in New Issue
Block a user