Skip to content

Commit 4c0e632

Browse files
authored
Merge pull request #11 from guysoft/use_as_class
Make AudioLoader class and add usage example
2 parents 81c64ae + 7636ff9 commit 4c0e632

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

GDScriptAudioImport.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#I honestly don't care that much, Kopimi ftw, but it's my little baby and I want it to look nice :3
2626

27-
extends Node
27+
class_name AudioLoader
2828

2929
func report_errors(err, filepath):
3030
# See: https://docs.godotengine.org/en/latest/classes/class_@globalscope.html#enum-globalscope-error

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@ A script for Godot in GDScript for importing .wav (via parsing the wav header),
33

44
I'm sure there's way more efficient ways to do this, but for me this works so far and it's my little baby.
55

6+
7+
# Usage instructions and example
8+
1. Import the script in to your project
9+
2. When you want to load you can call the class:
10+
```
11+
var music = AudioStreamPlayer.new()
12+
var audio_loader = AudioLoader.new()
13+
music.set_stream(audio_loader.loadfile("/path/to/song.ogg"))
14+
music.volume_db = 1
15+
music.pitch_scale = 1
16+
music.play()
17+
```
18+
619
### TODO:
720

821
0. Test with very different wav files in order to see if format parsing works for different chunk sizes (doesn't seem to)

0 commit comments

Comments
 (0)