MCPcopy Create free account
hub / github.com/cjcliffe/CubicSDR / buildAudioOutput

Method buildAudioOutput

src/modules/modem/ModemAnalog.cpp:67–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65}
66
67void ModemAnalog::buildAudioOutput(ModemKitAnalog *akit, AudioThreadInput *audioOut, bool autoGain) {
68 unsigned int numAudioWritten;
69
70 if (autoGain) {
71 aOutputCeilMA = aOutputCeilMA + (aOutputCeil - aOutputCeilMA) * 0.025f;
72 aOutputCeilMAA = aOutputCeilMAA + (aOutputCeilMA - aOutputCeilMAA) * 0.025f;
73 aOutputCeil = 0;
74
75 for (size_t i = 0; i < bufSize; i++) {
76 if (demodOutputData[i] > aOutputCeil) {
77 aOutputCeil = demodOutputData[i];
78 }
79 }
80
81 float gain = 0.5f / aOutputCeilMAA;
82
83 for (size_t i = 0; i < bufSize; i++) {
84 demodOutputData[i] *= gain;
85 }
86 }
87
88 msresamp_rrrf_execute(akit->audioResampler, &demodOutputData[0], (int)demodOutputData.size(), &resampledOutputData[0], &numAudioWritten);
89
90 audioOut->channels = 1;
91 audioOut->sampleRate = akit->audioSampleRate;
92 audioOut->data.assign(resampledOutputData.begin(), resampledOutputData.begin() + numAudioWritten);
93}
94
95std::vector<float> *ModemAnalog::getDemodOutputData() {
96 return &demodOutputData;

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected