-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaudio.gd
28 lines (21 loc) · 844 Bytes
/
audio.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
extends SceneTree
var sndParser = load('res://source/native/snd_parser.gdns').new()
func _init():
var sounds = sndParser.get_sounds('res://data/chars/kfm/kfm.snd')
print(sounds)
# var file = File.new()
# file.open("0-2.wav", file.WRITE)
# file.store_buffer(sounds['0-2']['data'])
# file.close()
# var stream = AudioStreamSample.new()
# stream.format = AudioStreamSample.FORMAT_8_BITS if sounds['0-0']['bits_per_sample'] == 8 else AudioStreamSample.FORMAT_16_BITS
# stream.data = sounds['0-0']['data']
# stream.mix_rate = sounds['0-0']['sample_rate']
# stream.stereo = false if sounds['0-0']['num_channels'] == 1 else true
# var audio = AudioStreamPlayer.new()
# audio.stream = stream
# audio.play()
# add_child(audio)
# print("playing audio")
# file.close()
quit()