示例#1
0
//--------------------------------------------------------------
void ofApp::setup(){
    
    camera.initGrabber(VID_WIDTH, VID_HEIGHT);
    scaledImage.allocate(VID_WIDTH, VID_HEIGHT);
    scaledImageFlipped.allocate(VID_WIDTH, VID_HEIGHT);
    grayImage.allocate(VID_WIDTH, VID_HEIGHT);
    grayBg.allocate(VID_WIDTH, VID_HEIGHT);
    grayDiff.allocate(VID_WIDTH, VID_HEIGHT);
    
    particles.setup();
    
    float fullWidth = ofGetWidth();
    float fullHeight = ofGetHeight();
    float screenWidth = ofGetScreenWidth();
    float outputWidth = fullWidth;

    buffer.allocate(OUT_WIDTH, OUT_HEIGHT);
    
    images = new vector<ofImage*>();
    
    ofxNestedFileLoader loader;
    loader.findNestedFilePaths("backgrounds");
    vector<string> backgroundNames = loader.getPaths();
    for(int i = 0; i < backgroundNames.size(); i++) {
        ofImage *img;
        img = new ofImage();
        img->load(backgroundNames[i]);
        images->push_back(img);
    }
        
    ofBackground(0);
    
    vector<int> selected;
    selected.push_back(0);
    
    gui = new ofxDatGui(ofxDatGuiAnchor::TOP_LEFT);
    gui->addFRM();
    auto toggle = gui->addToggle("SPARKLES", true);
    toggle->onButtonEvent(this, &ofApp::onToggleEvent);
    toggle = gui->addToggle("BACKGROUND", true);
    toggle->onButtonEvent(this, &ofApp::onToggleEvent);
    toggle = gui->addToggle("CAMERA", true);
    toggle->onButtonEvent(this, &ofApp::onToggleEvent);
    toggle = gui->addToggle("TRAILS", false);
    toggle->onButtonEvent(this, &ofApp::onToggleEvent);
    auto matrix = gui->addMatrix("SOCIAL MEDIA", backgroundNames.size(), true);
    matrix->setSelected(selected);
    matrix->setRadioMode(true);
    auto slider = gui->addSlider("RESOLUTION", 0.1, 1.0, 1.0);
    slider->onSliderEvent(this, &ofApp::onSliderEvent);
    
    gui->setVisible(true);
    
    ofSetColor(255);
    
    drawCamera = true;
    drawSparkles = true;
    drawBackground = true;
    clearBackground = true;
}
示例#2
0
void CCommand::Initialize()
{
    // Set Baud rate
    setRadio(0);
    setSquelch(255);
    setSoundVolume(0);
    setRadio(1);
    setSoundVolume(0);
    setSquelch(255);
    /*
    dbgWin->slotSendSerial("G2?");
    dbgWin->slotSendSerial("G4?");
    dbgWin->slotSendSerial("GE?");
    dbgWin->slotSendSerial("GD?");
    dbgWin->slotSendSerial("GA0?");
    dbgWin->slotSendSerial("GA1?");
    dbgWin->slotSendSerial("GA2?");
    dbgWin->slotSendSerial("GF?");
    */
    sleep(1);
    setUpdateMode(CCommand::eUpdOn);
    /*  NOT NEEDED */
    //dbgWin->slotSendSerial("J730000");
    setRadio(0);
    // Noise blanker is off
    setNoiseBlanker(false);
    setRadio(1);
    setNoiseBlanker(false);

    // Init radio 0 Frequency;

    setRadio(0);
    setModulation(CCommand::eWFM);
    setFilter(CCommand::e230k);
    setFrequency(106500000);
    setSquelch(0);
    setVoiceControl(CCommand::eVSCOff);
    setIFShift(128);

    // Init radio 1 Frequency
    setRadio(1);
    setModulation(CCommand::eFM);
    setFilter(CCommand::e15k);
    setFrequency(145425000);
    setSquelch(0);
    setSoundVolume(0);
    setVoiceControl(CCommand::eVSCOff);
    setIFShift(128);

    /*  NOT NEEDED */

    /* Unknown
    dbgWin->slotSendSerial("J4200");
    dbgWin->slotSendSerial("J4700");
    dbgWin->slotSendSerial("J6700");


    dbgWin->slotSendSerial("JC400");
    dbgWin->slotSendSerial("J7100");
    dbgWin->slotSendSerial("J720000");
    dbgWin->slotSendSerial("JC000");
    */
    // Mute radio before restoring values
    setRadio(0);
    setSoundMute(true);
    setSoundVolume(0);

    /* Unknown
    dbgWin->slotSendSerial("J8001");
    dbgWin->slotSendSerial("J8100");
    dbgWin->slotSendSerial("J8200");
    dbgWin->slotSendSerial("J8300");
    dbgWin->slotSendSerial("JC500");
    */
    setRadio(0);
    setSquelch(255);
    setVoiceControl(CCommand::eVSCOff);
    setRadio(1);
    setSquelch(255);
    setVoiceControl(CCommand::eVSCOff);

    setRadio(0);
    setSoundVolume(0);
    setRadio(1);
    setSoundVolume(0);
    setSquelch(255);
    setRadioMode(CCommand::eBoth);
    //dbgWin->slotSendSerial("JB000");
    setRadio(1);
    setSquelch(255);
    setVoiceControl(CCommand::eVSCOff);

    setRadio(0);
    setSquelch(1);
    setVoiceControl(CCommand::eVSCOff);
    setRadio(1);
    setVoiceControl(CCommand::eVSCOff);
    setSquelch(1);

    setRadio(0);
    setSoundVolume(60);
    setSoundMute(false);
}