Skip to content

Commit 1f2530f

Browse files
committed
VGMColl: Add support for exporting all three things
1 parent 99804a1 commit 1f2530f

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/main/VGMColl.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,4 +588,33 @@ bool VGMColl::OnSaveAllSF2() {
588588
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save MIDI file"), LOG_LEVEL_ERR, L"VGMColl"));
589589
}
590590
return true;
591-
}
591+
}
592+
593+
bool VGMColl::OnSaveAllBoth() {
594+
wstring dirpath = pRoot->UI_GetSaveDirPath();
595+
if (dirpath.length() != 0) {
596+
wstring filepath = dirpath + L"\\" + ConvertToSafeFileName(this->name) + L".sf2";
597+
SF2File *sf2file = CreateSF2File();
598+
if (sf2file != NULL) {
599+
if (!sf2file->SaveSF2File(filepath))
600+
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save SF2 file"), LOG_LEVEL_ERR, L"VGMColl"));
601+
delete sf2file;
602+
}
603+
else
604+
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save SF2 file"), LOG_LEVEL_ERR, L"VGMColl"));
605+
606+
DLSFile dlsfile;
607+
filepath = dirpath + L"\\" + ConvertToSafeFileName(this->name) + L".dls";
608+
if (CreateDLSFile(dlsfile)) {
609+
if (!dlsfile.SaveDLSFile(filepath))
610+
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save DLS file"), LOG_LEVEL_ERR, L"VGMColl"));
611+
}
612+
else
613+
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save DLS file"), LOG_LEVEL_ERR, L"VGMColl"));
614+
615+
filepath = dirpath + L"\\" + ConvertToSafeFileName(this->name) + L".mid";
616+
if (!this->seq->SaveAsMidi(filepath))
617+
pRoot->AddLogItem(new LogItem(std::wstring(L"Failed to save MIDI file"), LOG_LEVEL_ERR, L"VGMColl"));
618+
}
619+
return true;
620+
}

src/main/VGMColl.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class VGMColl
1717
BEGIN_MENU(VGMColl)
1818
MENU_ITEM(VGMColl, OnSaveAllDLS, L"Save as MIDI and DLS.")
1919
MENU_ITEM(VGMColl, OnSaveAllSF2, L"Save as MIDI and SoundFont 2.")
20+
MENU_ITEM(VGMColl, OnSaveAllBoth, L"Save as MIDI, DLS, SF2.")
2021
//MENU_ITEM(VGMFile, OnSaveAllAsRaw, L"Save all as original format")
2122
END_MENU()
2223

@@ -42,6 +43,7 @@ class VGMColl
4243

4344
bool OnSaveAllDLS();
4445
bool OnSaveAllSF2();
46+
bool OnSaveAllBoth();
4547

4648
VGMSeq *seq;
4749
std::vector<VGMInstrSet *> instrsets;

0 commit comments

Comments
 (0)