kopia lustrzana https://github.com/markondej/fm_transmitter
Code simplified
rodzic
bb97176e89
commit
d7fab7646c
|
@ -352,7 +352,7 @@ Transmitter::~Transmitter() {
|
||||||
cv.wait(lock, [&]() -> bool {
|
cv.wait(lock, [&]() -> bool {
|
||||||
return !enable;
|
return !enable;
|
||||||
});
|
});
|
||||||
if (output != nullptr) {
|
if (output) {
|
||||||
delete output;
|
delete output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
|
||||||
}
|
}
|
||||||
|
|
||||||
auto finally = [&]() {
|
auto finally = [&]() {
|
||||||
if (!preserveCarrier && (output != nullptr)) {
|
if (!preserveCarrier && output) {
|
||||||
delete output;
|
delete output;
|
||||||
output = nullptr;
|
output = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -382,7 +382,7 @@ void Transmitter::Transmit(WaveReader &reader, float frequency, float bandwidth,
|
||||||
unsigned clockDivisor = static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / frequency));
|
unsigned clockDivisor = static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / frequency));
|
||||||
unsigned divisorRange = clockDivisor - static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / (frequency + 0.0005f * bandwidth)));
|
unsigned divisorRange = clockDivisor - static_cast<unsigned>(round(Peripherals::GetClockFrequency() * (0x01 << 12) / (frequency + 0.0005f * bandwidth)));
|
||||||
|
|
||||||
if (output == nullptr) {
|
if (!output) {
|
||||||
output = new ClockOutput(clockDivisor);
|
output = new ClockOutput(clockDivisor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue