diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-12-11 18:43:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-11 18:43:18 +0100 |
commit | 5ff403b3b0a4d19122cebae1329f46444263ae17 (patch) | |
tree | e72e1fda0761a816e271d137819b5eaefdc7bdc8 /editor/import/resource_importer_wav.cpp | |
parent | 13d037b2006ed097569814f694e4ad0ccd3b7bfa (diff) | |
parent | b2bfcb53d648a2cd4c0845b696d0a96feebf68b6 (diff) |
Merge pull request #23361 from mrcdk/wav_loop_backward
Add backward looping support to AudioStreamSample (wav files)
Diffstat (limited to 'editor/import/resource_importer_wav.cpp')
-rw-r--r-- | editor/import/resource_importer_wav.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp index 55f4cc7439..85ea0d343c 100644 --- a/editor/import/resource_importer_wav.cpp +++ b/editor/import/resource_importer_wav.cpp @@ -272,12 +272,18 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s for (int i = 0; i < 10; i++) file->get_32(); // i wish to know why should i do this... no doc! - // only read 0x00 (loop forward) and 0x01 (loop ping-pong) and skip anything else because - // it's not supported (loop backward), reserved for future uses or sampler specific + // only read 0x00 (loop forward), 0x01 (loop ping-pong) and 0x02 (loop backward) + // Skip anything else because it's not supported, reserved for future uses or sampler specific // from https://sites.google.com/site/musicgapi/technical-documents/wav-file-format#smpl (loop type values table) int loop_type = file->get_32(); - if (loop_type == 0x00 || loop_type == 0x01) { - loop = loop_type ? AudioStreamSample::LOOP_PING_PONG : AudioStreamSample::LOOP_FORWARD; + if (loop_type == 0x00 || loop_type == 0x01 || loop_type == 0x02) { + if (loop_type == 0x00) { + loop = AudioStreamSample::LOOP_FORWARD; + } else if (loop_type == 0x01) { + loop = AudioStreamSample::LOOP_PING_PONG; + } else if (loop_type == 0x02) { + loop = AudioStreamSample::LOOP_BACKWARD; + } loop_begin = file->get_32(); loop_end = file->get_32(); } |