Merge branch 'master' of https://github.com/tildearrow/furnace into k053260

This commit is contained in:
cam900 2023-07-07 20:41:52 +09:00
commit 79a082c5d2
14 changed files with 504 additions and 14 deletions

View file

@ -134,6 +134,7 @@ const char* aboutLine[]={
"fd",
"GENATARi",
"host12prog",
"jvsTSX",
"Lumigado",
"Lunathir",
"plane",

View file

@ -388,6 +388,34 @@ void FurnaceGUI::drawDebug() {
ImGui::Text("System Managed Scale: %d",sysManagedScale);
ImGui::TreePop();
}
if (ImGui::TreeNode("Audio Debug")) {
TAAudioDesc& audioWant=e->getAudioDescWant();
TAAudioDesc& audioGot=e->getAudioDescGot();
ImGui::Text("want:");
ImGui::Text("- name: %s",audioWant.name.c_str());
ImGui::Text("- device name: %s",audioWant.deviceName.c_str());
ImGui::Text("- rate: %f",audioWant.rate);
ImGui::Text("- buffer size: %d",audioWant.bufsize);
ImGui::Text("- fragments: %d",audioWant.fragments);
ImGui::Text("- inputs: %d",audioWant.inChans);
ImGui::Text("- outputs: %d",audioWant.outChans);
ImGui::Text("- format: %d",audioWant.outFormat);
ImGui::Text("got:");
ImGui::Text("- name: %s",audioGot.name.c_str());
ImGui::Text("- device name: %s",audioGot.deviceName.c_str());
ImGui::Text("- rate: %f",audioGot.rate);
ImGui::Text("- buffer size: %d",audioGot.bufsize);
ImGui::Text("- fragments: %d",audioGot.fragments);
ImGui::Text("- inputs: %d",audioGot.inChans);
ImGui::Text("- outputs: %d",audioGot.outChans);
ImGui::Text("- format: %d",audioGot.outFormat);
ImGui::Text("last call to nextBuf(): in %d, out %d, size %d",e->lastNBIns,e->lastNBOuts,e->lastNBSize);
ImGui::TreePop();
}
if (ImGui::TreeNode("Visualizer Debug")) {
if (ImGui::BeginTable("visX",3,ImGuiTableFlags_Borders)) {
ImGui::TableNextRow(ImGuiTableRowFlags_Headers);

View file

@ -6329,6 +6329,19 @@ bool FurnaceGUI::init() {
}
#endif
int numDriversA=SDL_GetNumAudioDrivers();
if (numDriversA<0) {
logW("could not list audio drivers! %s",SDL_GetError());
} else {
for (int i=0; i<numDriversA; i++) {
const char* r=SDL_GetAudioDriver(i);
if (r==NULL) continue;
if (strcmp(r,"disk")==0) continue;
if (strcmp(r,"dummy")==0) continue;
availAudioDrivers.push_back(String(r));
}
}
int numDrivers=SDL_GetNumRenderDrivers();
if (numDrivers<0) {
logW("could not list render drivers! %s",SDL_GetError());

View file

@ -1305,6 +1305,7 @@ class FurnaceGUI {
std::deque<String> recentFile;
std::vector<DivInstrumentType> makeInsTypeList;
std::vector<String> availRenderDrivers;
std::vector<String> availAudioDrivers;
bool quit, warnQuit, willCommit, edit, modified, displayError, displayExporting, vgmExportLoop, zsmExportLoop, vgmExportPatternHints;
bool vgmExportDirectStream, displayInsTypeList;
@ -1535,6 +1536,7 @@ class FurnaceGUI {
String macroRelLabel;
String emptyLabel;
String emptyLabel2;
String sdlAudioDriver;
DivConfig initialSys;
Settings():
@ -1687,7 +1689,8 @@ class FurnaceGUI {
noteRelLabel("==="),
macroRelLabel("REL"),
emptyLabel("..."),
emptyLabel2("..") {}
emptyLabel2(".."),
sdlAudioDriver("") {}
} settings;
struct Tutorial {

View file

@ -133,17 +133,20 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
}
ImGui::PopStyleColor();
// for each column
int mustSetXOf=0;
for (int j=0; j<chans; j++) {
// check if channel is not hidden
if (!e->curSubSong->chanShow[j]) {
patChanX[j]=ImGui::GetCursorScreenPos().x;
continue;
}
int chanVolMax=e->getMaxVolumeChan(j);
if (chanVolMax<1) chanVolMax=1;
const DivPattern* pat=patCache[j];
ImGui::TableNextColumn();
patChanX[j]=ImGui::GetCursorScreenPos().x;
for (int k=mustSetXOf; k<=j; k++) {
patChanX[k]=ImGui::GetCursorScreenPos().x;
}
mustSetXOf=j+1;
// selection highlight flags
int sel1XSum=sel1.xCoarse*32+sel1.xFine;
@ -358,7 +361,9 @@ inline void FurnaceGUI::patternRow(int i, bool isPlaying, float lineHeight, int
ImGui::PopStyleColor();
}
ImGui::TableNextColumn();
patChanX[chans]=ImGui::GetCursorScreenPos().x;
for (int k=mustSetXOf; k<=chans; k++) {
patChanX[k]=ImGui::GetCursorScreenPos().x;
}
}
void FurnaceGUI::drawPattern() {
@ -371,7 +376,6 @@ void FurnaceGUI::drawPattern() {
if (!patternOpen) return;
bool inhibitMenu=false;
float scrollX=0;
if (e->isPlaying() && followPattern && (!e->isStepping() || pendingStepUpdate)) {
cursor.y=oldRow+((pendingStepUpdate)?1:0);
@ -946,7 +950,6 @@ void FurnaceGUI::drawPattern() {
}
demandScrollX=false;
}
scrollX=ImGui::GetScrollX();
// overflow changes order
// TODO: this is very unreliable and sometimes it can warp you out of the song
@ -1119,6 +1122,8 @@ void FurnaceGUI::drawPattern() {
break;
}
if (!e->curSubSong->chanShow[i.chan]) continue;
for (int j=0; j<num; j++) {
ImVec2 partPos=ImVec2(
off.x+patChanX[i.chan]+fmod(rand(),width),
@ -1175,8 +1180,8 @@ void FurnaceGUI::drawPattern() {
}
if (width>0.1) for (float j=-patChanSlideY[i]; j<ImGui::GetWindowHeight(); j+=width*0.7) {
ImVec2 tMin=ImVec2(off.x+patChanX[i]-scrollX,off.y+j);
ImVec2 tMax=ImVec2(off.x+patChanX[i+1]-scrollX,off.y+j+width*0.6);
ImVec2 tMin=ImVec2(off.x+patChanX[i],off.y+j);
ImVec2 tMax=ImVec2(off.x+patChanX[i+1],off.y+j+width*0.6);
if (ch->portaNote<=ch->note) {
arrowPoints[0]=ImLerp(tMin,tMax,ImVec2(0.1,1.0-0.8));
arrowPoints[1]=ImLerp(tMin,tMax,ImVec2(0.5,1.0-0.0));

View file

@ -807,6 +807,25 @@ void FurnaceGUI::drawSettings() {
}
#endif
if (settings.audioEngine==DIV_AUDIO_SDL) {
ImGui::Text("Driver");
ImGui::SameLine();
if (ImGui::BeginCombo("##SDLADriver",settings.sdlAudioDriver.empty()?"Automatic":settings.sdlAudioDriver.c_str())) {
if (ImGui::Selectable("Automatic",settings.sdlAudioDriver.empty())) {
settings.sdlAudioDriver="";
}
for (String& i: availAudioDrivers) {
if (ImGui::Selectable(i.c_str(),i==settings.sdlAudioDriver)) {
settings.sdlAudioDriver=i;
}
}
ImGui::EndCombo();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
}
}
ImGui::Text("Device");
ImGui::SameLine();
String audioDevName=settings.audioDevice.empty()?"<System default>":settings.audioDevice;
@ -1324,6 +1343,9 @@ void FurnaceGUI::drawSettings() {
#endif
ImGui::EndCombo();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
}
if (curRenderBackend=="SDL") {
if (ImGui::BeginCombo("Render driver",settings.renderDriver.empty()?"Automatic":settings.renderDriver.c_str())) {
if (ImGui::Selectable("Automatic",settings.renderDriver.empty())) {
@ -1336,6 +1358,9 @@ void FurnaceGUI::drawSettings() {
}
ImGui::EndCombo();
}
if (ImGui::IsItemHovered()) {
ImGui::SetTooltip("you may need to restart Furnace for this setting to take effect.");
}
}
bool dpiScaleAuto=(settings.dpiScale<0.5f);
@ -2639,6 +2664,7 @@ void FurnaceGUI::syncSettings() {
settings.midiOutDevice=e->getConfString("midiOutDevice","");
settings.c163Name=e->getConfString("c163Name",DIV_C163_DEFAULT_NAME);
settings.renderDriver=e->getConfString("renderDriver","");
settings.sdlAudioDriver=e->getConfString("sdlAudioDriver","");
settings.audioQuality=e->getConfInt("audioQuality",0);
settings.audioBufSize=e->getConfInt("audioBufSize",1024);
settings.audioRate=e->getConfInt("audioRate",44100);
@ -2987,6 +3013,7 @@ void FurnaceGUI::commitSettings() {
e->setConf("midiOutDevice",settings.midiOutDevice);
e->setConf("c163Name",settings.c163Name);
e->setConf("renderDriver",settings.renderDriver);
e->setConf("sdlAudioDriver",settings.sdlAudioDriver);
e->setConf("audioQuality",settings.audioQuality);
e->setConf("audioBufSize",settings.audioBufSize);
e->setConf("audioRate",settings.audioRate);