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 \
|
#define RESAMPLE_END \
|
||||||
if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \
|
if (loopStart>=0) loopStart=(double)loopStart*(r/(double)rate); \
|
||||||
|
centerRate=(int)((double)centerRate*(r/(double)rate)); \
|
||||||
rate=r; \
|
rate=r; \
|
||||||
samples=finalCount; \
|
samples=finalCount; \
|
||||||
if (depth==16) { \
|
if (depth==16) { \
|
||||||
|
|
|
@ -290,6 +290,10 @@ void FurnaceGUI::drawSampleList() {
|
||||||
doAction(GUI_ACTION_SAMPLE_LIST_ADD);
|
doAction(GUI_ACTION_SAMPLE_LIST_ADD);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
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")) {
|
if (ImGui::Button(ICON_FA_FOLDER_OPEN "##SampleLoad")) {
|
||||||
doAction(GUI_ACTION_SAMPLE_LIST_OPEN);
|
doAction(GUI_ACTION_SAMPLE_LIST_OPEN);
|
||||||
}
|
}
|
||||||
|
|
|
@ -567,6 +567,29 @@ void FurnaceGUI::doAction(int what) {
|
||||||
curSample=e->addSample();
|
curSample=e->addSample();
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
break;
|
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:
|
case GUI_ACTION_SAMPLE_LIST_OPEN:
|
||||||
openFileDialog(GUI_FILE_SAMPLE_OPEN);
|
openFileDialog(GUI_FILE_SAMPLE_OPEN);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -29,11 +29,9 @@
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - resample should change C-4 note
|
|
||||||
// - clicking on waveform should give this window focus
|
// - clicking on waveform should give this window focus
|
||||||
// - add "create instrument using this sample" option
|
// - add "create instrument using this sample" option
|
||||||
// - .dmc loading
|
// - .dmc loading
|
||||||
// - duplicate sample
|
|
||||||
void FurnaceGUI::drawSampleEdit() {
|
void FurnaceGUI::drawSampleEdit() {
|
||||||
if (nextWindow==GUI_WINDOW_SAMPLE_EDIT) {
|
if (nextWindow==GUI_WINDOW_SAMPLE_EDIT) {
|
||||||
sampleEditOpen=true;
|
sampleEditOpen=true;
|
||||||
|
|
Loading…
Reference in New Issue