MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / ShowDialog

Method ShowDialog

Source/PCMImport.cpp:196–225  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

194END_MESSAGE_MAP()
195
196std::shared_ptr<ft0cc::doc::dpcm_sample> CPCMImport::ShowDialog() { // // //
197 // Return imported sample, or NULL if cancel/error
198
199 CFileSoundDialog OpenFileDialog(TRUE, 0, 0, OFN_HIDEREADONLY, LoadDefaultFilter(IDS_FILTER_WAV, L"*.wav"));
200
201 auto path = FTEnv.GetSettings()->GetPath(PATH_WAV); // // //
202 OpenFileDialog.m_pOFN->lpstrInitialDir = path.c_str();
203 if (OpenFileDialog.DoModal() == IDCANCEL)
204 return nullptr;
205
206 // Stop any preview
207 PlaySoundW(NULL, NULL, SND_NODEFAULT | SND_SYNC);
208
209 FTEnv.GetSettings()->SetPath(fs::path {(LPCWSTR)OpenFileDialog.GetPathName()}.parent_path(), PATH_WAV);
210
211 m_strPath = OpenFileDialog.GetPathName();
212 m_strFileName = OpenFileDialog.GetFileName();
213 m_pImported.reset(); // // //
214
215 // Open file and read header
216 if (!OpenWaveFile())
217 return NULL;
218
219 CDialog::DoModal();
220
221 // Close file
222 m_fSampleFile.Close();
223
224 return m_pImported;
225}
226
227// CPCMImport message handlers
228

Callers 2

OnCreateWAVMethod · 0.45
OnBnClickedImportMethod · 0.45

Calls 6

LoadDefaultFilterFunction · 0.85
GetPathMethod · 0.80
SetPathMethod · 0.80
GetSettingsMethod · 0.45
resetMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected