From a9ec042127929fd445ffb93e545cdc2970ab04d2 Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 4 Jan 2022 11:22:14 -0800 Subject: [PATCH] decent pop sound when playing message --- nirvana-ios.xcodeproj/project.pbxproj | 4 ++++ .../InnerCircle/InnerCircleViewModel.swift | 22 +++++++++++------- nirvana-ios/sounds/pop.mp3 | Bin 0 -> 1992 bytes 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 nirvana-ios/sounds/pop.mp3 diff --git a/nirvana-ios.xcodeproj/project.pbxproj b/nirvana-ios.xcodeproj/project.pbxproj index 1e6ac67..00b2160 100644 --- a/nirvana-ios.xcodeproj/project.pbxproj +++ b/nirvana-ios.xcodeproj/project.pbxproj @@ -45,6 +45,7 @@ 892179E62765FECD001E6C60 /* FooterControlsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */; }; 89288ECB27675B9F00E962C4 /* OnboardingTemplateView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */; }; 894E41D92784BB8000A68728 /* woosh.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 894E41D82784BB8000A68728 /* woosh.mp3 */; }; + 894E41DB2784D4BC00A68728 /* pop.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 894E41DA2784D4BC00A68728 /* pop.mp3 */; }; 894E80BE276ED7A700624B72 /* avatars.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80BD276ED7A700624B72 /* avatars.swift */; }; 894E80C1276EFD0500624B72 /* AudioPlayerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80C0276EFD0400624B72 /* AudioPlayerView.swift */; }; 894E80C327702E5900624B72 /* AddBasicInfoViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 894E80C227702E5800624B72 /* AddBasicInfoViewModel.swift */; }; @@ -137,6 +138,7 @@ 892179E52765FECD001E6C60 /* FooterControlsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterControlsViewModel.swift; sourceTree = ""; }; 89288ECA27675B9F00E962C4 /* OnboardingTemplateView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingTemplateView.swift; sourceTree = ""; }; 894E41D82784BB8000A68728 /* woosh.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = woosh.mp3; sourceTree = ""; }; + 894E41DA2784D4BC00A68728 /* pop.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = pop.mp3; sourceTree = ""; }; 894E80BD276ED7A700624B72 /* avatars.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = avatars.swift; sourceTree = ""; }; 894E80C0276EFD0400624B72 /* AudioPlayerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioPlayerView.swift; sourceTree = ""; }; 894E80C227702E5800624B72 /* AddBasicInfoViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddBasicInfoViewModel.swift; sourceTree = ""; }; @@ -212,6 +214,7 @@ isa = PBXGroup; children = ( 894E41D82784BB8000A68728 /* woosh.mp3 */, + 894E41DA2784D4BC00A68728 /* pop.mp3 */, 8909199B277EFDF30025F4BB /* joinSound.mp3 */, 89091998277EFDCC0025F4BB /* leaveSound.mp3 */, ); @@ -627,6 +630,7 @@ 89A107E927753AB600B971FD /* GoogleService-Info.plist in Resources */, 89091999277EFDCC0025F4BB /* leaveSound.mp3 in Resources */, 891A15E827653A7100B26659 /* Preview Assets.xcassets in Resources */, + 894E41DB2784D4BC00A68728 /* pop.mp3 in Resources */, 8909199C277EFDF30025F4BB /* joinSound.mp3 in Resources */, 891A15E527653A7100B26659 /* Assets.xcassets in Resources */, 894E41D92784BB8000A68728 /* woosh.mp3 in Resources */, diff --git a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift index a79964e..90e47bc 100644 --- a/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift +++ b/nirvana-ios/Views/InnerCircle/InnerCircleViewModel.swift @@ -261,19 +261,21 @@ extension InnerCircleViewModel { extension InnerCircleViewModel { func playWoosh() { if let wooshFilePath = Bundle.main.url(forResource: "woosh", withExtension: "mp3") { - self.stopPlayingAnyAudio() - - print(wooshFilePath) - self.avplayer = AVPlayer(url: wooshFilePath) avplayer?.play() - -// self.queuePlayer = AVQueuePlayer(playerItem: AVPlayerItem(url: wooshFilePath)) -// self.queuePlayer.automaticallyWaitsToMinimizeStalling = false -// self.queuePlayer.play() } else { - print("didn't get the ath") + print("didn't get the woosh sound") + } + } + + func playPop() { + if let popFilePath = Bundle.main.url(forResource: "pop", withExtension: "mp3") { + self.avplayer = AVPlayer(url: popFilePath) + avplayer?.play() + } + else { + print("didn't get the pop sound") } } @@ -309,6 +311,8 @@ extension InnerCircleViewModel { return } + self.playPop() + // start playing if there are messages to listen to print("have \(AVPlayerItems.count) messages to play") diff --git a/nirvana-ios/sounds/pop.mp3 b/nirvana-ios/sounds/pop.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..28a62449d56d8122521f016b9cdb8e2d445a3cb0 GIT binary patch literal 1992 zcmezWdrAre0T7Xymkw0I55(LI4D2Tu_+dZ}1}tG99R_+~U^5IHf`Lmg@DK(*z`%bP z0NQ2aLa#IhddLK6iQ)&so^jAuaZxXog*A0{zW>Hoh)QW*F@Ffe2SeZaxM zz^lN(zz9VDfLtKcq=A8fg|X4$K!An}9~)4Nf#0cWd*7?*`)B_7EPs~%K!l4`dV0tz zqeq3ujrL}m2WM%R{4rM5v~&yedpK{mYseyrI=FFUrUnec+-mQgdlms*YtjrPHeB|q&3!1|dGu*sOdm_h z{q2QcW|Tx_zZIN*DSg`O`#t+}Hfg?ps=T=>FW9LyNYaD6+5>lHzUL z`pIME!dL76ZMg1r$GULJ87)J{htD>*d|No!fPqm12CI)7U-G8?&@Qi5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