Example #1
0
        public AudioPlayerEngine()
        {
            _soundSystem = new SoundSystem();
            _soundSystem.Init(32, InitFlags.Normal, (IntPtr)null);
            _callback = ChannelEndCallback;

            _soundSystem.SetStreamBufferSize(64 * 1024, TimeUnit.RawBytes);

            EqualizerEngine = new EqualizerEngine(_soundSystem);

            CurrentTimeChanged = Observable.Interval(TimeSpan.FromMilliseconds(1000))
                                 .Select(x => CurrentTime)
                                 .DistinctUntilChanged(x => x.TotalSeconds);

            PlaybackStateChanged = Observable.Interval(TimeSpan.FromMilliseconds(300))
                                   .Select(x => PlaybackState)
                                   .DistinctUntilChanged(x => x);

            TotalTimeChanged = Observable.Interval(TimeSpan.FromMilliseconds(1000))
                               .Select(x => TotalTime)
                               .DistinctUntilChanged(x => x.TotalSeconds);
        }
Example #2
0
        public AudioPlayerEngine()
        {
            _soundSystem = new SoundSystem();
            _soundSystem.Init(32, InitFlags.Normal, (IntPtr) null);
            _callback = ChannelEndCallback;

            _soundSystem.SetStreamBufferSize(64 * 1024, TimeUnit.RawBytes);

            EqualizerEngine = new EqualizerEngine(_soundSystem);

            CurrentTimeChanged = Observable.Interval(TimeSpan.FromMilliseconds(1000))
                                           .Select(x => CurrentTime)
                                           .DistinctUntilChanged(x => x.TotalSeconds);

            PlaybackStateChanged = Observable.Interval(TimeSpan.FromMilliseconds(300))
                                             .Select(x => PlaybackState)
                                             .DistinctUntilChanged(x => x);

            TotalTimeChanged = Observable.Interval(TimeSpan.FromMilliseconds(1000))
                                         .Select(x => TotalTime)
                                         .DistinctUntilChanged(x => x.TotalSeconds);
        }
Example #3
0
        public void Dispose()
        {
            Stop();

            if (EqualizerEngine != null)
            {
                EqualizerEngine.Dispose();
                EqualizerEngine = null;
            }
            if (_channel != null)
            {
                _soundFile.Dispose();
                _soundFile = null;
                _channel.Dispose();
                _channel = null;
            }

            if (_soundSystem != null)
            {
                _soundSystem.Dispose();
                _soundSystem = null;
            }
        }