| 1 | /* |
| 2 | * Copyright 2024 Andrey Kutejko <[email protected]> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, see <http://www.gnu.org/licenses/>. |
| 16 | * |
| 17 | * For more details see the file COPYING. |
| 18 | */ |
| 19 | |
| 20 | use craterust-analyzer cargo gnome-robots 50.0.0 crate/::configrust-analyzer cargo gnome-robots 50.0.0 config/::SOUND_DIRECTORY; |
| 21 | use gtkrust-analyzer cargo gtk4 0.11.1 crate/::{gdkrust-analyzer cargo gdk4 0.11.1 crate/, preluderust-analyzer cargo gtk4 0.11.1 prelude/::*}; |
| 22 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#; |
| 23 | |
| 24 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:)] |
| 25 | pub enum Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound# { |
| 26 | Victoryrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Victory#, |
| 27 | Dierust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Die#, |
| 28 | Teleportrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Teleport#, |
| 29 | Splatrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Splat#, |
| 30 | Yahoorust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Yahoo#, |
| 31 | Badrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Bad#, |
| 32 | } |
| 33 | |
| 34 | pub struct SoundPlayerrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer# { |
| 35 | victoryrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#victory.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#, |
| 36 | dierust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#die.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#, |
| 37 | teleportrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#teleport.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#, |
| 38 | splatrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#splat.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#, |
| 39 | yahoorust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#yahoo.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#, |
| 40 | } |
| 41 | |
| 42 | impl SoundPlayerrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer# { |
| 43 | pub fn newrust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer]new().() -> Selfrust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer] { |
| 44 | let path = Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]new().(SOUND_DIRECTORY); |
| 45 | Selfrust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer] { |
| 46 | victoryrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#victory.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#::for_filenamerust-analyzer cargo gtk4 0.11.1 auto/media_file/impl#[MediaFile]for_filename().(path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("victory.ogg")), |
| 47 | dierust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#die.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#::for_filenamerust-analyzer cargo gtk4 0.11.1 auto/media_file/impl#[MediaFile]for_filename().(path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("die.ogg")), |
| 48 | teleportrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#teleport.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#::for_filenamerust-analyzer cargo gtk4 0.11.1 auto/media_file/impl#[MediaFile]for_filename().(path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("teleport.ogg")), |
| 49 | splatrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#splat.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#::for_filenamerust-analyzer cargo gtk4 0.11.1 auto/media_file/impl#[MediaFile]for_filename().(path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("splat.ogg")), |
| 50 | yahoorust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#yahoo.: gtkrust-analyzer cargo gtk4 0.11.1 crate/::MediaFilerust-analyzer cargo gtk4 0.11.1 auto/media_file/MediaFile#::for_filenamerust-analyzer cargo gtk4 0.11.1 auto/media_file/impl#[MediaFile]for_filename().(path.joinrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[Path]join().("yahoo.ogg")), |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | pub fn beeprust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer]beep().(&self) { |
| 55 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(display) = gdkrust-analyzer cargo gdk4 0.11.1 crate/::Displayrust-analyzer cargo gdk4 0.11.1 auto/display/Display#::defaultrust-analyzer cargo gdk4 0.11.1 auto/display/impl#[Display]default().() { |
| 56 | display.beeprust-analyzer cargo gdk4 0.11.1 auto/display/DisplayExt#beep().(); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | pub fn playrust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer]play().(&self, sound: Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#) { |
| 61 | match sound { |
| 62 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Victoryrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Victory# => self.victoryrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#victory..playrust-analyzer cargo gtk4 0.11.1 auto/media_stream/MediaStreamExt#play().(), |
| 63 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Dierust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Die# => self.dierust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#die..playrust-analyzer cargo gtk4 0.11.1 auto/media_stream/MediaStreamExt#play().(), |
| 64 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Teleportrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Teleport# => self.teleportrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#teleport..playrust-analyzer cargo gtk4 0.11.1 auto/media_stream/MediaStreamExt#play().(), |
| 65 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Splatrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Splat# => self.splatrust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#splat..playrust-analyzer cargo gtk4 0.11.1 auto/media_stream/MediaStreamExt#play().(), |
| 66 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Yahoorust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Yahoo# => self.yahoorust-analyzer cargo gnome-robots 50.0.0 sound_player/SoundPlayer#yahoo..playrust-analyzer cargo gtk4 0.11.1 auto/media_stream/MediaStreamExt#play().(), |
| 67 | Soundrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#::Badrust-analyzer cargo gnome-robots 50.0.0 sound_player/Sound#Bad# => self.beeprust-analyzer cargo gnome-robots 50.0.0 sound_player/impl#[SoundPlayer]beep().(), |
| 68 | } |
| 69 | } |
| 70 | } |