add option to swap bytes in raw smp import

This commit is contained in:
tildearrow 2023-09-25 05:09:56 -05:00
parent 8231e3beba
commit a3d8c81e9d
2 changed files with 11 additions and 2 deletions

View file

@ -464,6 +464,13 @@ DivSample* DivEngine::sampleFromFileRaw(const char* path, DivSampleDepth depth,
accum/=channels;
sample->data8[i]=accum;
}
if (bigEndian) {
for (unsigned int i=0; (i+1)<samples; i+=2) {
sample->data8[i]^=sample->data8[i^1];
sample->data8[i^1]^=sample->data8[i];
sample->data8[i]^=sample->data8[i^1];
}
}
} else {
memcpy(sample->getCurBuf(),buf,len);
}

View file

@ -5874,8 +5874,6 @@ bool FurnaceGUI::loop() {
if (pendingRawSampleDepth!=DIV_SAMPLE_DEPTH_8BIT && pendingRawSampleDepth!=DIV_SAMPLE_DEPTH_16BIT) {
pendingRawSampleChannels=1;
}
if (pendingRawSampleDepth!=DIV_SAMPLE_DEPTH_16BIT) {
pendingRawSampleBigEndian=false;
}
@ -5902,6 +5900,10 @@ bool FurnaceGUI::loop() {
ImGui::Checkbox("Swap nibbles",&pendingRawSampleSwapNibbles);
}
if (pendingRawSampleDepth==DIV_SAMPLE_DEPTH_8BIT) {
ImGui::Checkbox("Swap words",&pendingRawSampleBigEndian);
}
if (pendingRawSampleDepth==DIV_SAMPLE_DEPTH_MULAW) {
ImGui::Text("Encoding:");
ImGui::Indent();