Sounds testing

This commit is contained in:
Thomas Muller 2023-09-29 17:10:29 -04:00
parent a7a6713638
commit 1a96b2ac58
9 changed files with 108 additions and 20 deletions

View file

@ -1,22 +1,50 @@
extends Node3D
extends StaticBody3D
# Exports
@export_category('Commentary')
@export_subgroup('Sound')
@export
var sound: AudioStream = null :
get:
return $AudioStreamPlayer3D.stream
set(value):
$AudioStreamPlayer3D.stream = value
@export_range(-80, 80, 1, "suffix:dB")
var volume = 0.0 :
get:
return $AudioStreamPlayer3D.volume_db
set(value):
$AudioStreamPlayer3D.volume_db = value
@export_subgroup('Range')
@export_range(0, 100, 1, "suffix:m")
var capture_radius = 10.0
@export
@export_range(0, 100, 1, "suffix:mad/s")
var low_speed = 1.0
@export
@export_range(0, 100, 1, "suffix:rad/s")
var high_speed = 10.0
@export
var pre = 1.0
@export
var post = 1.0
# Called when the node enters the scene tree for the first time.
# Member variables
var _original_color = null
func _ready():
pass # Replace with function body.
$AudioStreamPlayer3D.stream = sound
$AudioStreamPlayer3D.volume_db = volume
$AudioStreamPlayer3D.finished.connect(_on_finished_playing)
# Make sure we have a unique material
# TODO: Why the fuck do I have to do this!?
# Isn't that the whole point of the "Make Unique"
$Koob.material = $Koob.material.duplicate()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var players = get_tree().get_nodes_in_group("Players")
@ -30,7 +58,19 @@ func _process(delta):
self.rotate_y(spin_speed * delta)
func interact(other):
if $AudioStreamPlayer3D.playing:
return
_original_color = $Koob.material.albedo_color
var random_color = Color(randf(), randf(), randf())
$Koob.material.albedo_color = random_color
print(other)
$AudioStreamPlayer3D.play()
func _on_finished_playing():
if _original_color:
$Koob.material.albedo_color = _original_color

View file

@ -4,8 +4,7 @@
[sub_resource type="BoxMesh" id="BoxMesh_sbsxh"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_7hakv"]
albedo_color = Color(0, 1, 1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8bjqg"]
[sub_resource type="Animation" id="Animation_njjyi"]
resource_name = "bob"
@ -34,9 +33,9 @@ size = Vector3(1, 1.5, 1)
script = ExtResource("1_omu2m")
[node name="Koob" type="CSGMesh3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.11043, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1606, 0)
mesh = SubResource("BoxMesh_sbsxh")
material = SubResource("StandardMaterial3D_7hakv")
material = SubResource("StandardMaterial3D_8bjqg")
[node name="AnimationPlayer" type="AnimationPlayer" parent="Koob"]
libraries = {
@ -51,3 +50,5 @@ active = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("BoxShape3D_k4wkk")
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]

2
assets

@ -1 +1 @@
Subproject commit 4eb489257dc66fe5f0f79d589b3dbfe973a86fad
Subproject commit 15470ad69c0f04aa350d3a87e6e050a76d4c4cf3

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://7s6wb487kv2d"
path="res://.godot/imported/bomb-has-been-defused-csgo-sound-effect.mp3-332b53da130915533f660c596948e2ca.mp3str"
[deps]
source_file="res://bomb-has-been-defused-csgo-sound-effect.mp3"
dest_files=["res://.godot/imported/bomb-has-been-defused-csgo-sound-effect.mp3-332b53da130915533f660c596948e2ca.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -1,6 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://bp1fooevcl4lk"]
[gd_scene load_steps=6 format=3 uid="uid://bp1fooevcl4lk"]
[ext_resource type="ArrayMesh" uid="uid://cfm21e1rmsbvt" path="res://assets/maps/devworld.obj" id="1_67d5q"]
[ext_resource type="PackedScene" uid="uid://wl1n3y8mcq0x" path="res://Commentary.tscn" id="2_3gk04"]
[ext_resource type="AudioStream" uid="uid://d100ilqihkimr" path="res://whatareyouwatchingbro.mp3" id="3_qy4vp"]
[ext_resource type="AudioStream" uid="uid://7s6wb487kv2d" path="res://bomb-has-been-defused-csgo-sound-effect.mp3" id="3_sy6mw"]
[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_fwixm"]
data = PackedVector3Array(-504, -64, 256, -504, -64, 128, -504, -192, 128, -504, -192, 256, -504, -64, 256, -504, -192, 128, -504, -64, 256, -512, -64, 256, -512, -64, 128, -504, -64, 128, -504, -64, 256, -512, -64, 128, -504, -64, 256, -504, -192, 256, -512, -192, 256, -512, -64, 256, -504, -64, 256, -512, -192, 256, -504, -64, 128, -512, -64, 128, -512, -192, 128, -504, -192, 128, -504, -64, 128, -512, -192, 128, -504, -192, 256, -504, -192, 128, -512, -192, 128, -512, -192, 256, -504, -192, 256, -512, -192, 128, -512, -64, 256, -512, -192, 256, -512, -192, 128, -512, -64, 128, -512, -64, 256, -512, -192, 128, -128, 64, 8, -128, 64, 0, -128, -320, 0, -128, -320, 8, -128, 64, 8, -128, -320, 0, -128, 64, 8, -512, 64, 8, -512, 64, 0, -128, 64, 0, -128, 64, 8, -512, 64, 0, -128, 64, 8, -128, -320, 8, -512, -320, 8, -512, 64, 8, -128, 64, 8, -512, -320, 8, -128, 64, 0, -512, 64, 0, -512, -320, 0, -128, -320, 0, -128, 64, 0, -512, -320, 0, -128, -320, 8, -128, -320, 0, -512, -320, 0, -512, -320, 8, -128, -320, 8, -512, -320, 0, -512, 64, 8, -512, -320, 8, -512, -320, 0, -512, 64, 0, -512, 64, 8, -512, -320, 0, -512, 64, 392, -512, 64, 8, -512, -320, 8, -512, -320, 392, -512, 64, 392, -512, -320, 8, -512, 64, 392, -520, 64, 392, -520, 64, 8, -512, 64, 8, -512, 64, 392, -520, 64, 8, -512, 64, 392, -512, -320, 392, -520, -320, 392, -520, 64, 392, -512, 64, 392, -520, -320, 392, -512, 64, 8, -520, 64, 8, -520, -320, 8, -512, -320, 8, -512, 64, 8, -520, -320, 8, -520, 64, 392, -520, -320, 392, -520, -320, 8, -520, 64, 8, -520, 64, 392, -520, -320, 8, -512, -320, 392, -512, -320, 8, -520, -320, 8, -520, -320, 392, -512, -320, 392, -520, -320, 8, 512, 1024, 416, 512, 1024, 96, 512, 1016, 96, 512, 1016, 416, 512, 1024, 416, 512, 1016, 96, 512, 1016, 96, 512, 1024, 96, 512, 1016, 0, 512, 1024, 96, 512, 1024, 0, 512, 1016, 0, -512, 1024, 96, 512, 1024, 96, 512, 1024, 416, 512, 1024, 96, 16, 1024, 96, 16, 1024, 0, 512, 1024, 96, 16, 1024, 0, 512, 1024, 0, -512, 1024, 96, 512, 1024, 416, -512, 1024, 416, -32, 1024, 96, -512, 1024, 96, -512, 1024, 0, -32, 1024, 96, -512, 1024, 0, -32, 1024, 0, 512, 1024, 96, 512, 1016, 96, 16, 1016, 96, 16, 1024, 96, 512, 1024, 96, 16, 1016, 96, 512, 1024, 0, 16, 1024, 0, 16, 1016, 0, 512, 1016, 0, 512, 1024, 0, 16, 1016, 0, 512, 1016, 416, 512, 1016, 96, -512, 1016, 96, 512, 1016, 96, 512, 1016, 0, 16, 1016, 0, 512, 1016, 96, 16, 1016, 0, 16, 1016, 96, 512, 1016, 416, -512, 1016, 96, -512, 1016, 416, -512, 1016, 0, -512, 1016, 96, -32, 1016, 96, -512, 1016, 0, -32, 1016, 96, -32, 1016, 0, 16, 1024, 96, 16, 1016, 96, 16, 1016, 0, 16, 1024, 0, 16, 1024, 96, 16, 1016, 0, -32, 1024, 96, -32, 1024, 0, -32, 1016, 0, -32, 1016, 96, -32, 1024, 96, -32, 1016, 0, 512, 1024, 416, 512, 1016, 416, -512, 1016, 416, -512, 1024, 416, 512, 1024, 416, -512, 1016, 416, -32, 1024, 96, -32, 1016, 96, -512, 1016, 96, -512, 1024, 96, -32, 1024, 96, -512, 1016, 96, 512, 1024, 96, -512, 1024, 96, -512, 1016, 96, 512, 1016, 96, 512, 1024, 96, -512, 1016, 96, -512, 1024, 416, -512, 1016, 416, -512, 1016, 96, -512, 1024, 96, -512, 1024, 416, -512, 1016, 96, -512, 1024, 96, -512, 1016, 96, -512, 1016, 0, -512, 1024, 0, -512, 1024, 96, -512, 1016, 0, -32, 1024, 0, -512, 1024, 0, -512, 1016, 0, -32, 1016, 0, -32, 1024, 0, -512, 1016, 0, 1024, 1024, 0, 1024, 1024, -64, 1024, -1024, -64, 1024, -1024, 0, 1024, 1024, 0, 1024, -1024, -64, 1024, 1024, 0, -1024, 1024, 0, -1024, 1024, -64, 1024, 1024, -64, 1024, 1024, 0, -1024, 1024, -64, 1024, 1024, 0, 1024, -1024, 0, -1024, -1024, 0, -1024, 1024, 0, 1024, 1024, 0, -1024, -1024, 0, 1024, 1024, -64, -1024, 1024, -64, -1024, -1024, -64, 1024, -1024, -64, 1024, 1024, -64, -1024, -1024, -64, 1024, -1024, 0, 1024, -1024, -64, -1024, -1024, -64, -1024, -1024, 0, 1024, -1024, 0, -1024, -1024, -64, -1024, 1024, 0, -1024, -1024, 0, -1024, -1024, -64, -1024, 1024, -64, -1024, 1024, 0, -1024, -1024, -64)
@ -14,3 +17,15 @@ mesh = ExtResource("1_67d5q")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(0.04, 0, 0, 0, -1.74846e-09, 0.04, 0, -0.04, -1.74846e-09, 0, 0, 0)
shape = SubResource("ConcavePolygonShape3D_fwixm")
[node name="Commentary" parent="." instance=ExtResource("2_3gk04")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.125, -0.25, 0.496153)
sound = ExtResource("3_sy6mw")
volume = -20.0
capture_radius = 5.0
low_speed = 2.0
[node name="Commentary2" parent="." instance=ExtResource("2_3gk04")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.06073, -0.25, 3.2)
sound = ExtResource("3_qy4vp")
volume = -30.0

BIN
whatareyouwatchingbro.mp3 Normal file

Binary file not shown.

View file

@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://d100ilqihkimr"
path="res://.godot/imported/whatareyouwatchingbro.mp3-4ec59e2251ee0b7f5b891fae8fab835b.mp3str"
[deps]
source_file="res://whatareyouwatchingbro.mp3"
dest_files=["res://.godot/imported/whatareyouwatchingbro.mp3-4ec59e2251ee0b7f5b891fae8fab835b.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

View file

@ -1,8 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://cv8621s5oukrb"]
[gd_scene load_steps=10 format=3 uid="uid://cv8621s5oukrb"]
[ext_resource type="PackedScene" uid="uid://dyyf1q12dchhq" path="res://Player.tscn" id="2_jba6q"]
[ext_resource type="PackedScene" uid="uid://cp4rwojl3c3y3" path="res://test.tscn" id="3_wlkcu"]
[ext_resource type="PackedScene" uid="uid://wl1n3y8mcq0x" path="res://Commentary.tscn" id="4_edude"]
[ext_resource type="ArrayMesh" uid="uid://bqnoaomgwec3w" path="res://assets/maps/mapentities.obj" id="5_wn745"]
[ext_resource type="Script" path="res://KeyOverlay.gd" id="6_crgb3"]
[ext_resource type="PackedScene" uid="uid://bp1fooevcl4lk" path="res://devworld.tscn" id="7_1im6f"]
@ -34,11 +33,6 @@ omni_range = 99.7884
[node name="CardboardKreb" parent="." instance=ExtResource("3_wlkcu")]
transform = Transform3D(1.79237, 0, 2.4057, 0, 3, 0, -2.4057, 0, 1.79237, -9.69573, 0.32, -0.222977)
[node name="Commentary" parent="." instance=ExtResource("4_edude")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3.72781, -0.25, 0.496153)
capture_radius = 5.0
low_speed = 2.0
[node name="Mapentities" type="MeshInstance3D" parent="."]
transform = Transform3D(0.039, 0, 0, 0, -1.70474e-09, 0.039, 0, -0.039, -1.70474e-09, 0, 0, 0)
mesh = ExtResource("5_wn745")