diff --git a/addons/block_code/simple_nodes/simple_sound/score.ogg b/addons/block_code/simple_nodes/simple_sound/score.ogg new file mode 100644 index 00000000..66858bd7 Binary files /dev/null and b/addons/block_code/simple_nodes/simple_sound/score.ogg differ diff --git a/addons/block_code/simple_nodes/simple_sound/score.ogg.import b/addons/block_code/simple_nodes/simple_sound/score.ogg.import new file mode 100644 index 00000000..ef75befe --- /dev/null +++ b/addons/block_code/simple_nodes/simple_sound/score.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://x1po1oxvsbrf" +path="res://.godot/imported/score.ogg-9db5b6cadacd012955645436b3f5312a.oggvorbisstr" + +[deps] + +source_file="res://addons/block_code/simple_nodes/simple_sound/score.ogg" +dest_files=["res://.godot/imported/score.ogg-9db5b6cadacd012955645436b3f5312a.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/addons/block_code/simple_nodes/simple_sound/simple_sound.gd b/addons/block_code/simple_nodes/simple_sound/simple_sound.gd new file mode 100644 index 00000000..d80d13f0 --- /dev/null +++ b/addons/block_code/simple_nodes/simple_sound/simple_sound.gd @@ -0,0 +1,33 @@ +@tool +class_name SimpleSound +extends AudioStreamPlayer + +var soundstream: AudioStream = load("res://addons/block_code/simple_nodes/simple_sound/score.ogg") + + +func _ready(): + stream = soundstream + + +func get_class(): + return "SimpleSound" + + +static func get_exposed_properties() -> Array[String]: + return ["stream"] + + +static func get_custom_blocks() -> Array[BlockCategory]: + var b: Block + + # Play the sound + var sound_list: Array[Block] = [] + b = CategoryFactory.BLOCKS["statement_block"].instantiate() + b.block_type = Types.BlockType.EXECUTE + b.block_format = "Play the sound, Volume dB {db: INT}" + b.statement = "volume_db=db\n" + "play()" + sound_list.append(b) + + var sound_cat: BlockCategory = BlockCategory.new("PlaySound", sound_list, Color("e30fc0")) + + return [sound_cat] diff --git a/addons/block_code/simple_nodes/simple_sound/simple_sound.tscn b/addons/block_code/simple_nodes/simple_sound/simple_sound.tscn new file mode 100644 index 00000000..51c26e26 --- /dev/null +++ b/addons/block_code/simple_nodes/simple_sound/simple_sound.tscn @@ -0,0 +1,6 @@ +[gd_scene load_steps=2 format=3 uid="uid://dnea31ja51r43"] + +[ext_resource type="Script" path="res://addons/block_code/simple_nodes/simple_sound/simple_sound.gd" id="1_7dbg7"] + +[node name="SimpleSound" type="AudioStreamPlayer"] +script = ExtResource("1_7dbg7")