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

It is very hard to stop sound #198

Open
WellHiIGuess opened this issue Jul 10, 2024 · 4 comments
Open

It is very hard to stop sound #198

WellHiIGuess opened this issue Jul 10, 2024 · 4 comments

Comments

@WellHiIGuess
Copy link

WellHiIGuess commented Jul 10, 2024

Currently the play function and stop function in Sound look like this:

play(&self)
stop(&mut self)

This makes it extremely hard to simply play and stop audio. Please if anyone know a way to work around it I have been bashing my skull against a wall for DAYS trying to simply play audio because I switched to the newest version of Raylib. My code(which doesn't work) for it rn looks like this:

if (game.wake_up_sequence.cutscene_state.clone() as i32) == 1 && !alarm_sound.unwrap().is_playing() {
    alarm_sound.as_mut().unwrap().play();
} else if (game.wake_up_sequence.cutscene_state.clone() as i32) == 3 {
    alarm_sound.unwrap().stop();
}
@WellHiIGuess
Copy link
Author

Also cloning alarm_sound does not work

@IoIxD
Copy link
Contributor

IoIxD commented Oct 29, 2024

Late response (in the future you may get a faster one on raylib-rs/raylib-rs) but if you're still willing to work this out for some reason, what did alarm_sound look like?

@WellHiIGuess
Copy link
Author

Thank you for the response. To be honest I didn't expect one. The project I'm working on has changed a lot since I made this issue. But in this context I think the definition would look like this:

let alarm_sound = a.new_sound("src/sounds/alarm.wav").unwrap();

@IoIxD
Copy link
Contributor

IoIxD commented Oct 31, 2024

Can you attach an MRE?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants