Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed: If you try to play music and there are no tracks or no playable notes, the app starts playing music and then immediately stops. #27

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Fixed: There was an input bug where the play/start key (spacebar) was sometimes unresponsive for the first few presses. This is because audio was still decaying from a previous play, meaning that technically the previous play was still ongoing.
- Fixed: When a new file is created or when a new save file loaded, the app didn't reset correctly.
- Fixed: If you try to play music and there are no tracks or no playable notes, the app starts playing music and then immediately stops.

## 0.2.1

Expand Down
10 changes: 9 additions & 1 deletion io/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,15 @@ impl IO {
// Get the focused panel.
let panel = self.get_panel(&state.panels[state.focus.get()]);
// Play music.
if panel.allow_play_music() && input.happened(&InputEvent::PlayStop) {
if input.happened(&InputEvent::PlayStop)
&& panel.allow_play_music()
&& !state.music.midi_tracks.is_empty()
&& state
.music
.get_playable_tracks()
.iter()
.any(|t| !t.get_playback_notes(state.time.playback).is_empty())
{
conn.set_music(state);
}
// We're not done yet.
Expand Down
Loading