Skip to content

Commit

Permalink
Exposed LOADWAV command in GUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
captainys committed Apr 15, 2023
1 parent 1160c01 commit 8701c2a
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
47 changes: 47 additions & 0 deletions gui/src/main_gui/fsguiapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ void FsGuiMainCanvas::MakeMainMenu(void)
}
}

{
auto *subMenu=mainMenu->AddTextItem(0,FSKEY_U,L"Sound")->GetSubMenu();
subMenu->AddTextItem(0,FSKEY_R,"Select WAV File for PCM Sampling in the VM")->BindCallBack(&THISCLASS::Audio_SelectWAVToPCMRecording,this);
}

{
auto *subMenu=mainMenu->AddTextItem(0,FSKEY_A,L"Automation")->GetSubMenu();
subMenu->AddTextItem(0,FSKEY_B,"Begin Recording")->BindCallBack(&THISCLASS::EventLog_StartRecording,this);
Expand Down Expand Up @@ -2041,6 +2046,48 @@ void FsGuiMainCanvas::VM_SaveScreenshot_FileSelected(FsGuiDialog *dlg,int return

////////////////////////////////////////////////////////////

void FsGuiMainCanvas::Audio_SelectWAVToPCMRecording(FsGuiPopUpMenuItem *)
{
if(true==IsVMRunning())
{
YsWString path,file;
profileDlg->profileFNameTxt->GetWText().SeparatePathFile(path,file);

auto fdlg=FsGuiDialog::CreateSelfDestructiveDialog<FsGuiFileDialog>();
fdlg->Initialize();
fdlg->mode=FsGuiFileDialog::MODE_OPEN;
fdlg->multiSelect=YSFALSE;
fdlg->title.Set(L"Select WAV for PCM Recording");
fdlg->fileExtensionArray.Append(L".wav");
fdlg->defaultFileName=path;
fdlg->BindCloseModalCallBack(&THISCLASS::Audio_Audio_SelectWAVToPCMRecording_FileSelected,this);
AttachModalDialog(fdlg);
}
else
{
VM_Not_Running_Error();
}
}
void FsGuiMainCanvas::Audio_Audio_SelectWAVToPCMRecording_FileSelected(FsGuiDialog *dlg,int returnCode)
{
auto fdlg=dynamic_cast <FsGuiFileDialog *>(dlg);
if(nullptr!=fdlg && (int)YSOK==returnCode)
{
YsWString fName=fdlg->selectedFileArray[0];
YsString utf8;
YsUnicodeToSystemEncoding(utf8,fName);
std::string cmd="LOADWAV ";
cmd.push_back('\"');
cmd+=utf8.c_str();
cmd.push_back('\"');
cmd.push_back('\n');
SendVMCommand(cmd);
VMMustResume=YSTRUE;
}
}

////////////////////////////////////////////////////////////

void FsGuiMainCanvas::CD_SelectImageFile(FsGuiPopUpMenuItem *)
{
if(true==IsVMRunning())
Expand Down
4 changes: 4 additions & 0 deletions gui/src/main_gui/fsguiapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,10 @@ class FsGuiMainCanvas : public FsGuiCanvas
void VM_Test_PrintTimeBalance(FsGuiPopUpMenuItem *);


void Audio_SelectWAVToPCMRecording(FsGuiPopUpMenuItem *);
void Audio_Audio_SelectWAVToPCMRecording_FileSelected(FsGuiDialog *dlg,int returnCode);


void CD_SelectImageFile(FsGuiPopUpMenuItem *);
void CD_ImageFileSelected(FsGuiDialog *dlg,int returnCode);
void CD_Eject(FsGuiPopUpMenuItem *);
Expand Down

0 comments on commit 8701c2a

Please sign in to comment.