1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 03:08:11 +00:00

Applications+Userland: Switch to new Audio::Loader API

This commit is contained in:
Julian Offenhäuser 2020-12-01 20:20:46 +01:00 committed by Andreas Kling
parent 1f47b01e3b
commit bad8cd3d8f
5 changed files with 31 additions and 35 deletions

View file

@ -119,15 +119,10 @@ void SoundPlayerWidget::hide_scope(bool hide)
void SoundPlayerWidget::open_file(String path)
{
if (!path.ends_with(".wav")) {
GUI::MessageBox::show(window(), "Selected file is not a \".wav\" file!", "Filetype error", GUI::MessageBox::Type::Error);
return;
}
OwnPtr<Audio::WavLoader> loader = make<Audio::WavLoader>(path);
NonnullRefPtr<Audio::Loader> loader = Audio::Loader::create(path);
if (loader->has_error()) {
GUI::MessageBox::show(window(),
String::formatted("Failed to load WAV file: {} ({})", path, loader->error_string()),
String::formatted("Failed to load audio file: {} ({})", path, loader->error_string()),
"Filetype error", GUI::MessageBox::Type::Error);
return;
}