Esempio n. 1
0
        public SoundManager(IAudioContext context, IFactory factory)
        {
            _context = context;
            _factory = factory;

            _context.Create();
            _listener = _factory.Create <IListener>();
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes the audio context with the specified configuration.
        /// </summary>
        /// <param name="config">Config.</param>
        public static void Initialize(AudioConfig config)
        {
            if (instance != null)
            {
                throw new InvalidOperationException("Only one audio context can be instantiated.");
            }

            instance = new AudioContext(config);
        }
Esempio n. 3
0
        private bool disposedValue = false; // To detect redundant calls

        private void dispose(bool disposing)
        {
            if (disposedValue)
            {
                return;
            }
            if (disposing)
            {
                // Dispose managed state (managed objects).
            }

            ctx?.Dispose();
            disposedValue = true;
            instance      = null;
        }
Esempio n. 4
0
 public static void InitializeForTest()
 {
     instance = new FakeAudioContext();
 }
Esempio n. 5
0
 protected AudioService()
 {
     ctx    = AudioContext.Instance;
     config = ctx.Config;
 }