mirror of
https://github.com/litruv/PNGTuber-Plus.git
synced 2026-07-24 02:26:02 +10:00
Compare commits
3 Commits
build-f3fe
...
build-32ed
| Author | SHA1 | Date | |
|---|---|---|---|
| 711865c6a4 | |||
| d231b730f7 | |||
| 8ba361f3c2 |
@@ -8,9 +8,10 @@
|
||||
- **Rotation Wobble**: New sprite rotation effects with frequency and amplitude controls
|
||||
- **Enhanced Modifier Keys**: Support for complex key combinations (Ctrl+Shift+Alt+Cmd)
|
||||
- **Godot 4.4.1 Support**: Updated for latest Godot stable release
|
||||
- **Microphone Improvements**: Audio delay fix & more *from [k0ffinz/PNGTuber-Plus](https://github.com/k0ffinz/PNGTuber-Plus)*
|
||||
|
||||
## 🙏 Credits
|
||||
|
||||
- **Original Project**: PNGTuber Plus base application
|
||||
- **Original Project**: [PNGTuber Plus by kaiakairos](https://github.com/kaiakairos/PNGTuber-Plus)
|
||||
- **StreamDeck Plugin**: Based on [BoyneGames StreamDeck Godot Plugin](https://github.com/BoyneGames/streamdeck-godot-plugin)
|
||||
- **Enhanced Features**: Max Litruv Boonzaayer
|
||||
- **Microphone Improvements**: k0ffinz - Experimental mic loudness detection, improved audio initialization, and audio delay fixes from [k0ffinz/PNGTuber-Plus](https://github.com/k0ffinz/PNGTuber-Plus)
|
||||
@@ -29,13 +29,13 @@ var blink = false
|
||||
var blinkTick = 0
|
||||
|
||||
#Audio Listener
|
||||
|
||||
var currentMicrophone = null
|
||||
var playa:AudioStreamPlayer
|
||||
|
||||
var speaking = false
|
||||
var spectrum
|
||||
var volume = 0
|
||||
var volumeSensitivity = 0.0
|
||||
var experimentalMicLoudness = false
|
||||
|
||||
var volumeLimit = 0.0
|
||||
var senseLimit = 0.0
|
||||
@@ -44,8 +44,6 @@ var senseLimit = 0.0
|
||||
signal startSpeaking
|
||||
signal stopSpeaking
|
||||
|
||||
var micResetTime = 180
|
||||
|
||||
var updatePusherNode = null
|
||||
|
||||
var rand = RandomNumberGenerator.new()
|
||||
@@ -56,28 +54,23 @@ func _ready():
|
||||
if !Saving.settings.has("useStreamDeck"):
|
||||
Saving.settings["useStreamDeck"] = false
|
||||
|
||||
if Saving.settings.has("secondsToMicReset"):
|
||||
Global.micResetTime = Saving.settings["secondsToMicReset"]
|
||||
if Saving.settings.has("experimentalMicLoudness"):
|
||||
Global.experimentalMicLoudness = Saving.settings["experimentalMicLoudness"]
|
||||
else:
|
||||
Saving.settings["secondsToMicReset"] = 180
|
||||
|
||||
Saving.settings["experimentalMicLoudness"] = false
|
||||
|
||||
createMicrophone()
|
||||
|
||||
func createMicrophone():
|
||||
var playa = AudioStreamPlayer.new()
|
||||
var mic = AudioStreamMicrophone.new()
|
||||
playa.stream = mic
|
||||
playa.autoplay = true
|
||||
if playa != null:
|
||||
remove_child(playa)
|
||||
playa.free()
|
||||
playa = AudioStreamPlayer.new()
|
||||
playa.bus = "MIC"
|
||||
playa.stream = AudioStreamMicrophone.new()
|
||||
add_child(playa)
|
||||
currentMicrophone = playa
|
||||
await get_tree().create_timer(micResetTime).timeout
|
||||
if currentMicrophone != playa:
|
||||
return
|
||||
deleteAllMics()
|
||||
currentMicrophone = null
|
||||
await get_tree().create_timer(0.25).timeout
|
||||
createMicrophone()
|
||||
await get_tree().create_timer(0.25).timeout # apparently it works to fix WASAPI "Initialize failed with error 0xffffffff88890002" and "init_input_device" errors
|
||||
playa.play()
|
||||
|
||||
func deleteAllMics():
|
||||
for child in get_children():
|
||||
@@ -87,8 +80,9 @@ func deleteAllMics():
|
||||
func _process(delta):
|
||||
animationTick += 1
|
||||
|
||||
volume = spectrum.get_magnitude_for_frequency_range(20, 20000).length()
|
||||
if currentMicrophone != null:
|
||||
volume = (AudioServer.get_bus_peak_volume_left_db(1, 0) + AudioServer.get_bus_peak_volume_right_db(1, 0)) / 1600.0 + 0.25 if experimentalMicLoudness else spectrum.get_magnitude_for_frequency_range(20, 20000).length()
|
||||
|
||||
if playa != null:
|
||||
volumeSensitivity = lerp(volumeSensitivity,0.0,delta*2)
|
||||
|
||||
if volume>volumeLimit:
|
||||
|
||||
@@ -54,13 +54,13 @@ var settings = {
|
||||
"bounce":250,
|
||||
"gravity":1000,
|
||||
"maxFPS":60,
|
||||
"secondsToMicReset":180,
|
||||
"backgroundColor":var_to_str(Color(0.0,0.0,0.0,0.0)),
|
||||
"filtering":false,
|
||||
"costumeKeys":["1","2","3","4","5","6","7","8","9","0"],
|
||||
"blinkSpeed":1.0,
|
||||
"blinkChance":200,
|
||||
"bounceOnCostumeChange":false,
|
||||
"experimentalMicLoudness":false,
|
||||
}
|
||||
|
||||
var settingsPath = "user://settings.pngtp"
|
||||
|
||||
@@ -480,9 +480,9 @@ func _on_kofi_pressed():
|
||||
Global.pushUpdate("Support me on ko-fi!")
|
||||
|
||||
|
||||
func _on_twitter_pressed():
|
||||
OS.shell_open("https://twitter.com/kaiakairos")
|
||||
Global.pushUpdate("Follow me on twitter!")
|
||||
func _on_bluesky_pressed():
|
||||
OS.shell_open("https://bsky.app/profile/kaiakairos.net")
|
||||
Global.pushUpdate("Follow me on bluesky!")
|
||||
|
||||
|
||||
func _on_replace_button_pressed():
|
||||
|
||||
@@ -14341,7 +14341,7 @@ offset_bottom = 27.0
|
||||
theme = SubResource("Theme_rv56a")
|
||||
flat = true
|
||||
|
||||
[node name="twitter" type="Button" parent="ControlPanel/Links"]
|
||||
[node name="bluesky" type="Button" parent="ControlPanel/Links"]
|
||||
offset_left = -5.0
|
||||
offset_top = -29.0
|
||||
offset_right = 61.0
|
||||
@@ -14730,7 +14730,7 @@ z_index = -4096
|
||||
[connection signal="pressed" from="ControlPanel/SettingsButton/settingsButtons" to="." method="_on_settings_buttons_pressed"]
|
||||
[connection signal="pressed" from="ControlPanel/Edit/Button" to="." method="swapMode"]
|
||||
[connection signal="pressed" from="ControlPanel/Links/kofi" to="." method="_on_kofi_pressed"]
|
||||
[connection signal="pressed" from="ControlPanel/Links/twitter" to="." method="_on_twitter_pressed"]
|
||||
[connection signal="pressed" from="ControlPanel/Links/bluesky" to="." method="_on_bluesky_pressed"]
|
||||
[connection signal="pressed" from="EditControls/Add/addButton" to="." method="_on_add_button_pressed"]
|
||||
[connection signal="pressed" from="EditControls/Link/linkButton" to="." method="_on_link_button_pressed"]
|
||||
[connection signal="pressed" from="EditControls/Exit/Button2" to="." method="swapMode"]
|
||||
|
||||
@@ -23,6 +23,7 @@ config/icon="res://icon.png"
|
||||
[audio]
|
||||
|
||||
driver/enable_input=true
|
||||
buses/channel_disable_time=0.0
|
||||
|
||||
[autoload]
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 14 KiB |
@@ -7,17 +7,11 @@ func _ready():
|
||||
|
||||
|
||||
func _on_button_pressed():
|
||||
|
||||
if !get_parent().get_parent().get_parent().visible:
|
||||
return
|
||||
|
||||
AudioServer.input_device = micName
|
||||
Global.deleteAllMics()
|
||||
Global.currentMicrophone = null
|
||||
|
||||
Global.createMicrophone()
|
||||
get_parent().get_parent().get_parent().visible = false
|
||||
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
Global.createMicrophone()
|
||||
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ func setvalues():
|
||||
label.text = "costume " + str(tag) + " key: \"" + Global.main.costumeKeys[tag-1] + "\""
|
||||
tag += 1
|
||||
|
||||
$experimentalMicLoudness/checkmark.button_pressed = Global.experimentalMicLoudness
|
||||
|
||||
func _on_color_picker_button_color_changed(color):
|
||||
get_viewport().transparent_bg = false
|
||||
RenderingServer.set_default_clear_color(color)
|
||||
@@ -206,6 +208,13 @@ func _on_stream_deck_check_toggled(button_pressed):
|
||||
get_node("/root/ElgatoStreamDeck").refresh_connection()
|
||||
Global.pushUpdate("StreamDeck integration " + ("enabled" if button_pressed else "disabled") + ".")
|
||||
|
||||
## Handle experimental microphone loudness toggle
|
||||
## @param checked: bool - Whether experimental mic loudness should be enabled
|
||||
func _on_experimental_mic_loudness_toggle(checked):
|
||||
Global.experimentalMicLoudness = checked
|
||||
Saving.settings["experimentalMicLoudness"] = checked
|
||||
print("Experimental mic loudness: ", checked)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
var g = to_local(get_global_mouse_position())
|
||||
|
||||
@@ -14289,46 +14289,67 @@ offset_bottom = 28.0
|
||||
text = "confirm"
|
||||
|
||||
[node name="StreamDeck" type="Node2D" parent="."]
|
||||
position = Vector2(16, 373)
|
||||
position = Vector2(16, 337)
|
||||
|
||||
[node name="Label" type="Label" parent="StreamDeck"]
|
||||
offset_right = 138.0
|
||||
offset_bottom = 34.0
|
||||
text = "use streamdeck"
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="streamDeckCheck" type="CheckBox" parent="StreamDeck"]
|
||||
offset_left = 130.0
|
||||
offset_top = 1.0
|
||||
offset_right = 154.0
|
||||
offset_bottom = 25.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="experimentalMicLoudness" type="Node2D" parent="."]
|
||||
position = Vector2(16, 369)
|
||||
|
||||
[node name="Label" type="Label" parent="experimentalMicLoudness"]
|
||||
offset_right = 200.0
|
||||
offset_bottom = 34.0
|
||||
text = "mic loudness"
|
||||
|
||||
[node name="checkmark" type="CheckBox" parent="experimentalMicLoudness"]
|
||||
offset_left = 130.0
|
||||
offset_top = 1.0
|
||||
offset_right = 154.0
|
||||
offset_bottom = 25.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="AntiAliasing" type="Node2D" parent="."]
|
||||
position = Vector2(16, 405)
|
||||
position = Vector2(16, 401)
|
||||
|
||||
[node name="Label" type="Label" parent="AntiAliasing"]
|
||||
offset_right = 138.0
|
||||
offset_bottom = 34.0
|
||||
text = "texture filtering"
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="CheckBox" type="CheckBox" parent="AntiAliasing"]
|
||||
offset_left = 130.0
|
||||
offset_top = 1.0
|
||||
offset_right = 154.0
|
||||
offset_bottom = 25.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="bounceOnCostume" type="Node2D" parent="."]
|
||||
position = Vector2(17, 341)
|
||||
position = Vector2(17, 305)
|
||||
|
||||
[node name="Label" type="Label" parent="bounceOnCostume"]
|
||||
offset_right = 138.0
|
||||
offset_bottom = 34.0
|
||||
text = "costume bounce"
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="costumeCheck" type="CheckBox" parent="bounceOnCostume"]
|
||||
offset_left = 130.0
|
||||
offset_top = 1.0
|
||||
offset_right = 154.0
|
||||
offset_bottom = 25.0
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="BounceForce" type="Node2D" parent="."]
|
||||
position = Vector2(22, 115)
|
||||
@@ -14832,7 +14853,7 @@ offset_bottom = -75.0
|
||||
text = "costume hotkeys"
|
||||
|
||||
[node name="BlinkSpeed" type="Node2D" parent="."]
|
||||
position = Vector2(17, 283)
|
||||
position = Vector2(17, 253)
|
||||
|
||||
[node name="Label" type="Label" parent="BlinkSpeed"]
|
||||
offset_left = -10.0
|
||||
@@ -14841,6 +14862,7 @@ offset_right = 158.0
|
||||
offset_bottom = 27.0
|
||||
text = "blink speed: 1"
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="blinkSpeed" type="HSlider" parent="BlinkSpeed"]
|
||||
offset_left = -9.0
|
||||
@@ -14851,9 +14873,10 @@ theme = SubResource("Theme_e6tc4")
|
||||
max_value = 20.0
|
||||
value = 1.0
|
||||
scrollable = false
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="BlinkChance" type="Node2D" parent="."]
|
||||
position = Vector2(17, 235)
|
||||
position = Vector2(17, 205)
|
||||
|
||||
[node name="Label" type="Label" parent="BlinkChance"]
|
||||
offset_left = -10.0
|
||||
@@ -14862,6 +14885,7 @@ offset_right = 160.0
|
||||
offset_bottom = 27.0
|
||||
text = "blink chance: 1 in 200"
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[node name="blinkChance" type="HSlider" parent="BlinkChance"]
|
||||
offset_left = -8.0
|
||||
@@ -14873,6 +14897,7 @@ min_value = 1.0
|
||||
max_value = 300.0
|
||||
value = 200.0
|
||||
scrollable = false
|
||||
metadata/_edit_use_anchors_ = true
|
||||
|
||||
[connection signal="pressed" from="Background/Transparent/Button" to="." method="_on_button_pressed"]
|
||||
[connection signal="pressed" from="Background/Green/greenButton" to="." method="_on_green_button_pressed"]
|
||||
@@ -14883,6 +14908,7 @@ scrollable = false
|
||||
[connection signal="value_changed" from="MaxFPS/fpsDrag" to="." method="_on_fps_drag_value_changed"]
|
||||
[connection signal="pressed" from="MaxFPS/confirm" to="." method="_on_confirm_pressed"]
|
||||
[connection signal="toggled" from="StreamDeck/streamDeckCheck" to="." method="_on_stream_deck_check_toggled"]
|
||||
[connection signal="toggled" from="experimentalMicLoudness/checkmark" to="." method="_on_experimental_mic_loudness_toggle"]
|
||||
[connection signal="toggled" from="AntiAliasing/CheckBox" to="." method="_on_check_box_toggled"]
|
||||
[connection signal="toggled" from="bounceOnCostume/costumeCheck" to="." method="_on_costume_check_toggled"]
|
||||
[connection signal="value_changed" from="BounceForce/bounceForce" to="." method="_on_bounce_force_value_changed"]
|
||||
|
||||
Reference in New Issue
Block a user