From 89cd374d9e99c695759dccfc5c67d6455c392ca5 Mon Sep 17 00:00:00 2001 From: hut Date: Thu, 25 Apr 2024 04:15:57 +0200 Subject: [PATCH] add zoom sound effect when zooming map --- README.md | 1 + assets/sounds/zoom.ogg | Bin 0 -> 7381 bytes src/audio.rs | 34 +++++++++++++++++++++++++++++++++- src/camera.rs | 5 ++++- 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 assets/sounds/zoom.ogg diff --git a/README.md b/README.md index 8b10214..fc54ebc 100644 --- a/README.md +++ b/README.md @@ -294,6 +294,7 @@ python -m http.server -d wasm - https://pixabay.com/sound-effects/box-crash-106687 - https://pixabay.com/sound-effects/electric-fan-motor-blades-removed-13169 - https://pixabay.com/sound-effects/whoosh-blow-flutter-shortwav-14678/ + - https://pixabay.com/sound-effects/dslr-camera-sounds-26117/ - Music: [Cinematic Cello](https://pixabay.com/music/build-up-scenes-cinematic-cello-115667) by [Aleksey Chistilin](https://pixabay.com/users/lexin_music-28841948/), [Pixabay Content License](https://pixabay.com/service/license-summary) - Star chart based on the [HYG Stellar database](https://github.com/astronexus/HYG-Database) - Font Yupiter-Regular.ttf is placed under the SIL OPEN FONT LICENSE Version 1.1 and is based on: diff --git a/assets/sounds/zoom.ogg b/assets/sounds/zoom.ogg new file mode 100644 index 0000000000000000000000000000000000000000..35b98adc80e0f9df8fc3aa0272c3aec0f5964318 GIT binary patch literal 7381 zcmc(Dd0bQ1y66sL2!ja(2pBvGCYXev1fylLg%BW#fDj-A1P_KW3@U>>(bIbv0)`Md zA%qwxP=+K7f=3W>s67vdFrz{c5w#a(l2$utPutsb?ywSU-+T9u_j~`n^;>)Gwe~lx z{f+C}`$$$+EMx+GXt>yuhYi#B_d-2kyI>_J3kAX=!vmAi6vGXIQk!7LdoS#Wf%5le zpfo^~r6d&X^*PyD=W& zy9gm-|FHw(n6&Vl=@Q0d`6F38WFSyu6QT>*UYjjNU6_QKg4Z}OTgPS16j%|#tj=#! zURX!lhT0X94S40~a7jTo2F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FA&uG3jB~7 zk}jI6P@=EimhGXXYS?XRd^KiXty*VO;6MEG!#lAaPw`sg&Ttwq{r5tS1ax1eITy{q zpyd%%%gc6dhu3c3d%+sU6La_p$~24IKqi(oBJ^80msGN}Qgy%Qw)(crl>vXh^ole+ zxLlv%{+QJ%$6P6Nr>|zG&)lJB&6E1HBF7TAd_ke@ed_LyO^=S=OO?2^qIo*xomv8Yx#b1 zc5F(?A5Ks1JyJVbpJ&+?qX-DWEk}NNB%DM^%{n$Sm$v7C)Z~!-EJjv>rR~?Qu`Um1 zGMKScRP2ejCO0ghm3>LZawyP{+2(K=JqJl>N-%{L%1W+ALswdY`k-P#M@5az31j7>d-Bh{8wdvuQb<{1R-4Mf2LP{>&t@{kXQbP zNqoqSaVt^o;K9_Ak~*6ptL{0-uErF`HL2&Ml1H$6oU&8t;#H-5+`D_nTQ|42jRV8nfy@w3+myJOkj$ec8O4{S zmv@05SYZta=v3!--5y_r2k&2B!axi1zn6c>KfGx9W;ztITwM`$-GNx15j)G6V!2)N z&dMnY<@Sx9=spsQ(); app.add_event::(); + app.insert_resource(ZoomTimer( + Timer::from_seconds(0.09, TimerMode::Repeating))); } } +#[derive(Resource)] pub struct ZoomTimer(Timer); + pub enum Sfx { IncomingChatMessage, Click, Switch, Woosh, + Zoom, Ping, Connect, EnterVehicle, @@ -65,6 +72,7 @@ pub enum Sfx { #[derive(Resource)] pub struct SoundClick(Handle); #[derive(Resource)] pub struct SoundSwitch(Handle); #[derive(Resource)] pub struct SoundWoosh(Handle); +#[derive(Resource)] pub struct SoundZoom(Handle); #[derive(Resource)] pub struct SoundIncomingMessage(Handle); #[derive(Resource)] pub struct SoundPing(Handle); #[derive(Resource)] pub struct SoundConnect(Handle); @@ -139,6 +147,7 @@ pub fn setup( commands.insert_resource(SoundClick(asset_server.load(ASSET_CLICK))); commands.insert_resource(SoundSwitch(asset_server.load(ASSET_SWITCH))); commands.insert_resource(SoundWoosh(asset_server.load(ASSET_WOOSH))); + commands.insert_resource(SoundZoom(asset_server.load(ASSET_ZOOM))); commands.insert_resource(SoundIncomingMessage(asset_server.load(ASSET_INCOMING_MESSAGE))); commands.insert_resource(SoundPing(asset_server.load(ASSET_PING))); commands.insert_resource(SoundConnect(asset_server.load(ASSET_CONNECT))); @@ -172,6 +181,7 @@ pub fn play_sfx( sound_click: Res, sound_switch: Res, sound_woosh: Res, + sound_zoom: Res, sound_incoming_message: Res, sound_ping: Res, sound_connect: Res, @@ -192,6 +202,7 @@ pub fn play_sfx( Sfx::Switch => sound_switch.0.clone(), Sfx::Click => sound_click.0.clone(), Sfx::Woosh => sound_woosh.0.clone(), + Sfx::Zoom => sound_zoom.0.clone(), Sfx::IncomingChatMessage => sound_incoming_message.0.clone(), Sfx::Ping => sound_ping.0.clone(), Sfx::Connect => sound_connect.0.clone(), @@ -209,6 +220,8 @@ pub fn str2sfx(sfx_label: &str) -> Sfx { return match sfx_label { "switch" => Sfx::Switch, "click" => Sfx::Click, + "woosh" => Sfx::Woosh, + "zoom" => Sfx::Zoom, "chat" => Sfx::IncomingChatMessage, "ping" => Sfx::Ping, "connect" => Sfx::Connect, @@ -235,3 +248,22 @@ pub fn update_music( } } } + +pub fn play_zoom_sfx( + time: Res