mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2025-07-03 02:05:16 -04:00
Show stereo in vis output
This commit is contained in:
parent
591b03dc7d
commit
b69f90b17b
@ -8,8 +8,8 @@
|
||||
|
||||
DemodulatorThread::DemodulatorThread(DemodulatorThreadPostInputQueue* pQueue, DemodulatorThreadControlCommandQueue *threadQueueControl,
|
||||
DemodulatorThreadCommandQueue* threadQueueNotify) :
|
||||
postInputQueue(pQueue), visOutQueue(NULL), audioInputQueue(NULL), agc(NULL), stereo(false), terminated(false), threadQueueNotify(threadQueueNotify), threadQueueControl(
|
||||
threadQueueControl), squelch_level(0), squelch_tolerance(0), squelch_enabled(false) {
|
||||
postInputQueue(pQueue), visOutQueue(NULL), audioInputQueue(NULL), agc(NULL), stereo(false), terminated(false), threadQueueNotify(
|
||||
threadQueueNotify), threadQueueControl(threadQueueControl), squelch_level(0), squelch_tolerance(0), squelch_enabled(false) {
|
||||
|
||||
float kf = 0.5; // modulation factor
|
||||
fdem = freqdem_create(kf);
|
||||
@ -179,7 +179,21 @@ void DemodulatorThread::threadMain() {
|
||||
ati_vis->channels = 1;
|
||||
|
||||
int num_vis = DEMOD_VIS_SIZE;
|
||||
if (stereo) {
|
||||
|
||||
int stereoSize = resampled_audio_output.size();
|
||||
if (stereoSize > DEMOD_VIS_SIZE) {
|
||||
stereoSize = DEMOD_VIS_SIZE;
|
||||
}
|
||||
ati_vis->data.resize(stereoSize);
|
||||
|
||||
for (int i = 0; i < stereoSize / 2; i++) {
|
||||
ati_vis->data[i] = (resampled_audio_output[i] - (resampled_audio_output_stereo[i]));
|
||||
ati_vis->data[i + stereoSize / 2] = (resampled_audio_output[i] + (resampled_audio_output_stereo[i]));
|
||||
}
|
||||
} else {
|
||||
if (num_audio_written > num_written) {
|
||||
|
||||
if (num_vis > num_audio_written) {
|
||||
num_vis = num_audio_written;
|
||||
}
|
||||
@ -191,10 +205,11 @@ void DemodulatorThread::threadMain() {
|
||||
ati_vis->data.assign(demod_output.begin(), demod_output.begin() + num_vis);
|
||||
}
|
||||
|
||||
visOutQueue->push(ati_vis);
|
||||
// std::cout << "Signal: " << agc_crcf_get_signal_level(agc) << " -- " << agc_crcf_get_rssi(agc) << "dB " << std::endl;
|
||||
}
|
||||
|
||||
visOutQueue->push(ati_vis);
|
||||
}
|
||||
if (!threadQueueControl->empty()) {
|
||||
while (!threadQueueControl->empty()) {
|
||||
DemodulatorThreadControlCommand command;
|
||||
@ -251,7 +266,6 @@ void DemodulatorThread::terminate() {
|
||||
postInputQueue->push(inp);
|
||||
}
|
||||
|
||||
|
||||
void DemodulatorThread::setStereo(bool state) {
|
||||
stereo = state;
|
||||
std::cout << "Stereo " << (state ? "Enabled" : "Disabled") << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user