示例#1
0
//--------------------------------------------------------------
void ofApp::keyReleased(int key){
    
    if (key==' ') bPlaying = !bPlaying;
    
    if (bPlaying) {
        ofSoundStreamStart();
    } else {
        ofSoundStreamStop();
    }
    
    if (key==356) {
        directionX = -speed;
    } else if (key==358) {
        directionX = speed;
    }
    
    
}
示例#2
0
void ofApp::setup(){
    
    ofSetFrameRate(60);
    ofBackground(0);
    
    domPanorama.load("panorama_up.png");
    domPanoramaPixel.allocate( domPanorama.getWidth(), domPanorama.getHeight(), OF_IMAGE_COLOR_ALPHA );
    domPanoramaPixel = domPanorama.getPixels();
    domPanoramaFromPixel.allocate( domPanorama.getWidth(), domPanorama.getHeight(), OF_IMAGE_COLOR_ALPHA );
    
    panorama360_line.load("panorama_up_line.png");
    panorama360_linePixel.allocate( domPanorama.getWidth(), domPanorama.getHeight(), OF_IMAGE_COLOR_ALPHA );
    panorama360_linePixel = panorama360_line.getPixels();
    
    panorama360_line_black.load("panorama_up_line_black.png");
    panorama360_line_blackPixel.allocate( domPanorama.getWidth(), domPanorama.getHeight(), OF_IMAGE_COLOR_ALPHA );
    panorama360_line_blackPixel = panorama360_line_black.getPixels();
    
    line = 7;
    
    for (int i=0; i<514 ; i++) {
        sineBufferNormalRight[i] = sines[i];
        sineBufferNormalLeft[i] = sines[i];
        sineBufferLine[i] = sines[i];
    }
    
    threshold = 0.9;
    maxHertz = 4000;
    minHertz = 50;
    movXRight = ofGetWidth()*0.5;
    movXLeft = movXRight;
    
    ofSoundStreamSetup( 2, 0, this, SAMPLE_RATE, INITIAL_BUFFER_SIZE, 4 );
    ofSoundStreamStop();
    
    speed = 0.5;
    directionX = speed;
    
    widthForLandscape = ofGetWidth();
    heightForLandscape = domPanorama.getHeight();
    
    widthOnePixel = 30;
    heightOnePixel = (ofGetHeight() - heightForLandscape) * 0.9;
    
    onePixelLineRight.resize(heightOnePixel);
    onePixelRight.allocate( widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    
    onePixelLineLeft.resize(heightOnePixel);
    onePixelLeft.allocate( widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    
    
    imgonePixelDrawRight.allocate(  widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    imgonePixelDrawLeft.allocate(  widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    
    onePixelSort.allocate( widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    imgonePixelSortDrawRight.allocate(  widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    lineOnePixelRight.allocate( widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    imgLineOnePixelRight.allocate(  widthOnePixel, heightOnePixel, OF_IMAGE_COLOR_ALPHA );
    
    linePosieion = 150;
    
}
示例#3
0
void ofApp::exit(){
    ofSoundStreamStop();
    ofSoundStreamClose();
}