summaryrefslogtreecommitdiff
path: root/editor/import/resource_importer_wav.cpp
diff options
context:
space:
mode:
authorDeeJayLSP <djlsplays@gmail.com>2022-07-23 11:34:36 -0300
committerDeeJayLSP <djlsplays@gmail.com>2022-07-28 13:53:36 -0300
commit4889659227221f137da0bd926ddb6cd867bbd632 (patch)
tree71780267922b1974c2bd28c4f96bfa425f2b3c88 /editor/import/resource_importer_wav.cpp
parent667cef39b4e9f98ed545d95de442319c447f2164 (diff)
Rename AudioStreamSample to a more discoverable name
Diffstat (limited to 'editor/import/resource_importer_wav.cpp')
-rw-r--r--editor/import/resource_importer_wav.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/editor/import/resource_importer_wav.cpp b/editor/import/resource_importer_wav.cpp
index f0ba1eb7a1..3a47bfb29f 100644
--- a/editor/import/resource_importer_wav.cpp
+++ b/editor/import/resource_importer_wav.cpp
@@ -33,7 +33,7 @@
#include "core/io/file_access.h"
#include "core/io/marshalls.h"
#include "core/io/resource_saver.h"
-#include "scene/resources/audio_stream_sample.h"
+#include "scene/resources/audio_stream_wav.h"
const float TRIM_DB_LIMIT = -50;
const int TRIM_FADE_OUT_FRAMES = 500;
@@ -55,7 +55,7 @@ String ResourceImporterWAV::get_save_extension() const {
}
String ResourceImporterWAV::get_resource_type() const {
- return "AudioStreamSample";
+ return "AudioStreamWAV";
}
bool ResourceImporterWAV::get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
@@ -86,7 +86,7 @@ void ResourceImporterWAV::get_import_options(const String &p_path, List<ImportOp
r_options->push_back(ImportOption(PropertyInfo(Variant::FLOAT, "force/max_rate_hz", PROPERTY_HINT_RANGE, "11025,192000,1,exp"), 44100));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/trim"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "edit/normalize"), false));
- // Keep the `edit/loop_mode` enum in sync with AudioStreamSample::LoopMode (note: +1 offset due to "Detect From WAV").
+ // Keep the `edit/loop_mode` enum in sync with AudioStreamWAV::LoopMode (note: +1 offset due to "Detect From WAV").
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_mode", PROPERTY_HINT_ENUM, "Detect From WAV,Disabled,Forward,Ping-Pong,Backward", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_UPDATE_ALL_IF_MODIFIED), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_begin"), 0));
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_end"), -1));
@@ -130,7 +130,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int format_bits = 0;
int format_channels = 0;
- AudioStreamSample::LoopMode loop_mode = AudioStreamSample::LOOP_DISABLED;
+ AudioStreamWAV::LoopMode loop_mode = AudioStreamWAV::LOOP_DISABLED;
uint16_t compression_code = 1;
bool format_found = false;
bool data_found = false;
@@ -282,11 +282,11 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
int loop_type = file->get_32();
if (loop_type == 0x00 || loop_type == 0x01 || loop_type == 0x02) {
if (loop_type == 0x00) {
- loop_mode = AudioStreamSample::LOOP_FORWARD;
+ loop_mode = AudioStreamWAV::LOOP_FORWARD;
} else if (loop_type == 0x01) {
- loop_mode = AudioStreamSample::LOOP_PINGPONG;
+ loop_mode = AudioStreamWAV::LOOP_PINGPONG;
} else if (loop_type == 0x02) {
- loop_mode = AudioStreamSample::LOOP_BACKWARD;
+ loop_mode = AudioStreamWAV::LOOP_BACKWARD;
}
loop_begin = file->get_32();
loop_end = file->get_32();
@@ -386,7 +386,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
bool trim = p_options["edit/trim"];
- if (trim && (loop_mode != AudioStreamSample::LOOP_DISABLED) && format_channels > 0) {
+ if (trim && (loop_mode != AudioStreamWAV::LOOP_DISABLED) && format_channels > 0) {
int first = 0;
int last = (frames / format_channels) - 1;
bool found = false;
@@ -431,7 +431,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
if (import_loop_mode >= 2) {
- loop_mode = (AudioStreamSample::LoopMode)(import_loop_mode - 1);
+ loop_mode = (AudioStreamWAV::LoopMode)(import_loop_mode - 1);
loop_begin = p_options["edit/loop_begin"];
loop_end = p_options["edit/loop_end"];
// Wrap around to max frames, so `-1` can be used to select the end, etc.
@@ -463,10 +463,10 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
Vector<uint8_t> dst_data;
- AudioStreamSample::Format dst_format;
+ AudioStreamWAV::Format dst_format;
if (compression == 1) {
- dst_format = AudioStreamSample::FORMAT_IMA_ADPCM;
+ dst_format = AudioStreamWAV::FORMAT_IMA_ADPCM;
if (format_channels == 1) {
_compress_ima_adpcm(data, dst_data);
} else {
@@ -503,7 +503,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
} else {
- dst_format = is16 ? AudioStreamSample::FORMAT_16_BITS : AudioStreamSample::FORMAT_8_BITS;
+ dst_format = is16 ? AudioStreamWAV::FORMAT_16_BITS : AudioStreamWAV::FORMAT_8_BITS;
dst_data.resize(data.size() * (is16 ? 2 : 1));
{
uint8_t *w = dst_data.ptrw();
@@ -521,7 +521,7 @@ Error ResourceImporterWAV::import(const String &p_source_file, const String &p_s
}
}
- Ref<AudioStreamSample> sample;
+ Ref<AudioStreamWAV> sample;
sample.instantiate();
sample->set_data(dst_data);
sample->set_format(dst_format);