diff options
Diffstat (limited to 'gr-uhd/lib/usrp_sink_impl.cc')
-rw-r--r-- | gr-uhd/lib/usrp_sink_impl.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gr-uhd/lib/usrp_sink_impl.cc b/gr-uhd/lib/usrp_sink_impl.cc index 6288b80cc8..4e2e9467dd 100644 --- a/gr-uhd/lib/usrp_sink_impl.cc +++ b/gr-uhd/lib/usrp_sink_impl.cc @@ -141,12 +141,16 @@ namespace gr { void usrp_sink_impl::set_normalized_gain(double norm_gain, size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + _dev->set_normalized_tx_gain(norm_gain, chan); +#else if (norm_gain > 1.0 || norm_gain < 0.0) { throw std::runtime_error("Normalized gain out of range, must be in [0, 1]."); } ::uhd::gain_range_t gain_range = get_gain_range(chan); double abs_gain = (norm_gain * (gain_range.stop() - gain_range.start())) + gain_range.start(); set_gain(abs_gain, chan); +#endif } double @@ -166,6 +170,9 @@ namespace gr { double usrp_sink_impl::get_normalized_gain(size_t chan) { +#ifdef UHD_USRP_MULTI_USRP_NORMALIZED_GAIN + return _dev->get_normalized_tx_gain(chan); +#else ::uhd::gain_range_t gain_range = get_gain_range(chan); double norm_gain = (get_gain(chan) - gain_range.start()) / @@ -174,6 +181,7 @@ namespace gr { if (norm_gain > 1.0) return 1.0; if (norm_gain < 0.0) return 0.0; return norm_gain; +#endif } std::vector<std::string> @@ -329,9 +337,11 @@ namespace gr { } //send all ninput_items with metadata + boost::this_thread::disable_interruption disable_interrupt; const size_t num_sent = _tx_stream->send( input_items, ninput_items, _metadata, 1.0 ); + boost::this_thread::restore_interruption restore_interrupt(disable_interrupt); //if using length_tags, decrement items left to send by the number of samples sent if(not pmt::is_null(_length_tag_key) && _nitems_to_send > 0) { |