De-template FIFO.

This commit is contained in:
Jared Boone 2016-03-27 22:39:42 -07:00
parent 59f1a32566
commit f94938db8e
3 changed files with 13 additions and 8 deletions

View File

@ -38,7 +38,7 @@ using namespace hackrf::one;
class StreamOutput {
public:
StreamOutput(
FIFO<uint8_t, 13>* const fifo
FIFO<uint8_t>* const fifo
) : fifo { fifo }
{
}
@ -52,7 +52,7 @@ public:
}
private:
FIFO<uint8_t, 13>* const fifo;
FIFO<uint8_t>* const fifo;
};
class AudioThread {
@ -96,7 +96,7 @@ private:
while( !chThdShouldTerminate() ) {
// SUCH A HACK!!!
auto fifo = reinterpret_cast<FIFO<uint8_t, 13>*>(shared_memory.FIFO_HACK);
auto fifo = reinterpret_cast<FIFO<uint8_t>*>(shared_memory.FIFO_HACK);
if( !fifo ) {
break;
}

View File

@ -54,7 +54,7 @@ private:
IIRBiquadFilter deemph;
FMSquelch squelch;
StreamInput stream;
StreamInput stream { 13 };
AudioStatsCollector audio_stats;

View File

@ -32,10 +32,13 @@
class StreamInput {
public:
StreamInput() : fifo { std::make_unique<FIFO<uint8_t, 13>>() }
StreamInput(const size_t K) :
K { K },
data { std::make_unique<uint8_t[]>(1UL << K) },
fifo { data.get(), K }
{
// TODO: Send stream creation message.
shared_memory.FIFO_HACK = fifo.get();
shared_memory.FIFO_HACK = &fifo;
}
~StreamInput() {
@ -44,11 +47,13 @@ public:
}
size_t write(const void* const data, const size_t length) {
return fifo->in(reinterpret_cast<const uint8_t*>(data), length);
return fifo.in(reinterpret_cast<const uint8_t*>(data), length);
}
private:
std::unique_ptr<FIFO<uint8_t, 13>> fifo;
const size_t K;
std::unique_ptr<uint8_t[]> data;
FIFO<uint8_t> fifo;
};
#endif/*__STREAM_INPUT_H__*/