Rename SFXPlayer to SoundPlayer

Now that music playback is handled by this singleton the old name is insufficient
This commit is contained in:
Luke Hubmayer-Werner 2021-01-28 22:47:19 +10:30
parent 445a814654
commit 437d361796
4 changed files with 16 additions and 16 deletions

View File

@ -30,7 +30,7 @@ Rules="*res://singletons/Rules.gd"
FileLoader="*res://singletons/FileLoader.gd"
Library="*res://singletons/Library.gd"
GameTheme="*res://singletons/GameTheme.gd"
SFXPlayer="*res://singletons/SFXPlayer.gd"
SoundPlayer="*res://singletons/SoundPlayer.gd"
[debug]
@ -59,6 +59,7 @@ singletons_disabled=[ ]
[rendering]
vram_compression/import_etc=true
environment/default_clear_color=Color( 0.11, 0.11, 0.11, 1 )
quality/filters/msaa=1
environment/default_environment="res://default_env.tres"
quality/subsampling/x=1.0

View File

@ -193,7 +193,7 @@ func _draw_song_select(center: Vector2) -> Array:
var subsize = size * scales.value(abs(s_delta))
var gx = center.x - (subsize + spacer_x) * s_delta
var songslist = Library.genre_songs[g].keys()
var genre_str = '%s (%d)'%[genres.keys()[g], len(songslist)]
var genre_str = '%s (%d songs)'%[genres.keys()[g], len(songslist)]
draw_string_centered(GenreFont, Vector2(center.x, gy), genre_str, Color.lightblue)
var s = len(songslist)
var key = songslist[self.selected_song_idx % s]
@ -462,46 +462,46 @@ func set_menu_mode(mode):
func touch_select_song(touchdict):
if (self.selected_genre == touchdict.genre_idx) and (self.selected_song_idx == touchdict.song_idx):
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
# var songslist = genres[genres.keys()[selected_genre]]
# selected_song_key = songslist[self.target_song_idx % len(songslist)]
set_menu_mode(MenuMode.CHART_SELECT)
else:
self.selected_genre = touchdict.genre_idx
self.target_song_idx = touchdict.song_idx
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
load_preview()
func touch_select_chart(touchdict):
if touchdict.chart_idx == selected_difficulty:
if touchdict.enabled:
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
set_menu_mode(MenuMode.GAMEPLAY)
else:
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_error, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_error, 0.0)
elif touchdict.chart_idx < 0:
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, -3.0, 0.7)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -3.0, 0.7)
set_menu_mode(MenuMode.SONG_SELECT)
else:
self.selected_difficulty = touchdict.chart_idx
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, -4.5)
func touch_gameplay(touchdict):
if touchdict.has('action'):
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
if touchdict.action == 'stop':
NoteHandler.stop()
func touch_score_screen(touchdict):
if touchdict.has('next_menu'):
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
set_menu_mode(touchdict.next_menu)
ScoreText.score = ''
ScoreText.score_sub = ''
# TODO: time this to coincide with the menu going fully offscreen
ScoreText.update()
elif touchdict.has('action'):
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, snd_interact, 0.0)
if touchdict.action == 'save':
save_score()

View File

@ -8,7 +8,7 @@ var running := false
var song_key = ''
export var VideoPlayerPath := @'../../video'
onready var MusicPlayer := SFXPlayer.music_player
onready var MusicPlayer := SoundPlayer.music_player
onready var VideoPlayer := get_node(VideoPlayerPath)
onready var Painter = $Painter
@ -203,12 +203,12 @@ func make_slide_trail_mesh(note) -> ArrayMesh:
#----------------------------------------------------------------------------------------------------------------------------------------------
func make_judgement_column(judgement, column: int):
active_judgement_texts.append({col=column, judgement=judgement, time=t})
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
func make_judgement_pos(judgement, pos: Vector2):
# Positional judgement text not yet implemented, will do if touches are ever added
#active_judgement_texts.append({judgement=judgement, time=t})
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_judgement[judgement], GameTheme.db_judgement[judgement], GameTheme.pitch_judgement[judgement])
func activate_note(note, judgement):
@ -497,7 +497,7 @@ func stop():
next_note_to_load = 10000000 # Hacky but whatever
func intro_click():
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_count_in)
SoundPlayer.play(SoundPlayer.Type.NON_POSITIONAL, self, GameTheme.snd_count_in)
func get_realtime_precise() -> float:
# Usually we only update the gametime once per process loop, but for input callbacks it's good to have msec precision

View File

@ -38,7 +38,6 @@ func play(type: int, parent: Node, stream: AudioStream, volume_db: float = 0.0,
audio_stream_player.connect("finished", audio_stream_player, "queue_free")
# This singleton and API will need renaming later to reflect the new purposes
var music_player := AudioStreamPlayer.new()
func _ready() -> void:
add_child(music_player)