Merge branch 'master' into brr

This commit is contained in:
tildearrow 2022-12-04 17:44:57 -05:00
commit eaa9a5879a
4 changed files with 52 additions and 11 deletions

View file

@ -106,6 +106,13 @@ bool TAAudioSDL::init(TAAudioDesc& request, TAAudioDesc& response) {
audioSysStarted=true; audioSysStarted=true;
} }
const char* audioDriver=SDL_GetCurrentAudioDriver();
if (audioDriver==NULL) {
logD("SDL audio driver: NULL!");
} else {
logD("SDL audio driver: %s",audioDriver);
}
desc=request; desc=request;
desc.outFormat=TA_AUDIO_FORMAT_F32; desc.outFormat=TA_AUDIO_FORMAT_F32;

View file

@ -23,19 +23,29 @@
void FurnaceGUI::drawMobileControls() { void FurnaceGUI::drawMobileControls() {
float timeScale=1.0f/(60.0f*ImGui::GetIO().DeltaTime); float timeScale=1.0f/(60.0f*ImGui::GetIO().DeltaTime);
if (mobileMenuOpen) { if (dragMobileMenu) {
if (mobileMenuPos<0.999f) { if (portrait) {
WAKE_UP; mobileMenuPos=(dragMobileMenuOrigin.y-ImGui::GetMousePos().y)/(canvasH*0.65);
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
} else { } else {
mobileMenuPos=1.0f; mobileMenuPos=(ImGui::GetMousePos().x-dragMobileMenuOrigin.x)/(canvasW*0.65);
} }
if (mobileMenuPos<0.0f) mobileMenuPos=0.0f;
if (mobileMenuPos>1.0f) mobileMenuPos=1.0f;
} else { } else {
if (mobileMenuPos>0.001f) { if (mobileMenuOpen) {
WAKE_UP; if (mobileMenuPos<0.999f) {
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale; WAKE_UP;
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
} else {
mobileMenuPos=1.0f;
}
} else { } else {
mobileMenuPos=0.0f; if (mobileMenuPos>0.001f) {
WAKE_UP;
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale;
} else {
mobileMenuPos=0.0f;
}
} }
} }
ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f)); ImGui::SetNextWindowPos(portrait?ImVec2(0.0f,((1.0-mobileMenuPos*0.65)*canvasH)-(0.16*canvasW)):ImVec2(0.5*canvasW*mobileMenuPos,0.0f));
@ -54,7 +64,20 @@ void FurnaceGUI::drawMobileControls() {
} }
} }
if (ImGui::Button(mobButtonName,buttonSize)) { if (ImGui::Button(mobButtonName,buttonSize)) {
mobileMenuOpen=!mobileMenuOpen; if (!dragMobileMenu) {
mobileMenuOpen=!mobileMenuOpen;
}
}
if (ImGui::IsItemActive() && ImGui::GetIO().MouseDragMaxDistanceSqr[ImGuiMouseButton_Left]>ImGui::GetIO().ConfigInertialScrollToleranceSqr*2.0f) {
if (!dragMobileMenu) {
dragMobileMenu=true;
dragMobileMenuOrigin=ImGui::GetMousePos();
if (portrait) {
dragMobileMenuOrigin.y+=mobileMenuPos*canvasH*0.65f;
} else {
dragMobileMenuOrigin.x-=mobileMenuPos*canvasW*0.65f;
}
}
} }
if (!portrait) ImGui::Separator(); if (!portrait) ImGui::Separator();

View file

@ -2931,6 +2931,14 @@ void FurnaceGUI::pointUp(int x, int y, int button) {
} }
orderScrollLocked=false; orderScrollLocked=false;
orderScrollTolerance=false; orderScrollTolerance=false;
if (dragMobileMenu) {
dragMobileMenu=false;
if (mobileMenuOpen) {
mobileMenuOpen=(mobileMenuPos>=0.85f);
} else {
mobileMenuOpen=(mobileMenuPos>=0.15f);
}
}
if (selecting) { if (selecting) {
if (!selectingFull) cursor=selEnd; if (!selectingFull) cursor=selEnd;
finishSelection(); finishSelection();
@ -5785,6 +5793,7 @@ FurnaceGUI::FurnaceGUI():
keepLoopAlive(false), keepLoopAlive(false),
orderScrollLocked(false), orderScrollLocked(false),
orderScrollTolerance(false), orderScrollTolerance(false),
dragMobileMenu(false),
curWindow(GUI_WINDOW_NOTHING), curWindow(GUI_WINDOW_NOTHING),
nextWindow(GUI_WINDOW_NOTHING), nextWindow(GUI_WINDOW_NOTHING),
curWindowLast(GUI_WINDOW_NOTHING), curWindowLast(GUI_WINDOW_NOTHING),
@ -5877,6 +5886,7 @@ FurnaceGUI::FurnaceGUI():
orderScroll(0.0f), orderScroll(0.0f),
orderScrollSlideOrigin(0.0f), orderScrollSlideOrigin(0.0f),
orderScrollRealOrigin(0.0f,0.0f), orderScrollRealOrigin(0.0f,0.0f),
dragMobileMenuOrigin(0.0f,0.0f),
layoutTimeBegin(0), layoutTimeBegin(0),
layoutTimeEnd(0), layoutTimeEnd(0),
layoutTimeDelta(0), layoutTimeDelta(0),

View file

@ -1435,7 +1435,7 @@ class FurnaceGUI {
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd; SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI; bool selecting, selectingFull, dragging, curNibble, orderNibble, followOrders, followPattern, changeAllOrders, mobileUI;
bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble; bool collapseWindow, demandScrollX, fancyPattern, wantPatName, firstFrame, tempoView, waveHex, waveSigned, waveGenVisible, lockLayout, editOptsVisible, latchNibble, nonLatchNibble;
bool keepLoopAlive, orderScrollLocked, orderScrollTolerance; bool keepLoopAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu;
FurnaceGUIWindows curWindow, nextWindow, curWindowLast; FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
std::atomic<FurnaceGUIWindows> curWindowThreadSafe; std::atomic<FurnaceGUIWindows> curWindowThreadSafe;
float peak[2]; float peak[2];
@ -1581,6 +1581,7 @@ class FurnaceGUI {
float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin; float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin;
ImVec2 orderScrollRealOrigin; ImVec2 orderScrollRealOrigin;
ImVec2 dragMobileMenuOrigin;
int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta; int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta;
int renderTimeBegin, renderTimeEnd, renderTimeDelta; int renderTimeBegin, renderTimeEnd, renderTimeDelta;