Beispiel #1
0
        public SoundManager(IAudioContext context, IFactory factory)
        {
            _context = context;
            _factory = factory;

            _context.Create();
            _listener = _factory.Create <IListener>();
        }
Beispiel #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);
        }
Beispiel #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;
        }
Beispiel #4
0
 public static void InitializeForTest()
 {
     instance = new FakeAudioContext();
 }
Beispiel #5
0
 protected AudioService()
 {
     ctx    = AudioContext.Instance;
     config = ctx.Config;
 }