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;
}
const char* audioDriver=SDL_GetCurrentAudioDriver();
if (audioDriver==NULL) {
logD("SDL audio driver: NULL!");
} else {
logD("SDL audio driver: %s",audioDriver);
}
desc=request;
desc.outFormat=TA_AUDIO_FORMAT_F32;

View file

@ -23,19 +23,29 @@
void FurnaceGUI::drawMobileControls() {
float timeScale=1.0f/(60.0f*ImGui::GetIO().DeltaTime);
if (mobileMenuOpen) {
if (mobileMenuPos<0.999f) {
WAKE_UP;
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
if (dragMobileMenu) {
if (portrait) {
mobileMenuPos=(dragMobileMenuOrigin.y-ImGui::GetMousePos().y)/(canvasH*0.65);
} 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 {
if (mobileMenuPos>0.001f) {
WAKE_UP;
mobileMenuPos-=MIN(0.1,mobileMenuPos*0.65)*timeScale;
if (mobileMenuOpen) {
if (mobileMenuPos<0.999f) {
WAKE_UP;
mobileMenuPos+=MIN(0.1,(1.0-mobileMenuPos)*0.65)*timeScale;
} else {
mobileMenuPos=1.0f;
}
} 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));
@ -54,7 +64,20 @@ void FurnaceGUI::drawMobileControls() {
}
}
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();

View file

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

View file

@ -1435,7 +1435,7 @@ class FurnaceGUI {
SelectionPoint selStart, selEnd, cursor, cursorDrag, dragStart, dragEnd;
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 keepLoopAlive, orderScrollLocked, orderScrollTolerance;
bool keepLoopAlive, orderScrollLocked, orderScrollTolerance, dragMobileMenu;
FurnaceGUIWindows curWindow, nextWindow, curWindowLast;
std::atomic<FurnaceGUIWindows> curWindowThreadSafe;
float peak[2];
@ -1581,6 +1581,7 @@ class FurnaceGUI {
float nextScroll, nextAddScroll, orderScroll, orderScrollSlideOrigin;
ImVec2 orderScrollRealOrigin;
ImVec2 dragMobileMenuOrigin;
int layoutTimeBegin, layoutTimeEnd, layoutTimeDelta;
int renderTimeBegin, renderTimeEnd, renderTimeDelta;