GUI: add a sample preview rate hint
This commit is contained in:
parent
73a9eb5ccc
commit
3e997ae886
|
@ -2131,6 +2131,7 @@ void DivEngine::previewSample(int sample, int note, int pStart, int pEnd) {
|
||||||
if (rate<100) rate=100;
|
if (rate<100) rate=100;
|
||||||
blip_set_rates(samp_bb,rate,got.rate);
|
blip_set_rates(samp_bb,rate,got.rate);
|
||||||
samp_prevSample=0;
|
samp_prevSample=0;
|
||||||
|
sPreview.rate=rate;
|
||||||
sPreview.pos=(sPreview.pBegin>=0)?sPreview.pBegin:0;
|
sPreview.pos=(sPreview.pBegin>=0)?sPreview.pBegin:0;
|
||||||
sPreview.sample=sample;
|
sPreview.sample=sample;
|
||||||
sPreview.wave=-1;
|
sPreview.wave=-1;
|
||||||
|
@ -2164,6 +2165,7 @@ void DivEngine::previewWave(int wave, int note) {
|
||||||
if (rate<100) rate=100;
|
if (rate<100) rate=100;
|
||||||
blip_set_rates(samp_bb,rate,got.rate);
|
blip_set_rates(samp_bb,rate,got.rate);
|
||||||
samp_prevSample=0;
|
samp_prevSample=0;
|
||||||
|
sPreview.rate=rate;
|
||||||
sPreview.pos=0;
|
sPreview.pos=0;
|
||||||
sPreview.sample=-1;
|
sPreview.sample=-1;
|
||||||
sPreview.wave=wave;
|
sPreview.wave=wave;
|
||||||
|
@ -2179,6 +2181,18 @@ void DivEngine::stopWavePreview() {
|
||||||
BUSY_END;
|
BUSY_END;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DivEngine::isPreviewingSample() {
|
||||||
|
return (sPreview.sample>=0 && sPreview.sample<(int)song.sample.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
int DivEngine::getSamplePreviewPos() {
|
||||||
|
return sPreview.pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
double DivEngine::getSamplePreviewRate() {
|
||||||
|
return sPreview.rate;
|
||||||
|
}
|
||||||
|
|
||||||
String DivEngine::getConfigPath() {
|
String DivEngine::getConfigPath() {
|
||||||
return configPath;
|
return configPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,12 +387,14 @@ class DivEngine {
|
||||||
DivSystem sysFileMapDMF[256];
|
DivSystem sysFileMapDMF[256];
|
||||||
|
|
||||||
struct SamplePreview {
|
struct SamplePreview {
|
||||||
|
double rate;
|
||||||
int sample;
|
int sample;
|
||||||
int wave;
|
int wave;
|
||||||
int pos;
|
int pos;
|
||||||
int pBegin, pEnd;
|
int pBegin, pEnd;
|
||||||
bool dir;
|
bool dir;
|
||||||
SamplePreview():
|
SamplePreview():
|
||||||
|
rate(0.0),
|
||||||
sample(-1),
|
sample(-1),
|
||||||
wave(-1),
|
wave(-1),
|
||||||
pos(0),
|
pos(0),
|
||||||
|
@ -601,6 +603,11 @@ class DivEngine {
|
||||||
// reset playback state
|
// reset playback state
|
||||||
void syncReset();
|
void syncReset();
|
||||||
|
|
||||||
|
// sample preview query
|
||||||
|
bool isPreviewingSample();
|
||||||
|
int getSamplePreviewPos();
|
||||||
|
double getSamplePreviewRate();
|
||||||
|
|
||||||
// trigger sample preview
|
// trigger sample preview
|
||||||
void previewSample(int sample, int note=-1, int pStart=-1, int pEnd=-1);
|
void previewSample(int sample, int note=-1, int pStart=-1, int pEnd=-1);
|
||||||
void stopSamplePreview();
|
void stopSamplePreview();
|
||||||
|
|
|
@ -822,6 +822,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_CUT: {
|
case GUI_ACTION_SAMPLE_CUT: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
||||||
if (end-start<1) break;
|
if (end-start<1) break;
|
||||||
|
@ -866,6 +867,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?sample->samples:sampleSelStart;
|
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?sample->samples:sampleSelStart;
|
||||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||||
|
@ -896,6 +898,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
||||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||||
|
@ -926,6 +929,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
if (sampleClipboard==NULL || sampleClipboardLen<1) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
int pos=(sampleSelStart==-1 || sampleSelStart==sampleSelEnd)?0:sampleSelStart;
|
||||||
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
if (pos>=(int)sample->samples) pos=sample->samples-1;
|
||||||
|
@ -981,6 +985,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_NORMALIZE: {
|
case GUI_ACTION_SAMPLE_NORMALIZE: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1028,6 +1033,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_FADE_IN: {
|
case GUI_ACTION_SAMPLE_FADE_IN: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1058,6 +1064,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_FADE_OUT: {
|
case GUI_ACTION_SAMPLE_FADE_OUT: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1092,6 +1099,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_SILENCE: {
|
case GUI_ACTION_SAMPLE_SILENCE: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1116,6 +1124,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_DELETE: {
|
case GUI_ACTION_SAMPLE_DELETE: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1133,6 +1142,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_TRIM: {
|
case GUI_ACTION_SAMPLE_TRIM: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1150,6 +1160,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_REVERSE: {
|
case GUI_ACTION_SAMPLE_REVERSE: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1182,6 +1193,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_INVERT: {
|
case GUI_ACTION_SAMPLE_INVERT: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
@ -1208,6 +1220,7 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_SAMPLE_SIGN: {
|
case GUI_ACTION_SAMPLE_SIGN: {
|
||||||
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
if (curSample<0 || curSample>=(int)e->song.sample.size()) break;
|
||||||
DivSample* sample=e->song.sample[curSample];
|
DivSample* sample=e->song.sample[curSample];
|
||||||
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) break;
|
||||||
sample->prepareUndo(true);
|
sample->prepareUndo(true);
|
||||||
e->lockEngine([this,sample]() {
|
e->lockEngine([this,sample]() {
|
||||||
SAMPLE_OP_BEGIN;
|
SAMPLE_OP_BEGIN;
|
||||||
|
|
|
@ -2134,6 +2134,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
|
||||||
if (x1>=(int)sampleDragLen) x1=sampleDragLen-1;
|
if (x1>=(int)sampleDragLen) x1=sampleDragLen-1;
|
||||||
double y=0.5-double(dragY-sampleDragStart.y)/sampleDragAreaSize.y;
|
double y=0.5-double(dragY-sampleDragStart.y)/sampleDragAreaSize.y;
|
||||||
if (sampleDragMode) { // draw
|
if (sampleDragMode) { // draw
|
||||||
|
if (sampleDragTarget) {
|
||||||
if (sampleDrag16) {
|
if (sampleDrag16) {
|
||||||
int val=y*65536;
|
int val=y*65536;
|
||||||
if (val<-32768) val=-32768;
|
if (val<-32768) val=-32768;
|
||||||
|
@ -2146,6 +2147,7 @@ void FurnaceGUI::processDrags(int dragX, int dragY) {
|
||||||
for (int i=x; i<=x1; i++) ((signed char*)sampleDragTarget)[i]=val;
|
for (int i=x; i<=x1; i++) ((signed char*)sampleDragTarget)[i]=val;
|
||||||
}
|
}
|
||||||
updateSampleTex=true;
|
updateSampleTex=true;
|
||||||
|
}
|
||||||
} else { // select
|
} else { // select
|
||||||
if (sampleSelStart<0) {
|
if (sampleSelStart<0) {
|
||||||
sampleSelStart=x;
|
sampleSelStart=x;
|
||||||
|
@ -2836,7 +2838,7 @@ void FurnaceGUI::pointDown(int x, int y, int button) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::pointUp(int x, int y, int button) {
|
void FurnaceGUI::pointUp(int x, int y, int button) {
|
||||||
if (macroDragActive || macroLoopDragActive || waveDragActive || (sampleDragActive && sampleDragMode)) {
|
if (macroDragActive || macroLoopDragActive || waveDragActive || (sampleDragActive && sampleDragMode && sampleDragTarget)) {
|
||||||
MARK_MODIFIED;
|
MARK_MODIFIED;
|
||||||
}
|
}
|
||||||
if (macroDragActive && macroDragLineMode && !macroDragMouseMoved) {
|
if (macroDragActive && macroDragLineMode && !macroDragMouseMoved) {
|
||||||
|
|
|
@ -178,8 +178,6 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
*/
|
*/
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
|
||||||
|
|
||||||
pushToggleColors(!sampleDragMode);
|
pushToggleColors(!sampleDragMode);
|
||||||
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
||||||
sampleDragMode=false;
|
sampleDragMode=false;
|
||||||
|
@ -197,6 +195,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Edit mode: Draw");
|
ImGui::SetTooltip("Edit mode: Draw");
|
||||||
}
|
}
|
||||||
|
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -564,6 +563,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
ImGui::EndPopup();
|
ImGui::EndPopup();
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(4.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -736,8 +736,6 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
*/
|
*/
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
|
||||||
|
|
||||||
pushToggleColors(!sampleDragMode);
|
pushToggleColors(!sampleDragMode);
|
||||||
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
if (ImGui::Button(ICON_FA_I_CURSOR "##SSelect")) {
|
||||||
sampleDragMode=false;
|
sampleDragMode=false;
|
||||||
|
@ -755,6 +753,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetTooltip("Edit mode: Draw");
|
ImGui::SetTooltip("Edit mode: Draw");
|
||||||
}
|
}
|
||||||
|
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Dummy(ImVec2(7.0*dpiScale,dpiScale));
|
ImGui::Dummy(ImVec2(7.0*dpiScale,dpiScale));
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -1129,6 +1128,8 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
ImGui::SetTooltip("Trim");
|
ImGui::SetTooltip("Trim");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::EndDisabled();
|
||||||
|
|
||||||
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
if (ImGui::Button(ICON_FA_PLAY "##PreviewSample")) {
|
||||||
e->previewSample(curSample);
|
e->previewSample(curSample);
|
||||||
}
|
}
|
||||||
|
@ -1308,11 +1309,23 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
sampleSelStart=0;
|
sampleSelStart=0;
|
||||||
sampleSelEnd=sample->samples;
|
sampleSelEnd=sample->samples;
|
||||||
} else {
|
} else {
|
||||||
if (sample->samples>0 && (sample->depth==DIV_SAMPLE_DEPTH_16BIT || sample->depth==DIV_SAMPLE_DEPTH_8BIT)) {
|
if (sample->samples>0) {
|
||||||
sampleDragStart=rectMin;
|
sampleDragStart=rectMin;
|
||||||
sampleDragAreaSize=rectSize;
|
sampleDragAreaSize=rectSize;
|
||||||
sampleDrag16=(sample->depth==DIV_SAMPLE_DEPTH_16BIT);
|
switch (sample->depth) {
|
||||||
sampleDragTarget=(sample->depth==DIV_SAMPLE_DEPTH_16BIT)?((void*)sample->data16):((void*)sample->data8);
|
case DIV_SAMPLE_DEPTH_8BIT:
|
||||||
|
sampleDrag16=false;
|
||||||
|
sampleDragTarget=(void*)sample->data8;
|
||||||
|
break;
|
||||||
|
case DIV_SAMPLE_DEPTH_16BIT:
|
||||||
|
sampleDrag16=true;
|
||||||
|
sampleDragTarget=(void*)sample->data16;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
sampleDrag16=true;
|
||||||
|
sampleDragTarget=NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
sampleDragLen=sample->samples;
|
sampleDragLen=sample->samples;
|
||||||
sampleDragActive=true;
|
sampleDragActive=true;
|
||||||
sampleSelStart=-1;
|
sampleSelStart=-1;
|
||||||
|
@ -1328,12 +1341,15 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopup("SRightClick",ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) {
|
if (ImGui::BeginPopup("SRightClick",ImGuiWindowFlags_NoTitleBar|ImGuiWindowFlags_NoMove|ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
|
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||||
if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_SAMPLE_CUT))) {
|
if (ImGui::MenuItem("cut",BIND_FOR(GUI_ACTION_SAMPLE_CUT))) {
|
||||||
doAction(GUI_ACTION_SAMPLE_CUT);
|
doAction(GUI_ACTION_SAMPLE_CUT);
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_SAMPLE_COPY))) {
|
if (ImGui::MenuItem("copy",BIND_FOR(GUI_ACTION_SAMPLE_COPY))) {
|
||||||
doAction(GUI_ACTION_SAMPLE_COPY);
|
doAction(GUI_ACTION_SAMPLE_COPY);
|
||||||
}
|
}
|
||||||
|
ImGui::BeginDisabled(sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT);
|
||||||
if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_SAMPLE_PASTE))) {
|
if (ImGui::MenuItem("paste",BIND_FOR(GUI_ACTION_SAMPLE_PASTE))) {
|
||||||
doAction(GUI_ACTION_SAMPLE_PASTE);
|
doAction(GUI_ACTION_SAMPLE_PASTE);
|
||||||
}
|
}
|
||||||
|
@ -1343,6 +1359,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
if (ImGui::MenuItem("paste (mix)",BIND_FOR(GUI_ACTION_SAMPLE_PASTE_MIX))) {
|
if (ImGui::MenuItem("paste (mix)",BIND_FOR(GUI_ACTION_SAMPLE_PASTE_MIX))) {
|
||||||
doAction(GUI_ACTION_SAMPLE_PASTE_MIX);
|
doAction(GUI_ACTION_SAMPLE_PASTE_MIX);
|
||||||
}
|
}
|
||||||
|
ImGui::EndDisabled();
|
||||||
if (ImGui::MenuItem("select all",BIND_FOR(GUI_ACTION_SAMPLE_SELECT_ALL))) {
|
if (ImGui::MenuItem("select all",BIND_FOR(GUI_ACTION_SAMPLE_SELECT_ALL))) {
|
||||||
doAction(GUI_ACTION_SAMPLE_SELECT_ALL);
|
doAction(GUI_ACTION_SAMPLE_SELECT_ALL);
|
||||||
}
|
}
|
||||||
|
@ -1368,7 +1385,11 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
end^=start;
|
end^=start;
|
||||||
start^=end;
|
start^=end;
|
||||||
}
|
}
|
||||||
statusBar+=fmt::sprintf(" (%d-%d)",start,end);
|
if (start==end) {
|
||||||
|
statusBar+=fmt::sprintf(" (%d)",start);
|
||||||
|
} else {
|
||||||
|
statusBar+=fmt::sprintf(" (%d-%d: %d samples)",start,end,end-start);
|
||||||
|
}
|
||||||
drawSelection=true;
|
drawSelection=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1420,6 +1441,10 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e->isPreviewingSample()) {
|
||||||
|
statusBar+=fmt::sprintf(" | %.2fHz",e->getSamplePreviewRate());
|
||||||
|
}
|
||||||
|
|
||||||
if (drawSelection) {
|
if (drawSelection) {
|
||||||
int start=sampleSelStart;
|
int start=sampleSelStart;
|
||||||
int end=sampleSelEnd;
|
int end=sampleSelEnd;
|
||||||
|
@ -1464,12 +1489,10 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT) {
|
if (sample->depth!=DIV_SAMPLE_DEPTH_8BIT && sample->depth!=DIV_SAMPLE_DEPTH_16BIT && sampleDragMode) {
|
||||||
statusBar="Non-8/16-bit samples cannot be edited without prior conversion.";
|
statusBar="Non-8/16-bit samples cannot be edited without prior conversion.";
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::EndDisabled();
|
|
||||||
|
|
||||||
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+ImGui::GetStyle().ScrollbarSize);
|
ImGui::SetCursorPosY(ImGui::GetCursorPosY()+ImGui::GetStyle().ScrollbarSize);
|
||||||
ImGui::Text("%s",statusBar.c_str());
|
ImGui::Text("%s",statusBar.c_str());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue