Skip to content

Commit 5c00405

Browse files
committed
Move WAV loading functionality to a wav_loader module with dr_wav (adds AIFF support)
1 parent 45fc515 commit 5c00405

File tree

15 files changed

+9444
-461
lines changed

15 files changed

+9444
-461
lines changed

COPYRIGHT.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ Comment: doctest
235235
Copyright: 2016-2023, Viktor Kirilov
236236
License: Expat
237237

238+
Files: thirdparty/dr_libs/*
239+
Comment: dr_libs
240+
Copyright: 2020 David Reid
241+
License: public-domain or Unlicense or Expat
242+
238243
Files: thirdparty/embree/*
239244
Comment: Embree
240245
Copyright: 2009-2021 Intel Corporation

doc/classes/AudioStreamWAV.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="AudioStreamWAV" inherits="AudioStream" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
4-
Stores audio data loaded from WAV files.
4+
Stores audio data loaded from WAV and AIFF files.
55
</brief_description>
66
<description>
7-
AudioStreamWAV stores sound samples loaded from WAV files. To play the stored sound, use an [AudioStreamPlayer] (for non-positional audio) or [AudioStreamPlayer2D]/[AudioStreamPlayer3D] (for positional audio). The sound can be looped.
7+
AudioStreamWAV stores sound samples loaded from WAV and AIFF files. To play the stored sound, use an [AudioStreamPlayer] (for non-positional audio) or [AudioStreamPlayer2D]/[AudioStreamPlayer3D] (for positional audio). The sound can be looped.
88
This class can also be used to store dynamically-generated PCM audio data. See also [AudioStreamGenerator] for procedural audio generation.
99
</description>
1010
<tutorials>

doc/classes/ResourceImporterWAV.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8" ?>
22
<class name="ResourceImporterWAV" inherits="ResourceImporter" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
33
<brief_description>
4-
Imports a WAV audio file for playback.
4+
Imports WAV and AIFF audio files 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.
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.
7+
WAV and AIFF are uncompressed formats, 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 and AIFF sounds can be played at the same time, even on low-end devices.
8+
By default, Godot imports WAV and AIFF files using the lossy Quite OK Audio compression. You may change this by setting the [member compress/mode] property.
99
</description>
1010
<tutorials>
1111
<link title="Importing audio samples">$DOCS_URL/tutorials/assets_pipeline/importing_audio_samples.html</link>
@@ -25,7 +25,7 @@
2525
</member>
2626
<member name="edit/loop_mode" type="int" setter="" getter="" default="0">
2727
Controls how audio should loop.
28-
- [b]Detect From WAV:[/b] Uses loop information from the WAV metadata.
28+
- [b]Detect From WAV:[/b] Uses loop information from the WAV metadata (AIFF does not support this).
2929
- [b]Disabled:[/b] Don't loop audio, even if the metadata indicates the file playback should loop.
3030
- [b]Forward:[/b] Standard audio looping. Plays the audio forward from the beginning to [member edit/loop_end], then returns to [member edit/loop_begin] and repeats.
3131
- [b]Ping-Pong:[/b] Plays the audio forward until [member edit/loop_end], then backwards to [member edit/loop_begin], repeating this cycle.

editor/import/resource_importer_wav.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ String ResourceImporterWAV::get_visible_name() const {
4242

4343
void ResourceImporterWAV::get_recognized_extensions(List<String> *p_extensions) const {
4444
p_extensions->push_back("wav");
45+
p_extensions->push_back("aif");
46+
p_extensions->push_back("aiff");
47+
p_extensions->push_back("aifc");
4548
}
4649

4750
String ResourceImporterWAV::get_save_extension() const {

modules/wav_loader/SCsub

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env python
2+
from misc.utility.scons_hints import *
3+
4+
Import("env")
5+
Import("env_modules")
6+
7+
env_wav_loader = env_modules.Clone()
8+
9+
# Godot source files
10+
env_wav_loader.add_source_files(env.modules_sources, "*.cpp")

modules/wav_loader/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
def can_build(env, platform):
2+
return True
3+
4+
5+
def configure(env):
6+
pass

0 commit comments

Comments
 (0)