From 65c001d8cb33dc1186a8bc30d64b6cd23a673981 Mon Sep 17 00:00:00 2001 From: Kenneth Pouncey Date: Sun, 26 Jul 2015 12:46:38 +0200 Subject: [PATCH] Clean up iOS and Mac Effects. * Use MonoGame for processing effects. This will allow the user to play multiple instances of Effects (Repeated Sounds see issue https://github.com/mono/CocosSharp/issues/273). Warning: This will not only support those sound format allowed by MonoGame's Effects implementation which interfaces to the OpenAL library. * Add functionality such as PauseAllEffects, ResumeEffect and ResumeAllEffects. * Update CocosDehension audio interface. * Add new AudioSample to CocosSharp samples. This will only work with current source base and not with current release. View link here: https://github.com/mono/cocos-sharp-samples/tree/master/AudioSample * Update PCL CocosSharpAPI to include this new functionality interface. See issues : https://github.com/mono/CocosSharp/issues/157 , https://github.com/mono/CocosSharp/issues/273 --- PCL/CocosSharpPCLShared/CocosSharpAPI.cs | 45 ++++++----- src/CocosSharp.MacOS.csproj | 2 +- src/CocosSharp.iOS.csproj | 2 +- src/denshion/CCEffectPlayer.AVFoundation.cs | 1 + src/denshion/CCEffectPlayer.MonoGame.cs | 75 +++++++++++++++---- src/denshion/CCSimpleAudioEngine.cs | 72 +++++++++++++++++- tests/tests/Resources/Resource.Designer.cs | 20 ++--- .../CocosDenshionTest/CocosDenshionTest.cs | 36 ++++----- 8 files changed, 180 insertions(+), 73 deletions(-) diff --git a/PCL/CocosSharpPCLShared/CocosSharpAPI.cs b/PCL/CocosSharpPCLShared/CocosSharpAPI.cs index 4c02b5da1..de8433ec4 100644 --- a/PCL/CocosSharpPCLShared/CocosSharpAPI.cs +++ b/PCL/CocosSharpPCLShared/CocosSharpAPI.cs @@ -7,7 +7,7 @@ public partial class CCEffectPlayer : CocosDenshion.CCEffectPlayerCore, System.I public void Dispose() { } protected virtual void Dispose(bool disposing) { } protected override void DisposeManagedResources() { } - public override void Open(string fileName, int soundId) { } + public override void Open(string filename, int uid) { } public override void Pause() { } public override void Play(bool loop=false) { } public override void Resume() { } @@ -70,6 +70,7 @@ public partial class CCSimpleAudioEngine { public static CocosDenshion.CCSimpleAudioEngine SharedEngine { get { return default(CocosDenshion.CCSimpleAudioEngine); } } public void End() { } public static string FullPath(string path) { return default(string); } + public void PauseAllEffects() { } public void PauseBackgroundMusic() { } public void PauseEffect(int fxid) { } public void PlayBackgroundMusic(string filename, bool loop=false) { } @@ -79,7 +80,9 @@ public partial class CCSimpleAudioEngine { public void PreloadBackgroundMusic(string filename) { } public void PreloadEffect(string filename) { } public void RestoreMediaState() { } + public void ResumeAllEffects() { } public void ResumeBackgroundMusic() { } + public void ResumeEffect(int fxid) { } public void RewindBackgroundMusic() { } public void SaveMediaState() { } public void StopAllEffects() { } @@ -837,12 +840,13 @@ public partial class CCDrawNode : CocosSharp.CCNode { public void DrawCircle(CocosSharp.CCPoint center, float radius, CocosSharp.CCColor4B color) { } public void DrawCircle(CocosSharp.CCPoint center, float radius, int segments, CocosSharp.CCColor4B color) { } public void DrawCubicBezier(CocosSharp.CCPoint origin, CocosSharp.CCPoint control1, CocosSharp.CCPoint control2, CocosSharp.CCPoint destination, int segments, float lineWidth, CocosSharp.CCColor4B color) { } + [System.ObsoleteAttribute("DrawDot is obsolete: Use DrawSolidCircle")] public void DrawDot(CocosSharp.CCPoint pos, float radius, CocosSharp.CCColor4B color) { } public void DrawEllipse(CocosSharp.CCRect rect, float lineWidth, CocosSharp.CCColor4B color) { } public void DrawEllipse(int x, int y, int width, int height, float lineWidth, CocosSharp.CCColor4B color) { } - public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, CocosSharp.CCColor4B color) { } - public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float lineWidth=1f) { } - public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float lineWidth, CocosSharp.CCColor4B color) { } + public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, CocosSharp.CCColor4B color, CocosSharp.CCLineCap lineCap=(CocosSharp.CCLineCap)(0)) { } + public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float lineWidth, CocosSharp.CCColor4B color, CocosSharp.CCLineCap lineCap=(CocosSharp.CCLineCap)(0)) { } + public void DrawLine(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float lineWidth=1f, CocosSharp.CCLineCap lineCap=(CocosSharp.CCLineCap)(0)) { } public void DrawLineList(CocosSharp.CCV3F_C4B[] verts) { } public void DrawPolygon(CocosSharp.CCPoint[] verts, int count, CocosSharp.CCColor4B fillColor, float borderWidth, CocosSharp.CCColor4B borderColor, bool closePolygon=true) { } public void DrawPolygon(CocosSharp.CCPoint[] verts, int count, CocosSharp.CCColor4F fillColor, float borderWidth, CocosSharp.CCColor4F borderColor, bool closePolygon=true) { } @@ -852,7 +856,10 @@ public partial class CCDrawNode : CocosSharp.CCNode { public void DrawRect(CocosSharp.CCRect rect) { } public void DrawRect(CocosSharp.CCRect rect, CocosSharp.CCColor4B fillColor) { } public void DrawRect(CocosSharp.CCRect rect, CocosSharp.CCColor4B fillColor, float borderWidth, CocosSharp.CCColor4B borderColor) { } - public void DrawSegment(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float radius, CocosSharp.CCColor4F color) { } + [System.ObsoleteAttribute("DrawSegment is obsolete: Use DrawLine")] + public void DrawSegment(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float radius, CocosSharp.CCColor4B color, CocosSharp.CCLineCap lineCap=(CocosSharp.CCLineCap)(1)) { } + [System.ObsoleteAttribute("DrawSegment is obsolete: Use DrawLine")] + public void DrawSegment(CocosSharp.CCPoint from, CocosSharp.CCPoint to, float radius, CocosSharp.CCColor4F color, CocosSharp.CCLineCap lineCap=(CocosSharp.CCLineCap)(1)) { } public void DrawSolidArc(CocosSharp.CCPoint pos, float radius, float startAngle, float sweepAngle, CocosSharp.CCColor4B color) { } public void DrawSolidCircle(CocosSharp.CCPoint pos, float radius, CocosSharp.CCColor4B color) { } public void DrawString(int x, int y, string format, params System.Object[] objects) { } @@ -1417,6 +1424,8 @@ public partial class CCFont { public virtual void SetCurrentGlyphCollection(CocosSharp.GlyphCollection glyphs, string customGlyphs) { } } public partial class CCFontFNT : CocosSharp.CCFont { + public CCFontFNT(string configInfo, CocosSharp.CCTexture2D atlasTexture, System.Nullable imageOffset=null) { } + public CCFontFNT(string configInfo, System.IO.Stream atlasStream, System.Nullable imageOffset=null) { } public CCFontFNT(string fntFilePath, System.Nullable imageOffset=null) { } public bool IsFontConfigValid { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { return default(bool); } } public override System.Int32[] HorizontalKerningForText(string text, out int numLetters) { numLetters = default(int); return default(System.Int32[]); } @@ -1835,6 +1844,7 @@ public partial class CCLabel : CocosSharp.CCNode, CocosSharp.ICCTextContainer { protected CocosSharp.CCLabelLineBreak lineBreak; protected CocosSharp.CCVerticalTextAlignment vertAlignment; public CCLabel() { } + public CCLabel(CocosSharp.CCFontFNT fntFontConfig, string str, CocosSharp.CCSize dimensions, CocosSharp.CCLabelFormat labelFormat) { } public CCLabel(string str, string fntFile) { } public CCLabel(string str, string fntFile, CocosSharp.CCSize dimensions) { } public CCLabel(string str, string fntFile, CocosSharp.CCSize dimensions, CocosSharp.CCLabelFormat labelFormat) { } @@ -2088,6 +2098,11 @@ public partial class CCLens3DState : CocosSharp.CCGrid3DActionState { public float Radius { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { return default(float); } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public override void Update(float time) { } } + public enum CCLineCap { + Butt = 0, + Round = 1, + Square = 2, + } public partial class CCLiquid : CocosSharp.CCGrid3DAction { public CCLiquid(float duration, CocosSharp.CCGridSize gridSize, int waves=0, float amplitude=0f) : base (default(float)) { } public int Waves { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { return default(int); } } @@ -2210,24 +2225,6 @@ public abstract partial class CCMenuItemLabelBase : CocosSharp.CCMenuItem { public override void Activate() { } protected void LabelWillChange(CocosSharp.CCNode oldValue, CocosSharp.CCNode newValue) { } } - [System.ObsoleteAttribute("Use CCMenuItemLabel instead.")] - public partial class CCMenuItemLabelBMFont : CocosSharp.CCMenuItemLabelBase { - [System.ObsoleteAttribute("Use CCMenuItemLabel instead.")] - public CCMenuItemLabelBMFont(CocosSharp.CCLabelBMFont labelBMFont, System.Action target=null) : base (default(System.Action)) { } - public override bool Enabled { get { return default(bool); } set { } } - public CocosSharp.CCLabelBMFont LabelBMFont { get { return default(CocosSharp.CCLabelBMFont); } set { } } - public override CocosSharp.CCScene Scene { get { return default(CocosSharp.CCScene); } } - } - [System.ObsoleteAttribute("Use CCMenuItemLabel instead.")] - public partial class CCMenuItemLabelTTF : CocosSharp.CCMenuItemLabelBase { - [System.ObsoleteAttribute("Use CCMenuItemLabel instead.")] - public CCMenuItemLabelTTF(CocosSharp.CCLabelTtf labelTTF, System.Action target=null) : base (default(System.Action)) { } - [System.ObsoleteAttribute("Use CCMenuItemLabel instead.")] - public CCMenuItemLabelTTF(System.Action target=null) : base (default(System.Action)) { } - public override bool Enabled { get { return default(bool); } set { } } - public CocosSharp.CCLabelTtf LabelTTF { get { return default(CocosSharp.CCLabelTtf); } set { } } - public override CocosSharp.CCScene Scene { get { return default(CocosSharp.CCScene); } } - } public partial class CCMenuItemToggle : CocosSharp.CCMenuItem { public CCMenuItemToggle(params CocosSharp.CCMenuItem[] items) { } public CCMenuItemToggle(System.Action target, params CocosSharp.CCMenuItem[] items) { } @@ -3679,7 +3676,7 @@ public enum CCTextAlignment { Left = 0, Right = 2, } - public partial class CCTextFieldTTF : CocosSharp.CCLabelTtf { + public partial class CCTextFieldTTF : CocosSharp.CCLabel { public CCTextFieldTTF(string text, string fontName, float fontSize) { } public CCTextFieldTTF(string text, string fontName, float fontSize, CocosSharp.CCSize dimensions, CocosSharp.CCTextAlignment hAlignment) { } public CCTextFieldTTF(string text, string fontName, float fontSize, CocosSharp.CCSize dimensions, CocosSharp.CCTextAlignment hAlignment, CocosSharp.CCVerticalTextAlignment vAlignment) { } diff --git a/src/CocosSharp.MacOS.csproj b/src/CocosSharp.MacOS.csproj index 719eb84e7..ae85b0eaf 100644 --- a/src/CocosSharp.MacOS.csproj +++ b/src/CocosSharp.MacOS.csproj @@ -391,7 +391,6 @@ - @@ -418,6 +417,7 @@ + diff --git a/src/CocosSharp.iOS.csproj b/src/CocosSharp.iOS.csproj index d91b376d8..3b40a2764 100644 --- a/src/CocosSharp.iOS.csproj +++ b/src/CocosSharp.iOS.csproj @@ -376,7 +376,6 @@ - @@ -397,6 +396,7 @@ + diff --git a/src/denshion/CCEffectPlayer.AVFoundation.cs b/src/denshion/CCEffectPlayer.AVFoundation.cs index 9bef65dac..5bb219a10 100644 --- a/src/denshion/CCEffectPlayer.AVFoundation.cs +++ b/src/denshion/CCEffectPlayer.AVFoundation.cs @@ -60,6 +60,7 @@ public override void Play(bool loop=false) if (soundEffect !=null) { soundEffect.NumberOfLoops = loop ? -1 : 0; + soundEffect.Play(); } } diff --git a/src/denshion/CCEffectPlayer.MonoGame.cs b/src/denshion/CCEffectPlayer.MonoGame.cs index 0531f7bca..3f3eddb7d 100644 --- a/src/denshion/CCEffectPlayer.MonoGame.cs +++ b/src/denshion/CCEffectPlayer.MonoGame.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using Microsoft.Xna.Framework.Audio; using CocosSharp; @@ -9,6 +10,8 @@ public partial class CCEffectPlayer SoundEffect effect; SoundEffectInstance sfxInstance; + List sfxInstances = new List(); + #region Properties @@ -44,6 +47,7 @@ protected override void DisposeManagedResources() if (effect != null) effect.Dispose(); + if (sfxInstance != null) sfxInstance.Dispose(); } @@ -59,13 +63,14 @@ public override void Play(bool loop=false) { return; } - if (loop) - { +// if (loop) +// { // If looping, then get an instance of this sound effect so that it can be // stopped. sfxInstance = effect.CreateInstance(); - sfxInstance.IsLooped = true; - } + sfxInstance.IsLooped = loop; + sfxInstances.Add(sfxInstance); +// } if (sfxInstance != null) { sfxInstance.Play(); @@ -78,26 +83,64 @@ public override void Play(bool loop=false) public override void Pause() { - if (sfxInstance != null && !sfxInstance.IsDisposed && sfxInstance.State == SoundState.Playing) - { - sfxInstance.Pause(); - } + if (sfxInstances.Count > 0) + { + for (var x = 0; x < sfxInstances.Count; x++) + { + var instance = sfxInstances[x]; + + if (instance.IsDisposed) + sfxInstances.RemoveAt(x); + + if (instance.State == SoundState.Playing) + instance.Pause(); + } + } } public override void Resume() { - if (sfxInstance != null && !sfxInstance.IsDisposed && sfxInstance.State == SoundState.Paused) - { - sfxInstance.Play(); - } +// if (sfxInstance != null && !sfxInstance.IsDisposed && sfxInstance.State == SoundState.Paused) +// { +// sfxInstance.Resume(); +// } + + if (sfxInstances.Count > 0) + { + for (var x = 0; x < sfxInstances.Count; x++) + { + var instance = sfxInstances[x]; + + if (instance.IsDisposed) + sfxInstances.RemoveAt(x); + + if (instance.State == SoundState.Paused) + instance.Resume(); + } + } + } public override void Stop() { - if (sfxInstance != null && !sfxInstance.IsDisposed && sfxInstance.State == SoundState.Playing) - { - sfxInstance.Stop(); - } +// if (sfxInstance != null && !sfxInstance.IsDisposed && sfxInstance.State == SoundState.Playing) +// { +// sfxInstance.Stop(); +// } + + if (sfxInstances.Count > 0) + { + for (var x = 0; x < sfxInstances.Count; x++) + { + var instance = sfxInstances[x]; + + if (instance.IsDisposed) + sfxInstances.RemoveAt(x); + + if (instance.State == SoundState.Playing) + instance.Stop(); + } + } } public override void Rewind() diff --git a/src/denshion/CCSimpleAudioEngine.cs b/src/denshion/CCSimpleAudioEngine.cs index 8a808f850..6def5ff5d 100644 --- a/src/denshion/CCSimpleAudioEngine.cs +++ b/src/denshion/CCSimpleAudioEngine.cs @@ -157,7 +157,7 @@ public void PauseEffect(int fxid) } } - public void StopAllEffects() + public void PauseAllEffects() { List l = new List(); @@ -166,17 +166,81 @@ public void StopAllEffects() try { l.AddRange(list.Values); - list.Clear(); } catch (Exception ex) { - CCLog.Log("Unexpected exception while stopping all effects."); + CCLog.Log("Unexpected exception while pausing all effects."); CCLog.Log(ex.ToString()); } } foreach (CCEffectPlayer p in l) { - p.Stop(); + PauseEffect(p.SoundID); + } + } + + public void ResumeEffect(int fxid) + { + try + { + if (list.ContainsKey(fxid)) + { + list[fxid].Resume(); + } + } + catch (Exception ex) + { + CCLog.Log("Unexpected exception while resuming a SoundEffect: {0}", fxid); + CCLog.Log(ex.ToString()); + } + } + + public void ResumeAllEffects() + { + + List l = new List(); + + lock (list) + { + try + { + l.AddRange(list.Values); + } + catch (Exception ex) + { + CCLog.Log("Unexpected exception while resuming all effects."); + CCLog.Log(ex.ToString()); + } + } + foreach (CCEffectPlayer p in l) + { + p.Resume(); + } + + } + + public void StopAllEffects() + { + List l = new List(); + + lock (list) + { + try + { + l.AddRange(list.Values); + } + catch (Exception ex) + { + CCLog.Log("Unexpected exception while stopping all effects."); + CCLog.Log(ex.ToString()); + } + + foreach (CCEffectPlayer p in l) + { + StopEffect(p.SoundID); + } + + list.Clear(); } } diff --git a/tests/tests/Resources/Resource.Designer.cs b/tests/tests/Resources/Resource.Designer.cs index 091ed3508..5b94f747c 100644 --- a/tests/tests/Resources/Resource.Designer.cs +++ b/tests/tests/Resources/Resource.Designer.cs @@ -1,15 +1,15 @@ #pragma warning disable 1591 -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.0 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Mono Runtime Version: 4.0.30319.17020 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +// ------------------------------------------------------------------------------ -[assembly: global::Android.Runtime.ResourceDesignerAttribute("tests.Resource", IsApplication=true)] +[assembly: Android.Runtime.ResourceDesignerAttribute("tests.Resource", IsApplication=true)] namespace tests { diff --git a/tests/tests/classes/tests/CocosDenshionTest/CocosDenshionTest.cs b/tests/tests/classes/tests/CocosDenshionTest/CocosDenshionTest.cs index 703a90fa1..c05647deb 100644 --- a/tests/tests/classes/tests/CocosDenshionTest/CocosDenshionTest.cs +++ b/tests/tests/classes/tests/CocosDenshionTest/CocosDenshionTest.cs @@ -14,7 +14,6 @@ public class CocosDenshionTest : CCLayer static readonly string EFFECT_FILE = "Sounds/effect1"; static readonly string MUSIC_FILE = "Sounds/background"; - CCPoint beginPos; int soundId; @@ -237,21 +236,24 @@ public override void OnEnter() void AddButtons() { + + var audio = CCSimpleAudioEngine.SharedEngine; + var lblMusic = new CCLabel("Control Music", "fonts/arial", 24, CCLabelFormat.SpriteFont); AddChildAt(lblMusic, 0.25f, 0.9f); var btnPlay = new Button("play"); btnPlay.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.BackgroundMusicVolume = sliderMusicVolume.Value; - CCSimpleAudioEngine.SharedEngine.PlayBackgroundMusic(MUSIC_FILE, true); + audio.BackgroundMusicVolume = sliderMusicVolume.Value; + audio.PlayBackgroundMusic(MUSIC_FILE, true); }; AddChildAt(btnPlay, 0.1f, 0.75f); var btnStop = new Button("stop"); btnStop.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.StopBackgroundMusic(); + audio.StopBackgroundMusic(); }; AddChildAt(btnStop, 0.25f, 0.75f); @@ -259,7 +261,7 @@ void AddButtons() var btnRewindMusic = new Button("rewind"); btnRewindMusic.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.RewindBackgroundMusic(); + audio.RewindBackgroundMusic(); }; AddChildAt(btnRewindMusic, 0.4f, 0.75f); @@ -267,21 +269,21 @@ void AddButtons() var btnPause = new Button("pause"); btnPause.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.PauseBackgroundMusic(); + audio.PauseBackgroundMusic(); }; AddChildAt(btnPause, 0.1f, 0.65f); var btnResumeMusic = new Button("resume"); btnResumeMusic.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.ResumeBackgroundMusic(); + audio.ResumeBackgroundMusic(); }; AddChildAt(btnResumeMusic, 0.25f, 0.65f); var btnIsPlayingMusic = new Button("is playing"); btnIsPlayingMusic.Triggered += (sender, e) => { - if (CCSimpleAudioEngine.SharedEngine.BackgroundMusicPlaying) + if (audio.BackgroundMusicPlaying) CCLog.Log("background music is playing"); else CCLog.Log("background music is not playing"); @@ -297,7 +299,7 @@ void AddButtons() var pitch = sliderPitch.Value; var pan = sliderPan.Value; var gain = sliderGain.Value; - soundId = CCSimpleAudioEngine.SharedEngine.PlayEffect(EFFECT_FILE, false);//, pitch, pan, gain); + soundId = audio.PlayEffect(EFFECT_FILE, false);//, pitch, pan, gain); }; AddChildAt(btnPlayEffect, 0.6f, 0.8f); @@ -307,56 +309,56 @@ void AddButtons() var pitch = sliderPitch.Value; var pan = sliderPan.Value; var gain = sliderGain.Value; - soundId = CCSimpleAudioEngine.SharedEngine.PlayEffect(EFFECT_FILE, true);//, pitch, pan, gain); + soundId = audio.PlayEffect(EFFECT_FILE, true);//, pitch, pan, gain); }; AddChildAt(btnPlayEffectInLoop, 0.75f, 0.8f); var btnStopEffect = new Button("stop"); btnStopEffect.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.StopEffect(soundId); + audio.StopEffect(soundId); }; AddChildAt(btnStopEffect, 0.9f, 0.8f); var btnUnloadEffect = new Button("unload"); btnUnloadEffect.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.UnloadEffect(EFFECT_FILE); + audio.UnloadEffect(EFFECT_FILE); }; AddChildAt(btnUnloadEffect, 0.6f, 0.7f); var btnPauseEffect = new Button("pause"); btnPauseEffect.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.PauseEffect(soundId); + audio.PauseEffect(soundId); }; AddChildAt(btnPauseEffect, 0.75f, 0.7f); var btnResumeEffect = new Button("resume"); btnResumeEffect.Triggered += (sender, e) => { - //CCSimpleAudioEngine.SharedEngine.resumeEffect(_soundId); + audio.ResumeEffect(soundId); }; AddChildAt(btnResumeEffect, 0.9f, 0.7f); var btnPauseAll = new Button("pause all"); btnPauseAll.Triggered += (sender, e) => { - //CCSimpleAudioEngine.SharedEngine.pauseAllEffects(); + audio.PauseAllEffects(); }; AddChildAt(btnPauseAll, 0.6f, 0.6f); var btnResumeAll = new Button("resume all"); btnResumeAll.Triggered += (sender, e) => { - //CCSimpleAudioEngine.SharedEngine.resumeAllEffects(); + audio.ResumeAllEffects(); }; AddChildAt(btnResumeAll, 0.75f, 0.6f); var btnStopAll = new Button("stop all"); btnStopAll.Triggered += (sender, e) => { - CCSimpleAudioEngine.SharedEngine.StopAllEffects(); + audio.StopAllEffects(); }; AddChildAt(btnStopAll, 0.9f, 0.6f); }