bool ArtistsWidget::checkMPDConnection() {
   if (MPD::Client::GetInstance()->Connected()) {
     loadArtistsFromMPD();
     loadArtists();
     return false;
   } else {
     return true;
   }
 }
  void ArtistsWidget::on_itemClick(Gtk::TreeModel::Path p) {
    Gtk::TreeModel::iterator i = treeModel->get_iter(p);
    Glib::ustring s;
    int isArtist;

    MPD::Song* song;
    i->get_value(0, s);
    i->get_value(2, isArtist);
    i->get_value(3, song);



    // if is artist, load artist's songs
    if (isArtist == 1) {
      loadArtistsSongs(s.c_str());
    } else if (isArtist == 0) {
      // add to queue and play
      MPD::Client::GetInstance()->AddSong(*song, MPD::Client::GetInstance()->GetPlaylistLength());
      MPD::Client::GetInstance()->Play(MPD::Client::GetInstance()->GetPlaylistLength());
    } else {
      loadArtists();
    }

  }
Example #3
0
void ofApp::setup() {

	// SYSTEM
	ofSetLogLevel(OF_LOG_VERBOSE);
	ofHideCursor();
	ofSetFrameRate(60);
	
	// SCREEN
    ofEnableAlphaBlending();
    ofBackground(100);
    width = ofGetWindowWidth();
    height = ofGetWindowHeight();
    
    // STATE
    presenting = true;
    tooSunny = false;
    fboAge = 0;
    imageTimer = 0;
    imageMAX = 500;
    playState = 1;
    currentBrightness = 0;
    targetAlpha = 155;
	
    #ifdef INTERACTIVE
        // KINECT
        #ifdef KINECT
            kinect.setRegistration(true);
            kinect.init();	
            kinect.open();
            if(kinect.isConnected()) {
                ofLogNotice() << "sensor-emitter dist: " << kinect.getSensorEmitterDistance() << "cm";
                ofLogNotice() << "sensor-camera dist:  " << kinect.getSensorCameraDistance() << "cm";
                ofLogNotice() << "zero plane pixel size: " << kinect.getZeroPlanePixelSize() << "mm";
                ofLogNotice() << "zero plane dist: " << kinect.getZeroPlaneDistance() << "mm";
            }
            angle = 23;
            kinect.setCameraTiltAngle(angle);
        #else
            camera.setVerbose(true);
            camera.initGrabber(320, 240);
        #endif
    
        // CAPTURE SIZE
        int capture_width, capture_height;
        #ifdef KINECT
            capture_width = kinect.width;
            capture_height = kinect.height;
        #else
            capture_width = camera.width;
            capture_height = camera.height;
        #endif
        
        // OPENCV
        colorImg.allocate(capture_width, capture_height);
        grayImage.allocate(capture_width, capture_height);
        grayThreshNear.allocate(capture_width, capture_height);
        grayThreshFar.allocate(capture_width, capture_height);
        grayBg.allocate(capture_width, capture_height);
        grayDiff.allocate(capture_width, capture_height);
        closePoints.allocate(capture_width, capture_height, GL_RGBA32F_ARB);

        nearThreshold = 350;
        farThreshold = 112;
        bLearnBakground = true;
        threshold = 80;
        bThreshWithOpenCV = false;
        minBlob = 25; 
        maxBlob = (capture_width * capture_height)/2;
    
        // FBO & GLSL SHADER
        setupGL(width, height);
    #else
        playState = 2;
        imageMAX = 2500;
    #endif
    

	
    // XML ASSETS
    BASEPATH = "../../../MEDIA/";
    assets.loadFile("xml/assets.xml");
    if( assets.loadFile("xml/assets.xml") ) {
        ofLog(OF_LOG_NOTICE, "Loaded xml file !!! \n");
        loadFonts();
        loadArtists();
        loadAssets();
    }
    else {
        ofLog(OF_LOG_ERROR, "UNABLE to load xml file :( \n");
    }

    //  INDEX
    currentIndex = 0;
    updateCurrentIndex();

    // ASSETS
    brush.loadImage("mouse/brush.png");
	stamp.loadImage("logo/stamp_white2.png");
	demo.loadMovie(BASEPATH + "demo/studio_in_the_city_6_promo.mp4");
    
    // MEMORY
    checkMemory();

	cout << "Setup Is Done \n" << endl;
}
  void ArtistsWidget::on_resize3() {

    std::cout << "resize3";
    loadArtists();
  }
 void ArtistsWidget::reload() {
   loadArtists();
 }