Media Player Help

Hi, I’m working on the beginnings of a media player similar to VLC. I started building the code with just loading a directory of sound files into a vector and attempting to play them. I worked from an oF example that goes through loading the contents of a directory. I’ve got the sounds loaded (I think), but only one plays, the very last sound in the vector, and I can’t get any others to play no matter what index I put in. This leads me to believe that only the last sound file is getting loaded in each index. Also, the sound loading is pretty slow. Is there any way to speed it up?

ofApp.h:

`#pragma once

#include “ofMain.h”

class ofApp : public ofBaseApp{

public:
	void setup();
	void update();
	void draw();

	void keyPressed(int key);
	void keyReleased(int key);
	void mouseMoved(int x, int y );
	void mouseDragged(int x, int y, int button);
	void mousePressed(int x, int y, int button);
	void mouseReleased(int x, int y, int button);
	void mouseEntered(int x, int y);
	void mouseExited(int x, int y);
	void windowResized(int w, int h);
	void dragEvent(ofDragInfo dragInfo);
	void gotMessage(ofMessage msg);

    ofDirectory dir;
    vector<ofSoundPlayer> songs;

    int currentSong;

};
`

ofApp.cpp

`#include “ofApp.h”

//--------------------------------------------------------------
void ofApp::setup(){
dir.listDir(“songs”);
dir.sort();

if( dir.size() ) {
    songs.assign(dir.size(), ofSoundPlayer());
}

for(int i = 0; i < (int)dir.size(); i++){
    songs[i].load(dir.getPath(i));
}

currentSong = 13;

ofBackground(ofColor::white);

//ofLogNotice() << songs.size();

songs[currentSong].play();

}

//--------------------------------------------------------------
void ofApp::update(){
//songs[currentSong].play();
}

//--------------------------------------------------------------
void ofApp::draw(){

}

//--------------------------------------------------------------
void ofApp::keyPressed(int key){
/*
if (dir.size() > 0){
currentSong++;
currentSong %= dir.size();
}
*/
}

//--------------------------------------------------------------
void ofApp::keyReleased(int key){

}

//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ){

}

//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button){

}

//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y){

}

//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y){

}

//--------------------------------------------------------------
void ofApp::windowResized(int w, int h){

}

//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg){

}

//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo){

}
`

Please forgive me as I cannot get the formatting correct on the site. Any help would be appreciated. Thanks.