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

Method OnFileNameChange

Source/InstrumentEditorDPCM.cpp:91–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void CDMCFileSoundDialog::OnFileNameChange()
92{
93 // Preview DMC file
94 if (!GetFileExt().CompareNoCase(L"dmc") && FTEnv.GetSettings()->General.bWavePreview) {
95 DWORD dwAttrib = GetFileAttributesW(GetPathName());
96 if (!(dwAttrib & FILE_ATTRIBUTE_DIRECTORY) && GetPathName() != m_strLastFile) {
97 CFile file(GetPathName(), CFile::modeRead);
98 auto size = std::min<unsigned>(static_cast<unsigned>(file.GetLength()), ft0cc::doc::dpcm_sample::max_size);
99 std::vector<uint8_t> pBuf(size);
100 file.Read(pBuf.data(), size);
101 FTEnv.GetSoundGenerator()->PreviewSample(std::make_shared<ft0cc::doc::dpcm_sample>(std::move(pBuf), ""),
102 0, DEFAULT_PREVIEW_PITCH); // // //
103 file.Close();
104 m_strLastFile = GetPathName();
105 }
106 }
107
108 CFileDialog::OnFileNameChange();
109}
110
111
112

Callers

nothing calls this directly

Calls 7

PreviewSampleMethod · 0.80
GetSettingsMethod · 0.45
GetLengthMethod · 0.45
ReadMethod · 0.45
dataMethod · 0.45
GetSoundGeneratorMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected