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

Method InsertSample

Source/InstrumentEditorDPCM.cpp:296–313  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

294}
295
296bool CInstrumentEditorDPCM::InsertSample(std::shared_ptr<ft0cc::doc::dpcm_sample> pNewSample) // // //
297{
298 auto *pManager = GetDSampleManager();
299 int FreeSlot = pManager->GetFirstFree();
300
301 // Out of sample slots
302 if (FreeSlot == -1)
303 return false;
304
305 int Size = pManager->GetTotalSize();
306
307 if ((Size + pNewSample->size()) > MAX_SAMPLE_SPACE)
308 AfxMessageBox(AfxFormattedW(IDS_OUT_OF_SAMPLEMEM_FORMAT, conv::to_wide(conv::sv_from_int(MAX_SAMPLE_SPACE / 1024)).data()), MB_ICONERROR); // // //
309 else if (pManager->SetDSample(FreeSlot, std::move(pNewSample))) // // //
310 GetDocument()->ModifyIrreversible();
311
312 return true;
313}
314
315void CInstrumentEditorDPCM::OnBnClickedLoad()
316{

Callers

nothing calls this directly

Calls 9

AfxFormattedWFunction · 0.85
to_wideFunction · 0.85
sv_from_intFunction · 0.85
GetTotalSizeMethod · 0.80
ModifyIrreversibleMethod · 0.80
GetFirstFreeMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
SetDSampleMethod · 0.45

Tested by

no test coverage detected