summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/complex_to_interleaved_char_impl.h
diff options
context:
space:
mode:
authorghostop14 <ghostop14@gmail.com>2020-02-15 18:07:35 -0500
committerMichael Dickens <michael.dickens@ettus.com>2020-02-20 09:08:11 -0500
commit458414c7b2ab93fa1a6d130fa64d907dd9fca5f0 (patch)
tree95d0b94f17c4a5396756150558b922e0a240fb01 /gr-blocks/lib/complex_to_interleaved_char_impl.h
parent5cd7b4cd472e9dca41f19e2cdfed4393374c9fe0 (diff)
gr-blocks: Add scaling option to Complex to/from ishort and ichar
The existing block combinations of complex-to-ichar/ichar-to-complex and complex-to-ishort/ishort-to-complex was not exposing a scale factor to the UI (it was hard-coded at 1.0) which prevented the blocks from being used with voltage-based inputs and outputs, for example a -127 to 127 byte input would be mapped directly to the same value as a float. The same was true in reverse and there were notes in the code about FIX clipping. Adding the scale factor provides a mechanism for the user to appropriately fix the clipping and scale the conversion correctly. Additional documentation was added to the block yml to provide guidance to users on how to appropriately select the scale factor for their use case, and the default value was set to 1.0 for backward compatibility.
Diffstat (limited to 'gr-blocks/lib/complex_to_interleaved_char_impl.h')
-rw-r--r--gr-blocks/lib/complex_to_interleaved_char_impl.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/gr-blocks/lib/complex_to_interleaved_char_impl.h b/gr-blocks/lib/complex_to_interleaved_char_impl.h
index 3070d3fb9c..2e7e3c68bd 100644
--- a/gr-blocks/lib/complex_to_interleaved_char_impl.h
+++ b/gr-blocks/lib/complex_to_interleaved_char_impl.h
@@ -19,10 +19,13 @@ namespace blocks {
class BLOCKS_API complex_to_interleaved_char_impl : public complex_to_interleaved_char
{
private:
+ float d_scalar;
bool d_vector;
public:
- complex_to_interleaved_char_impl(bool vector);
+ complex_to_interleaved_char_impl(bool vector, float scale_factor);
+
+ virtual void set_scale_factor(float new_value) { d_scalar = new_value; };
int work(int noutput_items,
gr_vector_const_void_star& input_items,