Module: Radio::Rig::SSB
- Included in:
- Radio::Rig
- Defined in:
- lib/radio/rig/ssb.rb
Instance Method Summary collapse
- #af=(output) ⇒ Object
- #initialize ⇒ Object
- #set_lsb ⇒ Object
- #set_usb ⇒ Object
- #tune=(freq) ⇒ Object
Instance Method Details
#af=(output) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/radio/rig/ssb.rb', line 27 def af= output if output and !iq? raise 'requires i/q signal' end old_af_thread = false @ssb_semaphore.synchronize do deregister @af_queue if @af_queue @af_queue = nil old_rate = 0 if @af @af.stop old_af_thread = @af_thread old_af_thread.kill if old_af_thread end if @af = output @bfo_filter = bfo_mixer @af_filter = af_generate_filter @agc = Filter.new :agc => true @iq = Filter.new :iq => true @mix = mixmix #TODO need a nicer pattern to force JIT compile @bfo_filter.call(NArray.scomplex(1)) {} @af_filter.call(NArray.sfloat(1)) {} @agc.call(NArray.sfloat(1)) {} @iq.call(NArray.scomplex(1)) {} register @af_queue = Queue.new @af_thread = Thread.new &method(:af_thread) end end old_af_thread.join if old_af_thread end |
#initialize ⇒ Object
22 23 24 25 |
# File 'lib/radio/rig/ssb.rb', line 22 def initialize @ssb_semaphore = Mutex.new super end |
#set_lsb ⇒ Object
68 69 70 71 72 73 74 75 76 |
# File 'lib/radio/rig/ssb.rb', line 68 def set_lsb @ssb_semaphore.synchronize do if @bfo_filter @ssb_mode = :lsb @bfo_filter.decimation_fir = @lsb_coef set_mixers end end end |
#set_usb ⇒ Object
78 79 80 81 82 83 84 85 86 |
# File 'lib/radio/rig/ssb.rb', line 78 def set_usb @ssb_semaphore.synchronize do if @bfo_filter @ssb_mode = :usb @bfo_filter.decimation_fir = @usb_coef set_mixers end end end |
#tune=(freq) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/radio/rig/ssb.rb', line 61 def tune= freq @ssb_semaphore.synchronize do @freq = freq set_mixers end end |