diff options
Diffstat (limited to 'tools/editor/plugins/sample_editor_plugin.cpp')
| -rw-r--r-- | tools/editor/plugins/sample_editor_plugin.cpp | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/tools/editor/plugins/sample_editor_plugin.cpp b/tools/editor/plugins/sample_editor_plugin.cpp index b094184a2..7965fa54a 100644 --- a/tools/editor/plugins/sample_editor_plugin.cpp +++ b/tools/editor/plugins/sample_editor_plugin.cpp @@ -151,7 +151,7 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag -1, -1, -1, -1, 2, 4, 6, 8 }; - int16_t nibble,signed_nibble,diff,step; + int16_t nibble,diff,step; ima_adpcm.last_nibble++; const uint8_t *src_ptr=sdata; @@ -172,10 +172,6 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag if (ima_adpcm.step_index>88) ima_adpcm.step_index=88; - /* - signed_nibble = (nibble&7) * ((nibble&8)?-1:1); - diff = (2 * signed_nibble + 1) * step / 4; */ - diff = step >> 3 ; if (nibble & 1) diff += step >> 2 ; @@ -285,15 +281,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag for(int j=0;j<h;j++) { - int half,ofs; + int half; float v; if (j<(h/2)) { half=0; - ofs=0; v = (j/(float)(h/2)) * 2.0 - 1.0; } else { half=1; - ofs=h/2; v = ((j-(h/2))/(float)(h/2)) * 2.0 - 1.0; } @@ -324,12 +318,13 @@ void SampleEditor::generate_preview_texture(const Ref<Sample>& p_sample,Ref<Imag void SampleEditor::_update_sample() { player->stop_all(); - if (sample->get_format()==Sample::FORMAT_IMA_ADPCM) - return; //bye or unsupported generate_preview_texture(sample,peakdisplay); info_label->set_text(TTR("Length:")+" "+String::num(sample->get_length()/(float)sample->get_mix_rate(),2)+"s"); + if (library->has_sample("default")) + library->remove_sample("default"); + library->add_sample("default",sample); } |
