source/framer_noop.cpp
source/global.cpp
source/interfaces.cpp
+ source/interpolator.cpp
source/io_device.cpp
source/keying.cpp
source/keying_sink.cpp
#include <cstdint>
#include <ostream>
#include <assert.h>
+#if 0
+#include <soxr.h>
+#endif
#include "platform.h"
/// Portable way to use the [[unused]] C++11 attribute before all compilers
/// Global reference to the driver manager.
///
extern DriverManager * driver_manager();
+
+#if 0
+/// Interpolate between two sample rates.
+class Interpolator16 {
+private:
+ const std::size_t in_rate;
+ const std::size_t out_rate;
+ const unsigned int number_of_channels;
+ const soxr_io_spec_t io_spec;
+ const soxr_quality_spec_t quality_spec;
+ const soxr_runtime_spec_t runtime_spec;
+
+ // Prohibit the copy constructor and operator =().
+ Interpolator16(const Interpolator16 &);
+ Interpolator16 &
+ operator = (const Interpolator &);
+
+public
+ Interpolator16(std::size_t _in_rate, std::size_t _out_rate);
+ ~Interpolator16();
+
+ void process(
+ const std::int16_t * in,
+ std::int16_t * out,
+ std::size_t in_length,
+ std::size_t out_length);
+}
+#endif
+
}
+++ /dev/null
-#if 0
-#include <soxr.h>
-#include "drivers.h"
-
-namespace FreeDV {
- void
- Interpolate16(
- const std::int16_t * in,
- std::int16_t * out,
- std::size_t in_rate,
- std::size_t out_rate,
- std::size_t in_length,
- std::size_t out_length)
- {
- std::size_t in_done = 0;
- std::size_t out_done = 0;
- const unsigned int number_of_channels = 1;
- const soxr_io_spec_t io_spec = soxr_io_spec(SOXR_INT16_S, SOXR_INT16_S);
- const soxr_quality_spec_t quality_spec = soxr_quality_spec(
- SOXR_QQ, SOXR_NO_DITHER);
- const soxr_runtime_spec_t runtime_spec = soxr_runtime_spec(1);
-
- /// The "Gibbs effect" may be seen because I don't save data from the
- /// previous block. Fix this by making the resampler a class,
- /// instantiate it to save state, and use the iterative rather than the
- /// one-shot version.
- const soxr_error_t error = soxr_oneshot(
- in_rate,
- out_rate,
- number_of_channels, // Number of channels.
- in,
- in_length,
- &in_done,
- out,
- out_length,
- &out_done,
- io_spec,
- quality_spec,
- runtime_spec);
- }
-};
-#endif
--- /dev/null
+#include "drivers.h"
+
+#if 0
+namespace FreeDV {
+ Interpolator16::Interpolator16(std::size_t _in_rate, std::size_t _out_rate)
+ : in_rate(_in_rate), out_rate(_out_rate), number_of_channels(1),
+ io_spec(soxr_io_spec(SOXR_INT16_S, SOXR_INT16_S),
+ quality_spec(SOXR_QQ, SOXR_NO_DITHER),
+ runtime_spec(soxr_runtime_spec(1))
+ {
+ }
+
+ Interpolator16::~Interpolator16()
+ {
+ };
+
+ void
+ Interpolator16::process(
+ const std::int16_t * in,
+ std::int16_t * out,
+ std::size_t in_length,
+ std::size_t out_length)
+ {
+ std::size_t in_done = 0;
+ std::size_t out_done = 0;
+
+ // FIX: Use the state-saving version instead of the one-shot version,
+ // to prevent ringing. Is there a pipeline delay?
+
+ const soxr_error_t error = soxr_oneshot(
+ in_rate,
+ out_rate,
+ number_of_channels, // Number of channels.
+ in,
+ in_length,
+ &in_done,
+ out,
+ out_length,
+ &out_done,
+ io_spec,
+ quality_spec,
+ runtime_spec);
+ }
+};
+#endif