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,6 +23,15 @@
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 (dragMobileMenu) {
if (portrait) {
mobileMenuPos=(dragMobileMenuOrigin.y-ImGui::GetMousePos().y)/(canvasH*0.65);
} else {
mobileMenuPos=(ImGui::GetMousePos().x-dragMobileMenuOrigin.x)/(canvasW*0.65);
}
if (mobileMenuPos<0.0f) mobileMenuPos=0.0f;
if (mobileMenuPos>1.0f) mobileMenuPos=1.0f;
} else {
if (mobileMenuOpen) { if (mobileMenuOpen) {
if (mobileMenuPos<0.999f) { if (mobileMenuPos<0.999f) {
WAKE_UP; WAKE_UP;
@ -38,6 +47,7 @@ void FurnaceGUI::drawMobileControls() {
mobileMenuPos=0.0f; 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));
ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH)); ImGui::SetNextWindowSize(portrait?ImVec2(canvasW,0.16*canvasW):ImVec2(0.16*canvasH,canvasH));
if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) { if (ImGui::Begin("Mobile Controls",NULL,ImGuiWindowFlags_NoScrollbar|ImGuiWindowFlags_NoScrollWithMouse|globalWinFlags)) {
@ -54,8 +64,21 @@ void FurnaceGUI::drawMobileControls() {
} }
} }
if (ImGui::Button(mobButtonName,buttonSize)) { if (ImGui::Button(mobButtonName,buttonSize)) {
if (!dragMobileMenu) {
mobileMenuOpen=!mobileMenuOpen; 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;