Beispiel #1
0
void
Mixer::init( int n )
{
    numChannels = n;

    char tmpname[20];
    int i;
    
    double mix = 2.0 / n;

    for (i = 0; i < numChannels; i++) 
    {
	sprintf(tmpname, "amp%d", i);
	addInput(tmpname);
	sprintf(tmpname, "sig%d", i);
	addInput(tmpname);
	set( I_MIX_AMP( i ), mix );
    }
    
    output = addOutput("sig", true);
    inputData = new double *[numChannels * 2];
    
    for (int i = 0; i < numChannels * 2; i++)
	inputData[i] = inputs[i].data;

    Scheduler::scheduleSampleRate(this, true);
}
Beispiel #2
0
void IPLMergePlanes::init()
{
    // init
    _result = NULL;
    _inputA = NULL;
    _inputB = NULL;
    _inputC = NULL;
    _inputType  = 0;

    // basic settings
    setClassName("IPLMergePlanes");
    setTitle("Merge Planes");
    setCategory(IPLProcess::CATEGORY_CONVERSIONS);
    setDescription("Converts color planes into a color image. The input planes may be images in"
                   "the RGB, HSI, HLS, or HSV color system");

    // properties
    addProcessPropertyInt("input_type", "Color Model:RGB|HSV|HSL", "", _inputType, IPL_WIDGET_RADIOBUTTONS);

    // inputs and outputs
    addInput("Plane 1", IPLData::IMAGE_GRAYSCALE);
    addInput("Plane 2", IPLData::IMAGE_GRAYSCALE);
    addInput("Plane 3", IPLData::IMAGE_GRAYSCALE);
    addOutput("Image",  IPLData::IMAGE_COLOR);

}
Beispiel #3
0
TEST_F(JoinTests, hash_join_exchange_rates_multiple_columns) {
  hyrise::storage::c_atable_ptr_t table1 = Loader::shortcuts::load("test/join_transactions.tbl");
  hyrise::storage::c_atable_ptr_t table2 = Loader::shortcuts::load("test/join_exchange.tbl");

  EqualsExpression<std::string> *expr4 = new EqualsExpression<std::string>(table2, 2, "USD");

  auto scan = std::make_shared<SimpleTableScan>();
  scan->addInput(table2);
  scan->setProducesPositions(true);
  scan->setPredicate(expr4);

  const auto& filtered_rates = scan->execute()->getResultTable();


  auto hashBuild1 = std::make_shared<hyrise::access::HashBuild>();
  hashBuild1->addInput(filtered_rates);
  hashBuild1->addField(0);
  hashBuild1->addField(1);
  hashBuild1->setKey("join");
  auto hashedFilteredRates1 = hashBuild1->execute()->getResultHashTable();

  auto hashJoinProbe = std::make_shared<hyrise::access::HashJoinProbe>();
  hashJoinProbe->addInput(table1);
  hashJoinProbe->addField(0);
  hashJoinProbe->addField(1);
  hashJoinProbe->addInputHash(hashedFilteredRates1);
  auto result = hashJoinProbe->execute()->getResultTable();


  const auto& reference = Loader::shortcuts::load("test/reference/join_exchange_rates.tbl");
  ASSERT_TRUE(result->contentEquals(reference));

}
Beispiel #4
0
NodeAnd::NodeAnd() {
	setType(3);
	addInput(0, BOOL);
	addInput(1, BOOL);
	addOutput(0, BOOL);
	positive = false;
}
Beispiel #5
0
MultisigDialog::MultisigDialog(QWidget *parent) : QWidget(parent), ui(new Ui::MultisigDialog), model(0)
{
    ui->setupUi(this);

#ifdef Q_WS_MAC // Icons on push buttons are very uncommon on Mac
    ui->addPubKeyButton->setIcon(QIcon());
    ui->clearButton->setIcon(QIcon());
    ui->addInputButton->setIcon(QIcon());
    ui->addOutputButton->setIcon(QIcon());
    ui->signTransactionButton->setIcon(QIcon());
    ui->sendTransactionButton->setIcon(QIcon());
#endif

    addPubKey();
    addPubKey();

    connect(ui->addPubKeyButton, SIGNAL(clicked()), this, SLOT(addPubKey()));
    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));

    addInput();
    addOutput();

    connect(ui->addInputButton, SIGNAL(clicked()), this, SLOT(addInput()));
    connect(ui->addOutputButton, SIGNAL(clicked()), this, SLOT(addOutput()));

    ui->signTransactionButton->setEnabled(false);
    ui->sendTransactionButton->setEnabled(false);
}
Beispiel #6
0
TEST_F(JoinTests, join_exchange_rates) {
  hyrise::storage::c_atable_ptr_t table1 = Loader::shortcuts::load("test/join_transactions.tbl");
  hyrise::storage::c_atable_ptr_t table2 = Loader::shortcuts::load("test/join_exchange.tbl");

  EqualsExpression<std::string> *expr4 = new EqualsExpression<std::string>(table2, 2, "USD");

  auto scan = std::make_shared<SimpleTableScan>();
  scan->addInput(table2);
  scan->setProducesPositions(true);
  scan->setPredicate(expr4);

  const auto& filtered_rates = scan->execute()->getResultTable();

  auto join = std::make_shared<hyrise::access::JoinScan>(hyrise::access::JoinType::EQUI);
  join->addInput(table1);
  join->addInput(filtered_rates);
  join->addCombiningClause(AND);
  join->addJoinClause<int>(0, 0, 1, 0);
  join->addJoinClause<std::string>(0, 1, 1, 1);


  const auto& out = join->execute()->getResultTable();

  const auto& reference = Loader::shortcuts::load("test/reference/join_exchange_rates.tbl");
  ASSERT_TRUE(out->contentEquals(reference));
}
  BinaryMultiplier::BinaryAnder::BinaryAnder(const QString &name, int width, QGraphicsItem *parent) : Component(name, parent)
  {
    addInput(m_a = new Input("a", width, this));
    addInput(m_b = new Input("b", 1, this));
    addOutput(m_output = new Output("output", width, this));

    setLayout(MINIMIZED);
  }
 /**
  * Constructs a multiplier.
  */
 TestComponent::MultiplierComponent::MultiplierComponent(const QString &name, QGraphicsItem *parent) : Component(name, parent)
 {
   // construct the inputs and add them to the component's list of inputs
   addInput(m_input_01 = new Input("input_01", 32, this));
   addInput(m_input_02 = new Input("input_02", 32, this));
   // construct the output and add it to the component's list of outputs
   addOutput(m_output = new Output("output", 32, this));
 }
Beispiel #9
0
OpDeconvolution::OpDeconvolution(Process *parent) :
    Operator(OP_SECTION_FREQUENCY_DOMAIN, QT_TRANSLATE_NOOP("Operator", "Deconvolution"), Operator::NonHDR, parent),
    m_luminosity(new OperatorParameterSlider("luminosity", tr("Luminosity"), tr("Deconvolution Luminosity"), Slider::ExposureValue, Slider::Logarithmic, Slider::Real, 1./(1<<4), 4, 1, 1./(1<<16), 1<<16, Slider::FilterExposure, this))
{
    addInput(new OperatorInput(tr("Images"), OperatorInput::Set, this));
    addInput(new OperatorInput(tr("Kernel"), OperatorInput::Set, this));
    addOutput(new OperatorOutput(tr("Images"), this));
    addParameter(m_luminosity);
}
Beispiel #10
0
pdsp::Bitcruncher::Bitcruncher(){
    
        addInput("signal", input_signal);
        addInput("bits", input_bits);
        addOutput("signal", output);
        updateOutputNodes();
        
        input_bits.setDefaultValue(16.0f);
}
void TransformPlaneConstraint::init()
{
    addInput(&d_planes);
    addInput(&d_rotation);
    addInput(&d_translation);
    addInput(&d_scale);
    addOutput(&d_outPlanes);

    setDirtyValue();
}
Beispiel #12
0
NodeTimer::NodeTimer() {
	setType(8);
	addInput(0, BOOL);
	addInput(1, FLOAT);
	addOutput(0, BOOL);
	targetState = false;
	delay = 1;
	currentDelay = 0;
	run = false;
}
Beispiel #13
0
TEST_F(GroupByTests, group_by_scan_using_table_2) {
  hyrise::storage::atable_ptr_t t = Loader::shortcuts::load("test/10_30_group.tbl");

  {
    auto gs = std::make_shared<hyrise::access::GroupByScan>();
    gs->addInput(t);
    gs->addField(0);

    auto hs = std::make_shared<hyrise::access::HashBuild>();
    hs->addInput(t);
    hs->addField(0);
    hs->setKey("groupby");

    auto group_map = hs->execute()->getResultHashTable();
    
    gs->addInput(group_map);

    const auto& result = gs->execute()->getResultTable();

    ASSERT_EQ(result->size(), t->size());


    hyrise::access::GroupByScan gs2;
    gs2.addInput(t);

    gs2.addField(1);

    hyrise::access::HashBuild hs2;
    hs2.addInput(t);
    hs2.addField(1);
    hs2.setKey("groupby");

    auto group_map2 = hs2.execute()->getResultHashTable();
    gs2.addInput(group_map2);

    const auto& result2 = gs2.execute()->getResultTable();

    SortScan s;
    s.addInput(result2);


    s.setSortField(0);
    const auto& r2 = s.execute()->getResultTable();

    hyrise::storage::atable_ptr_t reference = Loader::shortcuts::load("test/reference/group_by_scan_using_table_2.tbl");

    SortScan s2;
    s2.addInput(reference);
    s2.setSortField(0);
    const auto& ref2 = s2.execute()->getResultTable();

    ASSERT_TABLE_EQUAL(r2, ref2);
  }
  ASSERT_EQ(1u, t.use_count());
}
Beispiel #14
0
LHPFilter::LHPFilter(AudioUnitPlugin *pPlugin)
    : AudioUnit(pPlugin),
      m_filter()
{
    m_pInput = addInput("in");
    m_pInputCutOffFreq = addInput("f");

    m_pOutput = addOutput("out");

    createProperties();
}
Beispiel #15
0
StkFreeVerb::StkFreeVerb(AudioUnitPlugin *pPlugin)
    : AudioUnit(pPlugin)
{
    m_pInputLeft = addInput("L");
    m_pInputRight = addInput("R");
    m_pOutputLeft = addOutput("L");
    m_pOutputRight = addOutput("R");

    createProperties();

    m_pFreeVerb = new stk::FreeVerb();
}
Beispiel #16
0
	LNSSqrt::LNSSqrt(Target * target, int wE, int wF) :
	Operator(target), wE(wE), wF(wF)
	{
		addInput ("nA", wE + wF + 3);
		addInput ("nB", wE + wF + 3);

		addOutput("nR", wE + wF + 3);
	
		setOperatorName();
	setCombinatorial();	

	}
Beispiel #17
0
Cutter::Cutter(WorkSpace *ws) : GuiWsItem<Ui::WsItemConfig>(ws)
{
  loadIcon("cutter.png");
  m_Ws->addItem(this);
  setName("Cutter");
  vtk = vtkCutter::New();
  addInput("cut function","vtkImplicitFunction");
  addInput("data","vtkPolyData/DataSet");
  connect(m_Dlg.ui.apply_pb,SIGNAL(clicked()),this,SLOT(apply()));
  m_Dlg.ui.name_edit->setText(name());
  apply();
}
Beispiel #18
0
pdsp::BiquadBase::BiquadBase(){
    addInput("signal", input_signal);
    addOutput("signal", output);
    addInput("freq", input_frequency);
    addInput("Q", input_Q);
    addInput("gain", input_gain);
    updateOutputNodes();
    
    input_gain.setDefaultValue(0.0f);
    input_Q.setDefaultValue(0.707f);
    input_frequency.setDefaultValue(8000.0f);
    
    BiquadBase::cookCoefficients(0.0f, 0.0f, 0.0f, 0.0f);
}
Beispiel #19
0
NodeDoor::NodeDoor() : soundId(-1) {
	goalY = 0;
	shouldMove = false;
	setCollides(true);
	setMoves(true);
	setType(2);
	setSpeed(5);
	setOpaque(true);

	addInput(inputState, BOOL);
	addInput(inputSpeed, FLOAT);
	addInput(inputStop, BOOL);
	addInput(inputThump, BOOL);
}
Beispiel #20
0
pdsp::Decimator::Decimator(){
    
    phase = 1.0f;
    addInput("signal", input_signal);
    addInput("freq", input_freq);
    addOutput("output", output);
    updateOutputNodes();

    input_freq.setDefaultValue(44100.0f);

    if(dynamicConstruction){
        prepareToPlay(globalBufferSize, globalSampleRate);
    }
}
bool InputComponent::componentInitialize()
{
  // load our input mappings
  m_mappings->loadMappings();

  addInput(&InputKeyboard::Get());
  addInput(new InputSocket(this));
  addInput(new InputRoku(this));

#ifdef Q_OS_MAC
  addInput(new InputAppleRemote(this));
  addInput(new InputAppleMediaKeys(this));
#endif
#ifdef HAVE_SDL
  addInput(new InputSDL(this));
#endif
#ifdef HAVE_LIRC
  addInput(new InputLIRC(this));
#endif
#ifdef HAVE_CEC
  if (SettingsComponent::Get().value(SETTINGS_SECTION_CEC, "enable").toBool())
    addInput(new InputCEC(this));
#endif

  return true;
}
Beispiel #22
0
pdsp::TriggerGeiger::TriggerGeiger(){
    
    addInput("jitter",   in_jitter_ms );
    addInput("distance", in_distance_ms );
    addOutput("trig", output_trig);
    updateOutputNodes();
    
    in_distance_ms.setDefaultValue(200.0f);
    in_jitter_ms.setDefaultValue(0.0f);

    if(dynamicConstruction){
        prepareToPlay(globalBufferSize, globalSampleRate);
    }
}
Beispiel #23
0
pdsp::Amp::Amp(){
        addInput("signal", input_signal);
        addInput("mod", input_mod);
        addOutput("signal", output);
        updateOutputNodes();
    
        input_mod.setDefaultValue(0.0f);
    
        meter.store(0.0f);
        meterOut.store(0.0f);
    
        if(dynamicConstruction){
                prepareToPlay(globalBufferSize, globalSampleRate);
        }
}
Beispiel #24
0
	LNSMul::LNSMul(Target * target, int wE, int wF) :
		Operator(target), wE(wE), wF(wF)
	{
		ostringstream name;
		/* The name has the format: LNSMul_wE_wF where: 
			wE = width of the integral part of the exponent
			wF = width of the fractional part of the exponent */
		name << "LNSMul_" << wE << "_" << wF; 
		setName(name.str());
		setCopyrightString("Jérémie Detrey, Florent de Dinechin (2003-2004), Sylvain Collange (2008)");
		addInput ("nA", wE + wF + 3);
		addInput ("nB", wE + wF + 3);
		addOutput("nR", wE + wF + 3);
		
		addConstant("wE", "positive", wE);
		addConstant("wF", "positive", wF);
		
		//vhdl << tab << declare("eRn", wE+wF+1) << " <= (nA(wE+wF-1) & nA(wE+wF-1 downto 0)) + (nB(wE+wF-1) & nB(wE+wF-1 downto 0));\n";

		IntAdder *my_adder = new IntAdder(target, wE+wF+1);
		oplist.push_back(my_adder);
		vhdl << tab << declare("X", wE+wF+1) << "<= nA(wE+wF-1) & nA(wE+wF-1 downto 0);\n";
		vhdl << tab << declare("Y", wE+wF+1) << "<= nB(wE+wF-1) & nB(wE+wF-1 downto 0);\n";
		inPortMap   (my_adder, "X", "X");
		inPortMap   (my_adder, "Y", "Y");
		inPortMapCst(my_adder, "Cin", "'0'");
		outPortMap (my_adder, "R","eRn");
		vhdl << instance(my_adder, "my_add");	
		
		vhdl << tab << declare("sRn") << " <= nA(wE+wF) xor nB(wE+wF);\n";
		vhdl << tab << declare("xRn", 2) << " <= \"00\" when eRn(wE+wF downto wE+wF-1) = \"10\" else\n"
			<< tab << "	 \"10\" when eRn(wE+wF downto wE+wF-1) = \"01\" else\n"
			<< tab << "	 \"01\";\n";
		vhdl << tab << declare("nRn", wE+wF+3) << " <= xRn & sRn & eRn(wE+wF-1 downto 0);\n";

		vhdl << tab << declare("xA", 2) << " <= nA(wE+wF+2 downto wE+wF+1);\n";
		vhdl << tab << declare("xB", 2) << " <= nB(wE+wF+2 downto wE+wF+1);\n";
		vhdl << tab << declare("xAB", 4) << " <= xA & xB when xA >= xB else\n"
			<< tab << "	 xB & xA;\n";
		vhdl
			<< tab << "with xAB select\n"
			<< tab << tab << "nR(wE+wF+2 downto wE+wF+1) <= xRn  when \"0101\",\n"
			<< tab << "	                                    \"00\" when \"0000\" | \"0100\",\n"
			<< tab << "	                                    \"10\" when \"1001\" | \"1010\",\n"
			<< tab << "	                                    \"11\" when others;\n"
			<< tab << "\n"
			<< tab << "nR(wE+wF downto 0) <= nRn(wE+wF downto 0);\n";
	}
Beispiel #25
0
pdsp::PRNoiseGen::PRNoiseGen(){

    addInput("clock", input_trig_clock);
    addInput("reseed", input_trig_seed);
    addOutput("signal", output);
    updateOutputNodes();

    seedMult = rand();
    //seed = seedMult * time(NULL);
    seed = randomInt();
    pnRegister = seed;

    if(dynamicConstruction){
            prepareToPlay(globalBufferSize, globalSampleRate);
    }
}
Beispiel #26
0
ScriptProcessorNode::ScriptProcessorNode(AudioContext& context, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels)
    : AudioNode(context, sampleRate)
    , m_doubleBufferIndex(0)
    , m_doubleBufferIndexForEvent(0)
    , m_bufferSize(bufferSize)
    , m_bufferReadWriteIndex(0)
    , m_isRequestOutstanding(false)
    , m_numberOfInputChannels(numberOfInputChannels)
    , m_numberOfOutputChannels(numberOfOutputChannels)
    , m_internalInputBus(AudioBus::create(numberOfInputChannels, AudioNode::ProcessingSizeInFrames, false))
    , m_hasAudioProcessListener(false)
{
    // Regardless of the allowed buffer sizes, we still need to process at the granularity of the AudioNode.
    if (m_bufferSize < AudioNode::ProcessingSizeInFrames)
        m_bufferSize = AudioNode::ProcessingSizeInFrames;

    ASSERT(numberOfInputChannels <= AudioContext::maxNumberOfChannels());

    addInput(std::make_unique<AudioNodeInput>(this));
    addOutput(std::make_unique<AudioNodeOutput>(this, numberOfOutputChannels));

    setNodeType(NodeTypeJavaScript);

    initialize();
}
AudioBasicProcessorHandler::AudioBasicProcessorHandler(NodeType nodeType, AudioNode& node, float sampleRate, PassOwnPtr<AudioProcessor> processor)
    : AudioHandler(nodeType, node, sampleRate)
    , m_processor(processor)
{
    addInput();
    addOutput(1);
}
Beispiel #28
0
bool BlendEffect::load(const KXmlElement &element, const KFilterEffectLoadingContext &)
{
    if (element.tagName() != id())
        return false;

    m_blendMode = Normal; // default blend mode

    QString modeStr = element.attribute("mode");
    if (!modeStr.isEmpty()) {
        if (modeStr == "multiply")
            m_blendMode = Multiply;
        else if (modeStr == "screen")
            m_blendMode = Screen;
        else if (modeStr == "darken")
            m_blendMode = Darken;
        else if (modeStr == "lighten")
            m_blendMode = Lighten;
    }

    if (element.hasAttribute("in2")) {
        if (inputs().count() == 2)
            setInput(1, element.attribute("in2"));
        else
            addInput(element.attribute("in2"));
    }

    return true;
}
Beispiel #29
0
// Canonicalize a graph, renumbering it so that all structurally equivalent
// graphs have same numbers.
std::shared_ptr<Graph> Canonicalize(const std::shared_ptr<Graph>& graph) {
  auto r = std::make_shared<Graph>(graph->scope_root());
  std::unordered_map<Value*, Value*> rn_env;
  auto rn_fn = [&](Value* v) { return rn_env.at(v); };
  for (auto* input : graph->inputs()) {
    auto* r_input = r->addInput();
    r_input->copyMetadata(input);
    r_input->setStage(input->stage());
    rn_env[input] = r_input;
  }
  for (auto* node : graph->nodes()) {
    auto* r_node = r->createClone(node, rn_fn);
    r_node->setStage(node->stage());
    r->appendNode(r_node);
    auto outputs = node->outputs();
    auto r_outputs = r_node->outputs();
    for (size_t i = 0; i < outputs.size(); i++) {
      r_outputs.at(i)->setStage(outputs.at(i)->stage());
      rn_env[outputs.at(i)] = r_outputs.at(i);
    }
  }
  for (auto* output : graph->outputs()) {
    r->registerOutput(rn_fn(output));
  }
  r->setStage(graph->stage());

  return r;

}
Beispiel #30
0
PannerNode::PannerNode(AudioContext* context, float sampleRate)
    : AudioNode(context, sampleRate)
    , m_panningModel(Panner::PanningModelHRTF)
    , m_lastGain(-1.0)
    , m_connectionCount(0)
{
    addInput(adoptPtr(new AudioNodeInput(this)));
    addOutput(adoptPtr(new AudioNodeOutput(this, 2)));

    // Node-specific default mixing rules.
    m_channelCount = 2;
    m_channelCountMode = ClampedMax;
    m_channelInterpretation = AudioBus::Speakers;

    m_distanceGain = AudioParam::create(context, "distanceGain", 1.0, 0.0, 1.0);
    m_coneGain = AudioParam::create(context, "coneGain", 1.0, 0.0, 1.0);

    m_position = FloatPoint3D(0, 0, 0);
    m_orientation = FloatPoint3D(1, 0, 0);
    m_velocity = FloatPoint3D(0, 0, 0);

    setNodeType(NodeTypePanner);

    initialize();
}