kopia lustrzana https://github.com/markondej/fm_transmitter
Added use of native C result flags
commit
c41fa4e9ff
|
@ -83,14 +83,11 @@ int main(int argc, char** argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int result = EXIT_SUCCESS;
|
||||
|
||||
std::signal(SIGINT, sigIntHandler);
|
||||
std::signal(SIGTSTP, sigIntHandler);
|
||||
|
||||
auto finally = [&]() {
|
||||
auto temp = transmitter;
|
||||
transmitter = nullptr;
|
||||
delete temp;
|
||||
};
|
||||
try {
|
||||
transmitter = new Transmitter();
|
||||
std::cout << "Broadcasting at " << frequency << " MHz with "
|
||||
|
@ -110,10 +107,11 @@ int main(int argc, char** argv)
|
|||
} while (!stop && (optind < argc));
|
||||
} catch (std::exception &catched) {
|
||||
std::cout << "Error: " << catched.what() << std::endl;
|
||||
finally();
|
||||
return EXIT_FAILURE;
|
||||
result = EXIT_FAILURE;
|
||||
}
|
||||
finally();
|
||||
auto temp = transmitter;
|
||||
transmitter = nullptr;
|
||||
delete temp;
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -522,7 +522,7 @@ void Transmitter::TransmitViaDma(WaveReader &reader, ClockOutput &output, unsign
|
|||
for (i = 0; i < samples.size(); i++) {
|
||||
float value = samples[i].GetMonoValue();
|
||||
while (i == ((dma.GetControllBlockAddress() - allocated.GetPhysicalAddress(dmaCb)) / (2 * sizeof(DMAControllBlock)))) {
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(BUFFER_TIME / 10));
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(BUFFER_TIME / 10));
|
||||
}
|
||||
clkDiv[i] = CLK_PASSWORD | (0xffffff & (clockDivisor - static_cast<int>(round(value * divisorRange))));
|
||||
cbOffset += 2;
|
||||
|
|
Ładowanie…
Reference in New Issue