mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
audio volumes are now changable
This commit is contained in:
@@ -36,6 +36,12 @@ sample_rate = -1
|
||||
buffer_size = 0
|
||||
exclusive = false
|
||||
|
||||
[volume]
|
||||
sound = 1.0
|
||||
music = 1.0
|
||||
voice = 1.0
|
||||
hitsound = 1.0
|
||||
|
||||
[video]
|
||||
screen_width = 1280
|
||||
screen_height = 720
|
||||
|
||||
@@ -126,7 +126,7 @@ except OSError as e:
|
||||
raise
|
||||
|
||||
class AudioEngine:
|
||||
def __init__(self, device_type: int, sample_rate: float, buffer_size: int):
|
||||
def __init__(self, device_type: int, sample_rate: float, buffer_size: int, volume_presets: dict[str, float]):
|
||||
self.device_type = device_type
|
||||
if sample_rate == -1:
|
||||
sample_rate = 44100
|
||||
@@ -135,6 +135,7 @@ class AudioEngine:
|
||||
self.sounds = {}
|
||||
self.music_streams = {}
|
||||
self.audio_device_ready = False
|
||||
self.volume_presets = volume_presets
|
||||
|
||||
self.sounds_path = Path("Sounds")
|
||||
|
||||
@@ -236,14 +237,20 @@ class AudioEngine:
|
||||
for name in list(self.sounds.keys()):
|
||||
self.unload_sound(name)
|
||||
|
||||
def play_sound(self, name: str) -> None:
|
||||
def play_sound(self, name: str, volume_preset: str) -> None:
|
||||
"""Play a sound"""
|
||||
if name == 'don':
|
||||
if volume_preset:
|
||||
lib.set_sound_volume(self.don, self.volume_presets[volume_preset]) # type: ignore
|
||||
lib.play_sound(self.don) # type: ignore
|
||||
elif name == 'kat':
|
||||
if volume_preset:
|
||||
lib.set_sound_volume(self.kat, self.volume_presets[volume_preset]) # type: ignore
|
||||
lib.play_sound(self.kat) # type: ignore
|
||||
elif name in self.sounds:
|
||||
sound = self.sounds[name]
|
||||
if volume_preset:
|
||||
lib.set_sound_volume(sound, self.volume_presets[volume_preset]) # type: ignore
|
||||
lib.play_sound(sound) # type: ignore
|
||||
else:
|
||||
print(f"Sound {name} not found")
|
||||
@@ -297,11 +304,13 @@ class AudioEngine:
|
||||
print(f"Failed to load music: {file_path}")
|
||||
return ""
|
||||
|
||||
def play_music_stream(self, name: str) -> None:
|
||||
def play_music_stream(self, name: str, volume_preset: str = '') -> None:
|
||||
"""Play a music stream"""
|
||||
if name in self.music_streams:
|
||||
music = self.music_streams[name]
|
||||
lib.seek_music_stream(music, 0) # type: ignore
|
||||
if volume_preset:
|
||||
lib.set_music_volume(music, self.volume_presets[volume_preset]) # type: ignore
|
||||
lib.play_music_stream(music) # type: ignore
|
||||
else:
|
||||
print(f"Music stream {name} not found")
|
||||
@@ -380,5 +389,5 @@ class AudioEngine:
|
||||
print(f"Music stream {name} not found")
|
||||
|
||||
# Create the global audio instance
|
||||
audio = AudioEngine(get_config()["audio"]["device_type"], get_config()["audio"]["sample_rate"], get_config()["audio"]["buffer_size"])
|
||||
audio = AudioEngine(get_config()["audio"]["device_type"], get_config()["audio"]["sample_rate"], get_config()["audio"]["buffer_size"], get_config()["volume"])
|
||||
audio.set_master_volume(0.75)
|
||||
|
||||
@@ -137,16 +137,16 @@ class Timer:
|
||||
self.last_time = current_time_ms
|
||||
self.counter = str(self.time)
|
||||
if self.time < 10:
|
||||
audio.play_sound('timer_blip')
|
||||
audio.play_sound('timer_blip', 'sound')
|
||||
self.num_resize.start()
|
||||
self.highlight_fade.start()
|
||||
self.highlight_resize.start()
|
||||
if self.time == 10:
|
||||
audio.play_sound('voice_timer_10')
|
||||
audio.play_sound('voice_timer_10', 'voice')
|
||||
elif self.time == 5:
|
||||
audio.play_sound('voice_timer_5')
|
||||
audio.play_sound('voice_timer_5', 'voice')
|
||||
elif self.time == 0:
|
||||
audio.play_sound('voice_timer_0')
|
||||
audio.play_sound('voice_timer_0', 'voice')
|
||||
def draw(self, x: int = 0, y: int = 0):
|
||||
tex = global_tex
|
||||
if self.time < 10:
|
||||
|
||||
@@ -33,7 +33,7 @@ class VideoPlayer:
|
||||
if self.is_finished_list[1]:
|
||||
return
|
||||
if not self.audio_played:
|
||||
audio.play_music_stream(self.audio)
|
||||
audio.play_music_stream(self.audio, 'music')
|
||||
self.audio_played = True
|
||||
audio.update_music_stream(self.audio)
|
||||
self.is_finished_list[1] = audio.get_music_time_length(self.audio) <= audio.get_music_time_played(self.audio)
|
||||
|
||||
@@ -51,7 +51,7 @@ class EntryScreen:
|
||||
self.side_select_fade.start()
|
||||
self.chara = Chara2D(0, 100)
|
||||
self.announce_played = False
|
||||
audio.play_sound('bgm')
|
||||
audio.play_sound('bgm', 'music')
|
||||
|
||||
def on_screen_end(self, next_screen: str):
|
||||
self.screen_init = False
|
||||
@@ -77,8 +77,8 @@ class EntryScreen:
|
||||
self.cloud_resize_loop.start()
|
||||
self.cloud_texture_change.start()
|
||||
self.cloud_fade.start()
|
||||
audio.play_sound('cloud')
|
||||
audio.play_sound(f'entry_start_{global_data.player_num}p')
|
||||
audio.play_sound('cloud', 'sound')
|
||||
audio.play_sound(f'entry_start_{global_data.player_num}p', 'voice')
|
||||
plate_info = global_data.config['nameplate']
|
||||
self.nameplate.unload()
|
||||
self.nameplate = Nameplate(plate_info['name'], plate_info['title'], global_data.player_num, plate_info['dan'], plate_info['gold'])
|
||||
@@ -88,22 +88,22 @@ class EntryScreen:
|
||||
self.chara = Chara2D(1, 100)
|
||||
else:
|
||||
self.chara = Chara2D(0, 100)
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
if is_l_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.side = max(0, self.side - 1)
|
||||
if is_r_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.side = min(2, self.side + 1)
|
||||
elif self.state == State.SELECT_MODE:
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.box_manager.select_box()
|
||||
if is_l_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.box_manager.move_left()
|
||||
if is_r_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.box_manager.move_right()
|
||||
|
||||
def update(self):
|
||||
@@ -127,7 +127,7 @@ class EntryScreen:
|
||||
if self.box_manager.is_finished():
|
||||
return self.on_screen_end(self.box_manager.selected_box())
|
||||
if self.cloud_fade.is_finished and not audio.is_sound_playing(f'entry_start_{global_data.player_num}p') and not self.announce_played:
|
||||
audio.play_sound('select_mode')
|
||||
audio.play_sound('select_mode', 'voice')
|
||||
self.announce_played = True
|
||||
return self.handle_input()
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ class GameScreen:
|
||||
if current_time >= self.end_ms + 8533.34:
|
||||
if not self.result_transition.is_started:
|
||||
self.result_transition.start()
|
||||
audio.play_sound('result_transition')
|
||||
audio.play_sound('result_transition', 'voice')
|
||||
else:
|
||||
self.write_score()
|
||||
self.end_ms = current_time
|
||||
@@ -215,7 +215,7 @@ class GameScreen:
|
||||
if self.song_music is not None:
|
||||
audio.stop_music_stream(self.song_music)
|
||||
self.init_tja(global_data.selected_song, session_data.selected_difficulty)
|
||||
audio.play_sound('restart')
|
||||
audio.play_sound('restart', 'sound')
|
||||
self.song_started = False
|
||||
|
||||
if ray.is_key_pressed(ray.KeyboardKey.KEY_ESCAPE):
|
||||
@@ -581,7 +581,7 @@ class Player:
|
||||
self.is_balloon = False
|
||||
note.popped = True
|
||||
self.balloon_anim.update(current_time, self.curr_balloon_count, note.popped)
|
||||
audio.play_sound('balloon_pop')
|
||||
audio.play_sound('balloon_pop', 'hitsound')
|
||||
self.note_correct(note, current_time)
|
||||
self.curr_balloon_count = 0
|
||||
|
||||
@@ -593,7 +593,7 @@ class Player:
|
||||
self.score += 100
|
||||
self.base_score_list.append(ScoreCounterAnimation(self.player_number, 100))
|
||||
if self.curr_balloon_count == note.count:
|
||||
audio.play_sound('kusudama_pop')
|
||||
audio.play_sound('kusudama_pop', 'hitsound')
|
||||
self.is_balloon = False
|
||||
note.popped = True
|
||||
self.curr_balloon_count = 0
|
||||
@@ -710,7 +710,7 @@ class Player:
|
||||
self.lane_hit_effect = LaneHitEffect(note_type)
|
||||
self.draw_drum_hit_list.append(DrumHitEffect(note_type, side))
|
||||
|
||||
audio.play_sound(sound)
|
||||
audio.play_sound(sound, 'hitsound')
|
||||
|
||||
drum_value = 1 if note_type == 'DON' else 2
|
||||
self.check_note(game_screen, drum_value, current_time)
|
||||
@@ -736,7 +736,7 @@ class Player:
|
||||
self.lane_hit_effect = LaneHitEffect(hit_type)
|
||||
self.autoplay_hit_side = 'R' if self.autoplay_hit_side == 'L' else 'L'
|
||||
self.draw_drum_hit_list.append(DrumHitEffect(hit_type, self.autoplay_hit_side))
|
||||
audio.play_sound(game_screen.sound_don)
|
||||
audio.play_sound(game_screen.sound_don, 'hitsound')
|
||||
note_type = 3 if note.type == 6 else 1
|
||||
self.check_note(game_screen, note_type, current_time)
|
||||
else:
|
||||
@@ -747,7 +747,7 @@ class Player:
|
||||
self.lane_hit_effect = LaneHitEffect(hit_type)
|
||||
self.autoplay_hit_side = 'R' if self.autoplay_hit_side == 'L' else 'L'
|
||||
self.draw_drum_hit_list.append(DrumHitEffect(hit_type, self.autoplay_hit_side))
|
||||
audio.play_sound(game_screen.sound_don)
|
||||
audio.play_sound(game_screen.sound_don, 'hitsound')
|
||||
self.check_note(game_screen, 1, current_time)
|
||||
|
||||
# Handle KAT notes
|
||||
@@ -757,7 +757,7 @@ class Player:
|
||||
self.lane_hit_effect = LaneHitEffect(hit_type)
|
||||
self.autoplay_hit_side = 'R' if self.autoplay_hit_side == 'L' else 'L'
|
||||
self.draw_drum_hit_list.append(DrumHitEffect(hit_type, self.autoplay_hit_side))
|
||||
audio.play_sound(game_screen.sound_kat)
|
||||
audio.play_sound(game_screen.sound_kat, 'hitsound')
|
||||
self.check_note(game_screen, 2, current_time)
|
||||
|
||||
def evaluate_branch(self, current_ms):
|
||||
@@ -1716,7 +1716,7 @@ class ComboAnnounce:
|
||||
|
||||
self.fade.update(current_time_ms)
|
||||
if not self.audio_played:
|
||||
audio.play_sound(f'combo_{self.combo}_{global_data.player_num}p')
|
||||
audio.play_sound(f'combo_{self.combo}_{global_data.player_num}p', 'voice')
|
||||
self.audio_played = True
|
||||
|
||||
def draw(self):
|
||||
@@ -1815,7 +1815,7 @@ class FailAnimation:
|
||||
self.text_fade_in.start()
|
||||
self.name = 'in'
|
||||
self.frame = self.bachio_texture_change.attribute
|
||||
audio.play_sound('fail')
|
||||
audio.play_sound('fail', 'sound')
|
||||
def update(self, current_time_ms: float):
|
||||
self.bachio_fade_in.update(current_time_ms)
|
||||
self.bachio_texture_change.update(current_time_ms)
|
||||
@@ -1859,7 +1859,7 @@ class ClearAnimation:
|
||||
self.draw_clear_full = False
|
||||
self.name = 'in'
|
||||
self.frame = 0
|
||||
audio.play_sound('clear')
|
||||
audio.play_sound('clear', 'sound')
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
self.bachio_fade_in.update(current_time_ms)
|
||||
@@ -1916,7 +1916,7 @@ class FCAnimation:
|
||||
self.draw_clear_full = False
|
||||
self.name = 'in'
|
||||
self.frame = 0
|
||||
audio.play_sound('full_combo')
|
||||
audio.play_sound('full_combo', 'sound')
|
||||
|
||||
def update(self, current_time_ms: float):
|
||||
self.bachio_fade_in.update(current_time_ms)
|
||||
@@ -1936,7 +1936,7 @@ class FCAnimation:
|
||||
self.bachio_move_up.start()
|
||||
self.fan_fade_in.start()
|
||||
self.fan_texture_change.start()
|
||||
audio.play_sound('full_combo_voice')
|
||||
audio.play_sound('full_combo_voice', 'voice')
|
||||
if self.clear_highlight_fade_in.attribute == 1.0:
|
||||
self.draw_clear_full = True
|
||||
for fade in self.clear_separate_fade_in:
|
||||
|
||||
@@ -32,7 +32,7 @@ class ResultScreen:
|
||||
audio.load_screen_sounds('result')
|
||||
self.screen_init = True
|
||||
self.song_info = OutlinedText(session_data.song_title, 40, ray.WHITE, ray.BLACK, outline_thickness=5)
|
||||
audio.play_sound('bgm')
|
||||
audio.play_sound('bgm', 'music')
|
||||
self.fade_in = FadeIn()
|
||||
self.fade_out = tex.get_animation(0)
|
||||
self.fade_in_bottom = tex.get_animation(1)
|
||||
@@ -92,9 +92,9 @@ class ResultScreen:
|
||||
curr_num = self.update_list[self.update_index][0]
|
||||
setattr(self, self.update_list[self.update_index][0], self.score_animator.next_score())
|
||||
if self.update_list[self.update_index] != curr_num:
|
||||
audio.play_sound('num_up')
|
||||
audio.play_sound('num_up', 'sound')
|
||||
if self.score_animator.is_finished:
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.score_delay += 750
|
||||
if self.update_index == len(self.update_list) - 1:
|
||||
self.is_skipped = True
|
||||
@@ -112,7 +112,7 @@ class ResultScreen:
|
||||
self.is_skipped = True
|
||||
else:
|
||||
self.fade_out.start()
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
|
||||
def update(self):
|
||||
self.on_screen_start()
|
||||
@@ -280,7 +280,7 @@ class Crown:
|
||||
self.white_fadein.update(current_ms)
|
||||
self.gleam.update(current_ms)
|
||||
if self.resize_fix.is_finished and not self.sound_played:
|
||||
audio.play_sound('crown')
|
||||
audio.play_sound('crown', 'sound')
|
||||
self.sound_played = True
|
||||
|
||||
def draw(self, crown_name: str):
|
||||
|
||||
@@ -36,6 +36,7 @@ class SettingsScreen:
|
||||
audio.device_type = global_data.config["audio"]["device_type"]
|
||||
audio.target_sample_rate = global_data.config["audio"]["sample_rate"]
|
||||
audio.buffer_size = global_data.config["audio"]["buffer_size"]
|
||||
audio.volume_presets = global_data.config["volume"]
|
||||
audio.init_audio_device()
|
||||
return "ENTRY"
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ class SongSelectScreen:
|
||||
audio.load_screen_sounds('song_select')
|
||||
audio.set_sound_volume('ura_switch', 0.25)
|
||||
audio.set_sound_volume('add_favorite', 3.0)
|
||||
audio.play_sound('bgm')
|
||||
audio.play_sound('voice_enter')
|
||||
audio.play_sound('bgm', 'music')
|
||||
audio.play_sound('voice_enter', 'voice')
|
||||
self.background_move = tex.get_animation(0)
|
||||
self.move_away = tex.get_animation(1)
|
||||
self.diff_fade_out = tex.get_animation(2)
|
||||
@@ -122,7 +122,7 @@ class SongSelectScreen:
|
||||
if self.demo_song is not None:
|
||||
audio.stop_music_stream(self.demo_song)
|
||||
audio.unload_music_stream(self.demo_song)
|
||||
audio.play_sound('bgm')
|
||||
audio.play_sound('bgm', 'music')
|
||||
self.demo_song = None
|
||||
self.navigator.get_current_item().box.wait = get_current_ms()
|
||||
|
||||
@@ -131,24 +131,24 @@ class SongSelectScreen:
|
||||
self.reset_demo_music()
|
||||
for _ in range(10):
|
||||
self.navigator.navigate_left()
|
||||
audio.play_sound('skip')
|
||||
audio.play_sound('skip', 'sound')
|
||||
self.last_moved = get_current_ms()
|
||||
elif ray.is_key_pressed(ray.KeyboardKey.KEY_RIGHT_CONTROL) or (is_r_kat_pressed() and get_current_ms() <= self.last_moved + 50):
|
||||
self.reset_demo_music()
|
||||
for _ in range(10):
|
||||
self.navigator.navigate_right()
|
||||
audio.play_sound('skip')
|
||||
audio.play_sound('skip', 'sound')
|
||||
self.last_moved = get_current_ms()
|
||||
elif is_l_kat_pressed():
|
||||
self.reset_demo_music()
|
||||
self.navigator.navigate_left()
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.last_moved = get_current_ms()
|
||||
|
||||
elif is_r_kat_pressed():
|
||||
self.reset_demo_music()
|
||||
self.navigator.navigate_right()
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.last_moved = get_current_ms()
|
||||
|
||||
# Select/Enter
|
||||
@@ -156,7 +156,7 @@ class SongSelectScreen:
|
||||
selected_item = self.navigator.items[self.navigator.selected_index]
|
||||
if selected_item is not None and selected_item.box.is_back:
|
||||
self.navigator.go_back()
|
||||
audio.play_sound('cancel')
|
||||
audio.play_sound('cancel', 'sound')
|
||||
elif isinstance(selected_item, Directory) and selected_item.collection == Directory.COLLECTIONS[3]:
|
||||
self.state = State.DIFF_SORTING
|
||||
self.diff_sort_selector = DiffSortSelect(self.navigator.diff_sort_statistics, self.navigator.diff_sort_diff, self.navigator.diff_sort_level)
|
||||
@@ -171,8 +171,8 @@ class SongSelectScreen:
|
||||
elif (4 in selected_song.tja.metadata.course_data and
|
||||
3 not in selected_song.tja.metadata.course_data):
|
||||
self.is_ura = True
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('voice_select_diff')
|
||||
audio.play_sound('don', 'sound')
|
||||
audio.play_sound('voice_select_diff', 'voice')
|
||||
self.move_away.start()
|
||||
self.diff_fade_out.start()
|
||||
self.text_fade_out.start()
|
||||
@@ -185,7 +185,7 @@ class SongSelectScreen:
|
||||
current_box = self.navigator.get_current_item().box
|
||||
current_box.is_favorite = not current_box.is_favorite
|
||||
if success:
|
||||
audio.play_sound('add_favorite')
|
||||
audio.play_sound('add_favorite', 'sound')
|
||||
|
||||
def handle_input_selected(self):
|
||||
# Handle song selection confirmation or cancel
|
||||
@@ -195,28 +195,28 @@ class SongSelectScreen:
|
||||
elif is_r_kat_pressed():
|
||||
self.neiro_selector.move_right()
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.neiro_selector.confirm()
|
||||
return
|
||||
if self.modifier_selector is not None:
|
||||
if is_l_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.modifier_selector.left()
|
||||
elif is_r_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
self.modifier_selector.right()
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.modifier_selector.confirm()
|
||||
return
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
if self.selected_difficulty == -3:
|
||||
self._cancel_selection()
|
||||
elif self.selected_difficulty == -2:
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.modifier_selector = ModifierSelector()
|
||||
elif self.selected_difficulty == -1:
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
self.neiro_selector = NeiroSelector()
|
||||
else:
|
||||
self._confirm_selection()
|
||||
@@ -228,7 +228,7 @@ class SongSelectScreen:
|
||||
return selected_song
|
||||
|
||||
if is_l_kat_pressed() or is_r_kat_pressed():
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
selected_song = get_current_song()
|
||||
diffs = sorted(selected_song.tja.metadata.course_data)
|
||||
prev_diff = self.selected_difficulty
|
||||
@@ -251,13 +251,13 @@ class SongSelectScreen:
|
||||
raise Exception("Diff sort selector was not able to be created")
|
||||
if is_l_kat_pressed():
|
||||
self.diff_sort_selector.input_left()
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
if is_r_kat_pressed():
|
||||
self.diff_sort_selector.input_right()
|
||||
audio.play_sound('kat')
|
||||
audio.play_sound('kat', 'sound')
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
tuple = self.diff_sort_selector.input_select()
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
if tuple is None:
|
||||
return
|
||||
diff, level = tuple
|
||||
@@ -286,8 +286,8 @@ class SongSelectScreen:
|
||||
|
||||
def _confirm_selection(self):
|
||||
"""Confirm song selection and create game transition"""
|
||||
audio.play_sound('don')
|
||||
audio.play_sound(f'voice_start_song_{global_data.player_num}p')
|
||||
audio.play_sound('don', 'sound')
|
||||
audio.play_sound(f'voice_start_song_{global_data.player_num}p', 'voice')
|
||||
self.selected_diff_highlight_fade.start()
|
||||
self.selected_diff_text_resize.start()
|
||||
self.selected_diff_text_fadein.start()
|
||||
@@ -352,7 +352,7 @@ class SongSelectScreen:
|
||||
self.ura_toggle = 0
|
||||
self.is_ura = not self.is_ura
|
||||
self.ura_switch_animation.start(not self.is_ura)
|
||||
audio.play_sound('ura_switch')
|
||||
audio.play_sound('ura_switch', 'sound')
|
||||
self.selected_difficulty = 7 - self.selected_difficulty
|
||||
|
||||
def handle_input(self):
|
||||
@@ -742,7 +742,7 @@ class SongBox:
|
||||
if get_current_ms() >= self.history_wait + 3000:
|
||||
self.history_wait = get_current_ms()
|
||||
if self.tja is None and self.texture_index != 17 and not audio.is_sound_playing('voice_enter'):
|
||||
audio.play_sound(f'genre_voice_{self.texture_index}')
|
||||
audio.play_sound(f'genre_voice_{self.texture_index}', 'voice')
|
||||
elif not self.is_open and is_open_prev and audio.is_sound_playing(f'genre_voice_{self.texture_index}'):
|
||||
audio.stop_sound(f'genre_voice_{self.texture_index}')
|
||||
if self.tja_count is not None and self.tja_count > 0 and self.tja_count_text is None:
|
||||
@@ -1167,7 +1167,7 @@ class DiffSortSelect:
|
||||
]
|
||||
for course, levels in self.diff_sort_statistics.items()
|
||||
}
|
||||
audio.play_sound('voice_diff_sort_enter')
|
||||
audio.play_sound('voice_diff_sort_enter', 'voice')
|
||||
|
||||
def update(self, current_ms):
|
||||
self.bg_resize.update(current_ms)
|
||||
@@ -1210,7 +1210,7 @@ class DiffSortSelect:
|
||||
self.bounce_up_2.start()
|
||||
self.bounce_down_2.start()
|
||||
self.confirm_index = 1
|
||||
audio.play_sound('voice_diff_sort_confirm')
|
||||
audio.play_sound('voice_diff_sort_confirm', 'voice')
|
||||
return None
|
||||
if self.selected_box == -1:
|
||||
return (-1, -1)
|
||||
@@ -1218,7 +1218,7 @@ class DiffSortSelect:
|
||||
return (0, -1)
|
||||
elif self.selected_box == 4:
|
||||
return self.get_random_sort()
|
||||
audio.play_sound('voice_diff_sort_level')
|
||||
audio.play_sound('voice_diff_sort_level', 'voice')
|
||||
self.in_level_select = True
|
||||
self.bg_resize.start()
|
||||
self.diff_fade_in.start()
|
||||
@@ -1374,7 +1374,7 @@ class NeiroSelector:
|
||||
self.sounds = neiro_list.readlines()
|
||||
self.sounds.append('無音')
|
||||
self.load_sound()
|
||||
audio.play_sound(f'voice_hitsound_select_{global_data.player_num}p')
|
||||
audio.play_sound(f'voice_hitsound_select_{global_data.player_num}p', 'voice')
|
||||
self.is_finished = False
|
||||
self.is_confirmed = False
|
||||
self.move = tex.get_animation(28)
|
||||
@@ -1408,7 +1408,7 @@ class NeiroSelector:
|
||||
self.direction = -1
|
||||
if self.selected_sound == len(self.sounds):
|
||||
return
|
||||
audio.play_sound(self.curr_sound)
|
||||
audio.play_sound(self.curr_sound, 'hitsound')
|
||||
|
||||
def move_right(self):
|
||||
if self.move.is_started and not self.move.is_finished:
|
||||
@@ -1423,7 +1423,7 @@ class NeiroSelector:
|
||||
self.direction = 1
|
||||
if self.selected_sound == len(self.sounds):
|
||||
return
|
||||
audio.play_sound(self.curr_sound)
|
||||
audio.play_sound(self.curr_sound, 'hitsound')
|
||||
|
||||
def confirm(self):
|
||||
if self.move.is_started and not self.move.is_finished:
|
||||
@@ -1503,7 +1503,7 @@ class ModifierSelector:
|
||||
self.move_sideways = tex.get_animation(31)
|
||||
self.fade_sideways = tex.get_animation(32)
|
||||
self.direction = -1
|
||||
audio.play_sound(f'voice_options_{global_data.player_num}p')
|
||||
audio.play_sound(f'voice_options_{global_data.player_num}p', 'sound')
|
||||
self.text_name = [OutlinedText(ModifierSelector.NAME_MAP[mod.name], 30, ray.WHITE, ray.BLACK, outline_thickness=3.5) for mod in self.mods]
|
||||
self.text_true = OutlinedText('する', 30, ray.WHITE, ray.BLACK, outline_thickness=3.5)
|
||||
self.text_false = OutlinedText('しない', 30, ray.WHITE, ray.BLACK, outline_thickness=3.5)
|
||||
|
||||
@@ -94,7 +94,7 @@ class TitleScreen:
|
||||
self.scene_manager(current_time)
|
||||
if is_l_don_pressed() or is_r_don_pressed():
|
||||
self.fade_out.start()
|
||||
audio.play_sound('don')
|
||||
audio.play_sound('don', 'sound')
|
||||
|
||||
def draw(self):
|
||||
if self.state == State.OP_VIDEO and self.op_video is not None:
|
||||
@@ -133,7 +133,7 @@ class WarningScreen:
|
||||
self.fadein_2.update(current_ms)
|
||||
|
||||
if self.resize.attribute > 1 and not self.sound_played:
|
||||
audio.play_sound('error')
|
||||
audio.play_sound('error', 'sound')
|
||||
self.sound_played = True
|
||||
|
||||
def draw_bg(self):
|
||||
@@ -151,7 +151,7 @@ class WarningScreen:
|
||||
|
||||
def update(self, current_ms: float):
|
||||
if not self.sound_played:
|
||||
audio.play_sound('bachi_hit')
|
||||
audio.play_sound('bachi_hit', 'sound')
|
||||
self.sound_played = True
|
||||
self.fadein.start()
|
||||
self.resize.start()
|
||||
@@ -248,8 +248,8 @@ class WarningScreen:
|
||||
else:
|
||||
self.fade_out.delay = elapsed_time + 500
|
||||
if delay <= elapsed_time and not audio.is_sound_playing('bachi_swipe'):
|
||||
audio.play_sound('warning_voiceover')
|
||||
audio.play_sound('bachi_swipe')
|
||||
audio.play_sound('warning_voiceover', 'voice')
|
||||
audio.play_sound('bachi_swipe', 'sound')
|
||||
|
||||
self.is_finished = self.fade_out.is_finished
|
||||
|
||||
|
||||
Reference in New Issue
Block a user