GUI: sample improvements
- resample change C-4 note - add duplicate option
This commit is contained in:
parent
3d94aef14b
commit
455cccdef0
|
@ -323,6 +323,7 @@ bool DivSample::insert(unsigned int pos, unsigned int length) {
|
|||
|
||||
#define RESAMPLE_END \
|
||||
if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \
|
||||
centerRate=(int)((double)centerRate*(r/(double)rate)); \
|
||||
rate=r; \
|
||||
samples=finalCount; \
|
||||
if (depth==16) { \
|
||||
|
|
|
@ -290,6 +290,10 @@ void FurnaceGUI::drawSampleList() {
|
|||
doAction(GUI_ACTION_SAMPLE_LIST_ADD);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_FILES_O "##SampleClone")) {
|
||||
doAction(GUI_ACTION_SAMPLE_LIST_DUPLICATE);
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button(ICON_FA_FOLDER_OPEN "##SampleLoad")) {
|
||||
doAction(GUI_ACTION_SAMPLE_LIST_OPEN);
|
||||
}
|
||||
|
|
|
@ -567,6 +567,29 @@ void FurnaceGUI::doAction(int what) {
|
|||
curSample=e->addSample();
|
||||
MARK_MODIFIED;
|
||||
break;
|
||||
case GUI_ACTION_SAMPLE_LIST_DUPLICATE:
|
||||
if (curSample>=0 && curSample<(int)e->song.sample.size()) {
|
||||
DivSample* prevSample=e->getSample(curSample);
|
||||
curSample=e->addSample();
|
||||
e->lockEngine([this,prevSample]() {
|
||||
DivSample* sample=e->getSample(curSample);
|
||||
if (sample!=NULL) {
|
||||
sample->rate=prevSample->rate;
|
||||
sample->centerRate=prevSample->centerRate;
|
||||
sample->name=prevSample->name;
|
||||
sample->loopStart=prevSample->loopStart;
|
||||
sample->depth=prevSample->depth;
|
||||
if (sample->init(prevSample->samples)) {
|
||||
if (prevSample->getCurBuf()!=NULL) {
|
||||
memcpy(sample->getCurBuf(),prevSample->getCurBuf(),prevSample->getCurBufLen());
|
||||
}
|
||||
}
|
||||
}
|
||||
e->renderSamples();
|
||||
});
|
||||
MARK_MODIFIED;
|
||||
}
|
||||
break;
|
||||
case GUI_ACTION_SAMPLE_LIST_OPEN:
|
||||
openFileDialog(GUI_FILE_SAMPLE_OPEN);
|
||||
break;
|
||||
|
|
|
@ -29,11 +29,9 @@
|
|||
#include "util.h"
|
||||
|
||||
// TODO:
|
||||
// - resample should change C-4 note
|
||||
// - clicking on waveform should give this window focus
|
||||
// - add "create instrument using this sample" option
|
||||
// - .dmc loading
|
||||
// - duplicate sample
|
||||
void FurnaceGUI::drawSampleEdit() {
|
||||
if (nextWindow==GUI_WINDOW_SAMPLE_EDIT) {
|
||||
sampleEditOpen=true;
|
||||
|
|
Loading…
Reference in New Issue