Merge pull request #407 from aaronfranke/3.1

Remove BPM Sync demo from the 3.1 branch
This commit is contained in:
Aaron Franke
2020-02-10 19:21:38 -05:00
committed by GitHub
14 changed files with 0 additions and 286 deletions

View File

@@ -1,57 +0,0 @@
extends Panel
const BPM = 116
const BARS = 4
var playing = false
const COMPENSATE_FRAMES = 2
const COMPENSATE_HZ = 60.0
const SYNC_SOURCE_SYSTEM_CLOCK = 0
const SYNC_SOURCE_SOUND_CLOCK = 1
var sync_source = SYNC_SOURCE_SYSTEM_CLOCK
# Used by system clock.
var time_begin
var time_delay
func strsec(secs):
var s = str(secs)
if (secs < 10):
s = "0" + s
return s
func _process(_delta):
if (!playing or !$Player.playing):
return
var time = 0.0
if (sync_source == SYNC_SOURCE_SYSTEM_CLOCK):
# Obtain from ticks.
time = (OS.get_ticks_usec() - time_begin) / 1000000.0
# Compensate.
time -= time_delay
elif (sync_source == SYNC_SOURCE_SOUND_CLOCK):
time = $Player.get_playback_position() + AudioServer.get_time_since_last_mix() - AudioServer.get_output_latency() + (1 / COMPENSATE_HZ) * COMPENSATE_FRAMES
var beat = int(time * BPM / 60.0)
var seconds = int(time)
var seconds_total = int($Player.stream.get_length())
$Label.text = str("BEAT: ", beat % BARS + 1, "/", BARS, " TIME: ", seconds / 60, ":", strsec(seconds % 60), " / ", seconds_total / 60, ":", strsec(seconds_total % 60))
func _on_PlaySystem_pressed():
sync_source = SYNC_SOURCE_SYSTEM_CLOCK
time_begin = OS.get_ticks_usec()
time_delay = AudioServer.get_time_to_next_mix() + AudioServer.get_output_latency()
playing = true
$Player.play()
func _on_PlaySound_pressed():
sync_source = SYNC_SOURCE_SOUND_CLOCK
playing = true
$Player.play()

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play_sound_button.png-7e88216154de1a5cb6304cbd3751ed46.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://play_sound_button.png"
dest_files=[ "res://.import/play_sound_button.png-7e88216154de1a5cb6304cbd3751ed46.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play_sound_button_hl.png-8d86f81fe37a5f2959088b0948283133.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://play_sound_button_hl.png"
dest_files=[ "res://.import/play_sound_button_hl.png-8d86f81fe37a5f2959088b0948283133.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play_system_button.png-683c51b4d13189b67bb57e75cbb8ef56.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://play_system_button.png"
dest_files=[ "res://.import/play_system_button.png-683c51b4d13189b67bb57e75cbb8ef56.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -1,34 +0,0 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/play_system_button_hl.png-1e926e5d1be4f71f60454646aaa44d20.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://play_system_button_hl.png"
dest_files=[ "res://.import/play_system_button_hl.png-1e926e5d1be4f71f60454646aaa44d20.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@@ -1,59 +0,0 @@
[gd_scene load_steps=10 format=2]
[ext_resource path="res://Control.gd" type="Script" id=1]
[ext_resource path="res://lcd.ttf" type="DynamicFontData" id=2]
[ext_resource path="res://the_comeback2.ogg" type="AudioStream" id=3]
[ext_resource path="res://play_system_button.png" type="Texture" id=4]
[ext_resource path="res://play_system_button_hl.png" type="Texture" id=5]
[ext_resource path="res://play_sound_button.png" type="Texture" id=6]
[ext_resource path="res://play_sound_button_hl.png" type="Texture" id=7]
[sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0, 0, 0, 1 )
[sub_resource type="DynamicFont" id=2]
size = 40
outline_size = 2
outline_color = Color( 0.588235, 0.886275, 0.435294, 0.239216 )
font_data = ExtResource( 2 )
[node name="Control" type="Panel"]
anchor_right = 1.0
anchor_bottom = 1.0
custom_styles/panel = SubResource( 1 )
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Label" type="Label" parent="."]
margin_left = 106.895
margin_top = 427.158
margin_right = 914.895
margin_bottom = 488.158
custom_fonts/font = SubResource( 2 )
custom_colors/font_color = Color( 0.552941, 0.984314, 0.501961, 1 )
align = 1
[node name="Player" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 3 )
[node name="PlaySystem" type="TextureButton" parent="."]
margin_left = 214.737
margin_top = 187.368
margin_right = 342.737
margin_bottom = 315.368
texture_normal = ExtResource( 4 )
texture_pressed = ExtResource( 4 )
texture_hover = ExtResource( 5 )
[node name="PlaySound" type="TextureButton" parent="."]
margin_left = 622.105
margin_top = 183.158
margin_right = 750.105
margin_bottom = 311.158
texture_normal = ExtResource( 6 )
texture_pressed = ExtResource( 6 )
texture_hover = ExtResource( 7 )
[connection signal="pressed" from="PlaySystem" to="." method="_on_PlaySystem_pressed"]
[connection signal="pressed" from="PlaySound" to="." method="_on_PlaySound_pressed"]

View File

@@ -1,19 +0,0 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=4
_global_script_classes=[ ]
_global_script_class_icons={
}
[application]
config/name="BPM Sync Demo"
run/main_scene="res://player.tscn"

Binary file not shown.

View File

@@ -1,15 +0,0 @@
[remap]
importer="ogg_vorbis"
type="AudioStreamOGGVorbis"
path="res://.import/the_comeback2.ogg-4b85e06ff00ff611cbd6022fc43aade8.oggstr"
[deps]
source_file="res://the_comeback2.ogg"
dest_files=[ "res://.import/the_comeback2.ogg-4b85e06ff00ff611cbd6022fc43aade8.oggstr" ]
[params]
loop=true
loop_offset=0