diff --git a/CHANGELOG b/CHANGELOG index efe659c2..5a71afc6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,4 @@ Various additions - FX Command Box selector (#238) * In phrase and table views a selection box appears when editing FX commands * Navigate in all directions using D-PAD @@ -22,6 +21,7 @@ Various additions * Fixes "audio suddenly dies" error Fix regression caused in https://github.com/djdiskmachine/LittleGPTracker/pull/245 Fix introduced microtonality for single cycle osc, thank you @INFU-AV <3 + Purge samples actually purges samples [author: maks](https://github.com/xiphonics/picoTracker/pull/313) 1.6.0-bacon11 Slices decoupled from loop mode diff --git a/docs/wiki/tips_and_tricks.md b/docs/wiki/tips_and_tricks.md index 678c6e44..2ffab1fb 100644 --- a/docs/wiki/tips_and_tricks.md +++ b/docs/wiki/tips_and_tricks.md @@ -29,6 +29,12 @@ Since version 1.6.0, you can delete projects directly from the Project Selection **Pro Tip:** Use Save As to store a duplicate of the project if you're uncertain if you should delete something +## Compact Instruments + +Use "Compact Instruments" from the project screen to remove any samples from disk that used in any instruments. A confirmation dialog will appear before anything is deleted. + +**Pro Tip:** Run this before sharing your project before sending it over ICQ + # Delays and Echoes ## Simulating LSDj's D command diff --git a/sources/Application/Model/Project.cpp b/sources/Application/Model/Project.cpp index 56bcead3..fe1c0ff0 100644 --- a/sources/Application/Model/Project.cpp +++ b/sources/Application/Model/Project.cpp @@ -244,10 +244,7 @@ void Project::Purge() { void Project::PurgeInstruments(bool removeFromDisk) { - bool used[MAX_INSTRUMENT_COUNT] ; - for (int i=0;iphrase_->instr_ ; @@ -275,34 +272,33 @@ void Project::PurgeInstruments(bool removeFromDisk) { // clear used flag - bool iUsed[MAX_PIG_SAMPLES] ; - for (int i=0;iGetInstrument(i) ; + for (int i = 0; i < MAX_INSTRUMENT_COUNT; i++) { + I_Instrument *instrument=bank->GetInstrument(i) ; if (instrument->GetType()==IT_SAMPLE) { SampleInstrument *si=(SampleInstrument *)instrument ; int index=si->GetSampleIndex() ; - if (index>=0) iUsed[index]=true ; - }; - } + if (index >= 0) + used[index] = true; + }; + } - // Now effectively purge all unused sample from disk + // Now effectively purge all unused sample from disk - int purged=0 ; - SamplePool *sp=SamplePool::GetInstance() ; - for (int i=0;iGetSource(i-purged))) { - sp->PurgeSample(i-purged) ; - purged++; - } ; - } ; - } -} ; + int purged = 0; + SamplePool *sp = SamplePool::GetInstance(); + for (int i = 0; i < MAX_PIG_SAMPLES; i++) { + if ((!used[i])&&(sp->GetSource(i-purged))) { + sp->PurgeSample(i - purged); + Trace::Debug("Purged sample [%d]", i - purged); + purged++; + } + } + } +} void Project::RestoreContent(TiXmlElement *element) { diff --git a/sources/Application/Model/Project.h b/sources/Application/Model/Project.h index cd92d950..e5248edb 100644 --- a/sources/Application/Model/Project.h +++ b/sources/Application/Model/Project.h @@ -21,7 +21,7 @@ #define PROJECT_NUMBER "1" #define PROJECT_RELEASE "6" -#define BUILD_COUNT "0-bacon12" +#define BUILD_COUNT "0-bacon13" #define MAX_TAP 3 diff --git a/sources/Application/Views/ProjectView.cpp b/sources/Application/Views/ProjectView.cpp index 2ba24a59..590b684b 100644 --- a/sources/Application/Views/ProjectView.cpp +++ b/sources/Application/Views/ProjectView.cpp @@ -298,8 +298,9 @@ void ProjectView::Update(Observable &,I_ObservableData *data) { break ; case ACTION_PURGE_INSTRUMENT: { - MessageBox *mb=new MessageBox(*this,"Purge unused samples from disk ?",MBBF_YES|MBBF_NO) ; - DoModal(mb,PurgeCallback) ; + MessageBox *mb = new MessageBox(*this, "Purge unused samples?", + MBBF_YES | MBBF_NO); + DoModal(mb,PurgeCallback) ; break ; } case ACTION_SAVE: {