summaryrefslogtreecommitdiff
path: root/tools/editor/plugins/sample_editor_plugin.cpp
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-11-09 00:49:18 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-11-09 00:49:18 -0300
commit61c4c5795ff9057b1c67142758418a4f982a0241 (patch)
tree1294f7ac66e4a364433224f09160c8435a9aca71 /tools/editor/plugins/sample_editor_plugin.cpp
parent3fcfdfec0ac5175f55527b3ec95d14d48bf29dd2 (diff)
-support for stereo ima-adpcm sample compression & playback
-support for converting samples to ima-adpcm upon export
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];