Advertisement
Guest User

top_block.cpp

a guest
Aug 13th, 2017
365
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.20 KB | None | 0 0
  1. /********************
  2. GNU Radio C++ Flow Graph Source File
  3.  
  4. Title: top_block
  5. Generated: Sun Aug 13 21:45:51 2017
  6. ********************/
  7.  
  8. #include "tb.hpp"
  9.  
  10. using namespace gr;
  11.  
  12.  
  13. tb::tb () : top_block("top_block") {
  14.  
  15.  
  16.  
  17. // Variables:
  18.     self.samp_rate = samp_rate = 32000
  19.  
  20. // Blocks:
  21.     this->blocks_throttle_0 = blocks::throttle::make(gr.sizeof_gr_complex*1, samp_rate, True);
  22.     this->blocks_null_sink_0 = blocks::null_sink::make(gr.sizeof_gr_complex*1);
  23.     this->analog_sig_source_x_0 = analog::sig_source_c::make(samp_rate, analog.GR_SIN_WAVE, 1000, 1, 0);
  24.  
  25. // Connections:
  26.     this->connect((this->analog_sig_source_x_0, 'out0'), (this->blocks_throttle_0, 'in0'));
  27.     this->connect((this->blocks_throttle_0, 'out0'), (this->blocks_null_sink_0, 'in0'));
  28. }
  29.  
  30. tb::~tb () {
  31. }
  32.  
  33. // Callbacks:
  34. tb::get_samp_rate () const {
  35.     return this->samp_rate;
  36. }
  37.  
  38. void tb::set_samp_rate (samp_rate) {
  39.     this->samp_rate = samp_rate;
  40.     this->analog_sig_source_x_0.set_sampling_freq(this->samp_rate);
  41.     this->blocks_throttle_0.set_sample_rate(this->samp_rate);
  42. }
  43.  
  44. int main (int argc, char **argv) {
  45.  
  46.     tb = new tb();
  47.     tb->start();
  48.     tb->stop();
  49.     tb->wait();
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement