예제 #1
0
        /// <summary>
        /// Create a SFX audio player and associate it with the sfxType keyword.
        /// </summary>
        /// <param name="sfxType">A keyword or phrase used to request this player.</param>
        /// <param name="audioFactory">An audio source factory.</param>
        /// <param name="clipProvider">A instance of IAudioClipProvider that determines which clip to play.</param>
        /// <returns>An audio player. Can be used to bypass the AudioManagerSingleton or ignored.</returns>
        public ISfxAudioPlayer CreateSfxAudioPlayer(string sfxType, IAudioFactory audioFactory, IAudioClipProvider clipProvider)
        {
            ISfxAudioPlayer sfxAudioPlayer = new SfxAudioPlayer(sfxType, clipProvider, audioFactory);

            AudioManagerSingleton.Instance.RegisterAudioPlayer(sfxAudioPlayer);
            return(sfxAudioPlayer);
        }
 public void Dispose()
 {
     this.gameObject       = null;
     this.audioFactory     = null;
     this.coroutineHandler = null;
     this.audioSource      = null;
 }
예제 #3
0
 /// <inheritdoc/>
 public bool Equals(IAudioFactory other)
 {
     if (other is AudioFactory)
     {
         return(AudioDevice == ((AudioFactory)other).AudioDevice);
     }
     return(false);
 }
예제 #4
0
        /// <summary>
        /// Register a new factory.
        /// </summary>
        /// <param name="audioDescriptor">A unique keyword (or phrase) to associate with this audio factory.</param>
        /// <param name="audioFactory">The audio factory to use according to the audioDescriptor.</param>
        /// <remarks>ArgumentException is thrown if the audioDescriptor is not unique and the property AllowFactoryReplacement is true.</remarks>
        public void RegisterAudioFactory(string audioDescriptor, IAudioFactory audioFactory)
        {
            if (!AllowFactoryReplacement && audioFactories.ContainsKey(audioDescriptor))
            {
                throw new ArgumentException(String.Format("An IAudioFactory is already registered with the audioDescriptor {0} in AudioFactoryRegistry", audioDescriptor));
            }

            audioFactories[audioDescriptor] = audioFactory;
        }
예제 #5
0
 public PolyphonicAudioSourceOpenTk(
     IAudioFactory factory,
     int voiceCount)
 {
     this.sources_ =
         new FinCircularBuffer <IAudioSource>(
             voiceCount,
             factory.NewAudioSource);
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="audioFactory">Used to return the audio source when finished.</param>
 /// <param name="coroutineHandler">Used to handle any coroutine calls.</param>
 /// <param name="gameObject">A UnityEngine.GameObject.</param>
 /// <remarks>If the game object does not contain an AudioSource, one will be added.</remarks>
 public AudioSourceGameObjectAdaptor(IAudioFactory audioFactory, MonoBehaviour coroutineHandler, GameObject gameObject)
 {
     this.audioFactory = audioFactory;
     this.gameObject   = gameObject;
     audioSource       = gameObject.GetComponent <AudioSource>();
     if (audioSource == null)
     {
         audioSource = gameObject.AddComponent <AudioSource>();
     }
     this.coroutineHandler = coroutineHandler;
 }
예제 #7
0
		public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
			IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog, IAudioFactory sound)
		{
			Graphics = graphics;
			Inventory = inventory;
			UI = ui;
			Room = room;
			Outfit = outfit;
			Object = obj;
			Dialog = dialog;
			Sound = sound;
		}
예제 #8
0
 public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
                       IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog,
                       IAudioFactory sound, IFontLoader fontFactory)
 {
     Graphics  = graphics;
     Inventory = inventory;
     UI        = ui;
     Room      = room;
     Outfit    = outfit;
     Object    = obj;
     Dialog    = dialog;
     Sound     = sound;
     Fonts     = fontFactory;
 }
예제 #9
0
        public AGSGameFactory(IGraphicsFactory graphics, IInventoryFactory inventory, IUIFactory ui,
                              IRoomFactory room, IOutfitFactory outfit, IObjectFactory obj, IDialogFactory dialog,
                              IAudioFactory sound, IFontLoader fontFactory, IResourceLoader resources, IShaderFactory shaders,
                              Resolver resolver)
        {
            Graphics  = graphics;
            Inventory = inventory;
            UI        = ui;
            Room      = room;
            Outfit    = outfit;
            Object    = obj;
            Dialog    = dialog;
            Sound     = sound;
            Fonts     = fontFactory;
            Resources = resources;
            TypedParameter gameFactoryParam = new TypedParameter(typeof(IGameFactory), this);

            Masks   = resolver.Container.Resolve <IMaskLoader>(gameFactoryParam);
            Shaders = shaders;
        }
예제 #10
0
 public AGSClassicSpeechCache(IAudioFactory factory)
 {
     _factory     = factory;
     _speechCache = new ConcurrentDictionary <string, IAudioClip>();
 }
예제 #11
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="sfxType">A keyword or phase associated with this audio player.</param>
 /// <param name="clipProvider">The clip provider to use.</param>
 /// <param name="audioFactory">The audio source factory to use each time a clip is played.</param>
 public SfxAudioPlayer(string sfxType, IAudioClipProvider clipProvider, IAudioFactory audioFactory)
 {
     SfxType           = sfxType;
     this.clipProvider = clipProvider;
     this.audioFactory = audioFactory;
 }
예제 #12
0
 public AGSClassicSpeechCache(IAudioFactory factory)
 {
     _factory = factory;
     _speechCache = new ConcurrentDictionary<string, IAudioClip>();
 }
예제 #13
0
 public AudioSourcePooler(AudioSourceGameObjectAdaptor prefab, IAudioFactory factory, MonoBehaviour coroutineHandler, int initialSize = 32, int maxPersistentSize = 1024, bool collectionChecks = false)
     : base(prefab, initialSize, maxPersistentSize, collectionChecks)
 {
     this.factory          = factory;
     this.coroutineHandler = coroutineHandler;
 }
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="audioFactory">Used to return the audio source when finished.</param>
 /// <param name="coroutineHandler">Used to handle any coroutine calls.</param>
 /// <param name="name">The name to give a new GameObject. Default is IAudioWrapper.</param>
 public AudioSourceGameObjectAdaptor(IAudioFactory audioFactory, MonoBehaviour coroutineHandler, string name = "IAudioWrapper")
     : this(audioFactory, coroutineHandler, new GameObject(name))
 {
 }