| 194 | END_MESSAGE_MAP() |
| 195 | |
| 196 | std::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 |
no test coverage detected