Skip to content

Commit 36f95ef

Browse files
committed
Merge pull request godotengine#95815 from DeeJayLSP/qoa-def
ResourceImporterWAV: Enable QOA compression by default
2 parents 693ef3b + d3b51c4 commit 36f95ef

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

doc/classes/ResourceImporterWAV.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
Imports a WAV audio file for playback.
55
</brief_description>
66
<description>
7-
WAV is an uncompressed format, which can provide higher quality compared to Ogg Vorbis and MP3. It also has the lowest CPU cost to decode. This means high numbers of WAV sounds can be played at the same time, even on low-end deviceS.
7+
WAV is an uncompressed format, which can provide higher quality compared to Ogg Vorbis and MP3. It also has the lowest CPU cost to decode. This means high numbers of WAV sounds can be played at the same time, even on low-end devices.
8+
By default, Godot imports WAV files using the lossy Quite OK Audio compression. You may change this by setting the [member compress/mode] property.
89
</description>
910
<tutorials>
1011
<link title="Importing audio samples">$DOCS_URL/tutorials/assets_pipeline/importing_audio_samples.html</link>
1112
</tutorials>
1213
<members>
13-
<member name="compress/mode" type="int" setter="" getter="" default="0">
14+
<member name="compress/mode" type="int" setter="" getter="" default="2">
1415
The compression mode to use on import.
1516
- [b]PCM (Uncompressed):[/b] Imports audio data without any form of compression, preserving the highest possible quality. It has the lowest CPU cost, but the highest memory usage.
1617
- [b]IMA ADPCM:[/b] Applies fast, lossy compression during import, noticeably decreasing the quality, but with low CPU cost and memory usage. Does not support seeking and only Forward loop mode is supported.

editor/import/resource_importer_wav.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ void ResourceImporterWAV::get_import_options(const String &p_path, List<ImportOp
9090
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));
9191
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_begin"), 0));
9292
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "edit/loop_end"), -1));
93-
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "PCM (Uncompressed),IMA ADPCM,Quite OK Audio"), 0));
93+
// Quite OK Audio is lightweight enough and supports virtually every significant AudioStreamWAV feature.
94+
r_options->push_back(ImportOption(PropertyInfo(Variant::INT, "compress/mode", PROPERTY_HINT_ENUM, "PCM (Uncompressed),IMA ADPCM,Quite OK Audio"), 2));
9495
}
9596

9697
Error ResourceImporterWAV::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {

tests/scene/test_audio_stream_wav.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ void run_test(String file_name, AudioStreamWAV::Format data_format, bool stereo,
159159
for (const ResourceImporter::ImportOption &E : options_list) {
160160
options_map[E.option.name] = E.default_value;
161161
}
162+
// Compressed streams can't be saved, disable compression.
163+
options_map["compress/mode"] = 0;
162164

163165
REQUIRE(wav_importer->import(save_path, save_path, options_map, nullptr) == OK);
164166

0 commit comments

Comments
 (0)