Skip to content

Commit

Permalink
Jason Brooke ext rename fix. remote load thread problem. etc
Browse files Browse the repository at this point in the history
  • Loading branch information
sasq64 committed Dec 13, 2015
1 parent 75e97dd commit 90b28a5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
Binary file removed music/Amiga/rho.Rob Hubbard - Gold Runner
Binary file not shown.
2 changes: 1 addition & 1 deletion src/ChipMachine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ void ChipMachine::update() {

auto sub_title = player.getMeta("sub_title");

int tw = font.get_width(currentInfo.title, currentInfoField[0].scale);
int tw = currentInfoField.getWidth(0);

auto f = [=]() {
xinfoField.setText(sub_title);
Expand Down
23 changes: 18 additions & 5 deletions src/MusicPlayerList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,8 @@ void MusicPlayerList::seek(int song, int seconds) {
if(!checkPermission(CAN_SEEK))
return;
if(multiSongs.size()) {
currentInfo.path = multiSongs[song];
changedMulti = true;
LOGD("CHANGED MULTI");
playCurrent();
//changedSong = true;
state = PLAY_MULTI;
multiSongNo = song;
return;
}
Expand Down Expand Up @@ -146,7 +143,8 @@ int MusicPlayerList::listSize() {

/// PRIVATE

bool MusicPlayerList::playFile(const std::string &fileName) {
bool MusicPlayerList::playFile(const std::string &fn) {
auto fileName = fn;
if(fileName == "")
return false;
auto ext = toLower(path_extension(fileName));
Expand Down Expand Up @@ -209,6 +207,14 @@ bool MusicPlayerList::playFile(const std::string &fileName) {
SET_STATE(WAITING);
return true;
}
else
if(ext == "jb") {
// Jason Brooke fix
string newName = fileName.substr(0, fileName.find_last_of('.')) + ".jcb";
if(!File::exists(newName))
File::copy(fileName, newName);
fileName = newName;
}

if(mp.playFile(fileName)) {
#ifdef USE_REMOTELISTS
Expand Down Expand Up @@ -273,6 +279,13 @@ void MusicPlayerList::update() {
playCurrent();
}

if(state == PLAY_MULTI) {
SET_STATE(STARTED);
currentInfo.path = multiSongs[multiSongNo];
changedMulti = true;
playCurrent();
}

if(state == PLAYING || state == PLAY_STARTED) {

auto pos = mp.getPosition();
Expand Down
3 changes: 2 additions & 1 deletion src/MusicPlayerList.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class MusicPlayerList {
PLAY_STARTED,
PLAYING,
FADING,
PLAY_NOW
PLAY_NOW,
PLAY_MULTI
};

MusicPlayerList(const std::string &workDir);
Expand Down
4 changes: 4 additions & 0 deletions src/SongInfoField.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ struct SongInfoField : public Renderable {
fields[2]->setText(info.format);
}

int getWidth(int no) {
return fields[no]->getWidth();
}

SongInfoField& operator=(const SongInfoField &other) {
for(int i=0; i<3; i++)
fields[i]->setText(other.fields[i]->getText());
Expand Down

0 comments on commit 90b28a5

Please sign in to comment.