summaryrefslogtreecommitdiff
path: root/tools/editor/plugins/sample_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/plugins/sample_editor_plugin.cpp')
-rw-r--r--tools/editor/plugins/sample_editor_plugin.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp
index 31fa7246ae..d88f2adc73 100644
--- a/tools/editor/plugins/sample_editor_plugin.cpp
+++ b/tools/editor/plugins/sample_editor_plugin.cpp
@@ -156,8 +156,14 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag
ima_adpcm.last_nibble++;
const uint8_t *src_ptr=sdata;
+ int ofs = ima_adpcm.last_nibble>>1;
+
+ if (stereo)
+ ofs*=2;
+
nibble = (ima_adpcm.last_nibble&1)?
- (src_ptr[ima_adpcm.last_nibble>>1]>>4):(src_ptr[ima_adpcm.last_nibble>>1]&0xF);
+ (src_ptr[ofs]>>4):(src_ptr[ofs]&0xF);
+
step=_ima_adpcm_step_table[ima_adpcm.step_index];
ima_adpcm.step_index += _ima_adpcm_index_table[nibble];