[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] what does multi-tasker?
From: |
Suvda Myagmar |
Subject: |
[Discuss-gnuradio] what does multi-tasker? |
Date: |
Tue, 05 Oct 2004 13:28:12 -0500 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040115 |
I've got a code for FM transmitter, but not familiar with some of the
classes used there. Since the code is based on gnuradio 0.9, I can't find
the source code for this earlier version. Does anyone know what VrMultiTask
does? Also is NWO_Connect is the same as the connect method of flow_graph
in the latest version? The code is below. Thanks
-Suvda
----------------------------------------------------------------------
#include <VrSource.h>
#include <VrConnect.h>
#include <VrMultiTask.h>
#include <VrSigSource.h>
#include <VrGUI.h>
#include <GrAudioSink.h>
#include <GrFileSink.h>
#include <GrFFTSink.h>
#include "etgQuarterMixer.h"
#include "etgFrequencyModulator.h"
#include "xmithelper.h"
#if HAVE_KNOBBY
#include <knobby.h>
/*
Knobby is a homebrew library that allows one to use a Griffin Powermate dial
to control a parameter. If knobby is availible, then the powermate will
control the
modulation index. If not, don't worry about it. :)
*/
#else
bool knob_control(void (*pcallback)(float), float p_init=0, float
p_inc=1){return false;}
void knob_update(){}
#endif
namespace {
VrSigProc* input=0;
etgFrequencyModulator<float>* modulator;
etgQuarterMixer<VrComplex,VrComplex>* carrier;
VrSink<VrComplex>* out_IQ;
VrMultiTask* mtasker;
bool use_gui_p;
VrGUI* guimain;
VrSink<float>* inputfft;
void knob_modindex(float param){
modulator->SetModulationIndex(param);
cout<<"Mod index = "<<param<<endl;
}
}
namespace sdr {
const int sampfreq = 48000;
void SetupXmitter(float modindex, bool use_gui){
use_gui_p = use_gui;
// etgFrequencyModulator is my experimental fm modulator. The
// single argument to the constructor should be the modulation index
modulator=new etgFrequencyModulator<float>(modindex);
//etgQuarterMixer is a 1/4th sample rate complex mixer
carrier=new etgQuarterMixer<VrComplex,VrComplex> (1);
// Outputs I and Q to the separate audio channels
// Keep amplitude within ~95% of max
out_IQ = new GrAudioSink<VrComplex>(1.05,"/dev/dsp0");
NWO_CONNECT(modulator, carrier);
NWO_CONNECT(carrier,out_IQ);
mtasker = new VrMultiTask ();
mtasker->add (out_IQ);
// Construct the GUI - three fft's for each stage (signal, mod, demod)
if (use_gui_p){
VrGUILayout *horiz = 0;
VrGUILayout *vert = 0;
VrSink<float> *fft_sink1 = 0;
VrSink<VrComplex> *fft_sink2 = 0,*fft_sink4 = 0;
VrSink<float> *fft_sink3 = 0;
int argc=0;
char* argv[]={""};
guimain = new VrGUI(argc, argv);
horiz = guimain->top->horizontal();
vert = horiz->vertical();
// sink1 is source output
inputfft = new GrFFTSink<float>(vert, -40, 140, 1000);
// sink2 is modulator output
fft_sink2 = new GrFFTSink<VrComplex>(vert, -150, 50, 1000);
NWO_CONNECT (carrier, fft_sink2);
mtasker->add (inputfft);
mtasker->add (fft_sink2);
}
knob_control(&knob_modindex,modindex,modindex/10);
}
void Update(){
assert(input!=NULL);
static bool isinit=false;
if (!isinit){
isinit=true;
mtasker->start ();
if (use_gui_p)
guimain->start ();
}
if (use_gui_p)
guimain->processEvents(10); //in ms
mtasker->process();
knob_update();
}
void SetModIndex(float modindex){
knob_modindex(modindex);
}
void SetSource(VrSigProc* src){
assert(input==NULL);
input=src;
NWO_CONNECT(input,modulator);
if (use_gui_p){
NWO_CONNECT(src,inputfft);
}
}
VrSigProc* GetSource() { return input;}
VrSigProc* GetModulatedOut() {return modulator;}
VrSigProc* GetCarrierOut(){ return carrier;}
VrMultiTask* GetMultiTasker(){ return mtasker;}
}
-----------------------------------------------------------
- [Discuss-gnuradio] what does multi-tasker?,
Suvda Myagmar <=