more reference player work
This commit is contained in:
parent
c7fe8fea80
commit
a49306b4bd
7 changed files with 34 additions and 5 deletions
|
|
@ -569,6 +569,7 @@ void DivEngine::createNew(const char* description, String sysName, bool inBase64
|
|||
BUSY_BEGIN;
|
||||
renderSamples();
|
||||
reset();
|
||||
calcSongTimestamps();
|
||||
BUSY_END;
|
||||
}
|
||||
|
||||
|
|
@ -606,6 +607,7 @@ void DivEngine::createNewFromDefaults() {
|
|||
BUSY_BEGIN;
|
||||
renderSamples();
|
||||
reset();
|
||||
calcSongTimestamps();
|
||||
BUSY_END;
|
||||
}
|
||||
|
||||
|
|
@ -3999,6 +4001,9 @@ void DivEngine::quitDispatch() {
|
|||
totalCmds=0;
|
||||
lastCmds=0;
|
||||
cmdsPerSecond=0;
|
||||
if (filePlayerSync) {
|
||||
if (curFilePlayer!=NULL) curFilePlayer->stop();
|
||||
}
|
||||
for (int i=0; i<DIV_MAX_CHANS; i++) {
|
||||
isMuted[i]=0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1573,7 +1573,7 @@ class DivEngine {
|
|||
previewVol(1.0f),
|
||||
filePlayerBufLen(0),
|
||||
curFilePlayer(NULL),
|
||||
filePlayerSync(true),
|
||||
filePlayerSync(false),
|
||||
filePlayerCueSeconds(0),
|
||||
filePlayerCueMicros(0),
|
||||
totalProcessed(0),
|
||||
|
|
|
|||
|
|
@ -265,9 +265,9 @@ void DivFilePlayer::mix(float** buf, int chans, unsigned int size) {
|
|||
while (rateAccum>=outRate) {
|
||||
rateAccum-=outRate;
|
||||
playPos++;
|
||||
if (playPos>=(ssize_t)si.frames) {
|
||||
/*if (playPos>=(ssize_t)si.frames) {
|
||||
playPos=0;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
} else {
|
||||
for (int j=0; j<chans; j++) {
|
||||
|
|
|
|||
|
|
@ -3865,6 +3865,7 @@ bool FurnaceGUI::loop() {
|
|||
|
||||
while (!quit) {
|
||||
SDL_Event ev;
|
||||
SelectionPoint prevCursor=cursor;
|
||||
if (e->isPlaying()) {
|
||||
WAKE_UP;
|
||||
}
|
||||
|
|
@ -7384,6 +7385,19 @@ bool FurnaceGUI::loop() {
|
|||
recalcTimestamps=false;
|
||||
}
|
||||
|
||||
if (!e->isPlaying() && e->getFilePlayerSync()) {
|
||||
if (cursor.y!=prevCursor.y || cursor.order) {
|
||||
DivFilePlayer* fp=e->getFilePlayer();
|
||||
logV("cursor moved to %d:%d",cursor.order,cursor.y);
|
||||
if (!fp->isPlaying()) {
|
||||
DivSongTimestamps::Timestamp rowTS=e->curSubSong->ts.getTimes(cursor.order,cursor.y);
|
||||
if (rowTS.seconds!=-1) {
|
||||
fp->setPosSeconds(rowTS.seconds,rowTS.micros);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sampleMapWaitingInput=(curWindow==GUI_WINDOW_INS_EDIT && sampleMapFocused);
|
||||
|
||||
curWindowThreadSafe=curWindow;
|
||||
|
|
@ -8598,7 +8612,7 @@ FurnaceGUI::FurnaceGUI():
|
|||
noteInputPoly(true),
|
||||
notifyWaveChange(false),
|
||||
notifySampleChange(false),
|
||||
recalcTimestamps(false),
|
||||
recalcTimestamps(true),
|
||||
wantScrollListIns(false),
|
||||
wantScrollListWave(false),
|
||||
wantScrollListSample(false),
|
||||
|
|
|
|||
|
|
@ -290,6 +290,7 @@ void FurnaceGUI::drawNewSong() {
|
|||
samplePos=0;
|
||||
updateSampleTex=true;
|
||||
notifySampleChange=true;
|
||||
e->calcSongTimestamps();
|
||||
selStart=SelectionPoint();
|
||||
selEnd=SelectionPoint();
|
||||
cursor=SelectionPoint();
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ void FurnaceGUI::drawRefPlayer() {
|
|||
popToggleColors();
|
||||
|
||||
float vol=fp->getVolume();
|
||||
ImGui::SameLine();
|
||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||
if (ImGui::SliderFloat("##Volume",&vol,0.0f,1.0f)) {
|
||||
if (vol<0.0f) vol=0.0f;
|
||||
|
|
@ -93,7 +94,12 @@ void FurnaceGUI::drawRefPlayer() {
|
|||
fp->setVolume(vol);
|
||||
}
|
||||
|
||||
ImGui::Text("Memory usage: %" PRIu64 "K",fp->getMemUsage()>>10);
|
||||
//ImGui::Text("Memory usage: %" PRIu64 "K",fp->getMemUsage()>>10);
|
||||
|
||||
if (!refPlayerOpen) {
|
||||
fp->stop();
|
||||
e->setFilePlayerSync(false);
|
||||
}
|
||||
}
|
||||
if (ImGui::IsWindowFocused(ImGuiFocusedFlags_ChildWindows)) curWindow=GUI_WINDOW_REF_PLAYER;
|
||||
ImGui::End();
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
|
|||
if (ImGui::Selectable(id,i==e->getCurrentSubSong())) {
|
||||
makeCursorUndo();
|
||||
e->changeSongP(i);
|
||||
recalcTimestamps=true;
|
||||
updateScroll(0);
|
||||
oldRow=0;
|
||||
cursor.xCoarse=0;
|
||||
|
|
@ -76,6 +77,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
|
|||
} else {
|
||||
makeCursorUndo();
|
||||
e->changeSongP(e->song.subsong.size()-1);
|
||||
recalcTimestamps=true;
|
||||
updateScroll(0);
|
||||
oldRow=0;
|
||||
cursor.xCoarse=0;
|
||||
|
|
@ -98,6 +100,7 @@ void FurnaceGUI::drawSubSongs(bool asChild) {
|
|||
} else {
|
||||
makeCursorUndo();
|
||||
e->changeSongP(e->song.subsong.size()-1);
|
||||
recalcTimestamps=true;
|
||||
updateScroll(0);
|
||||
oldRow=0;
|
||||
cursor.xCoarse=0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue