Ejemplo n.º 1
0
 public void Stop()
 {
     SoundOutManager.Stop();
     _panSource = null;
     _source    = null;
     RaiseUpdated();
 }
Ejemplo n.º 2
0
 protected virtual void Dispose(bool disposing)
 {
     if (SoundOutManager.IsCreated)
     {
         SoundOutManager.Destroy();
     }
 }
Ejemplo n.º 3
0
        public bool OpenFile(string filename, Func <IWaveSource, IWaveSource> oninitcallback)
        {
            if (String.IsNullOrWhiteSpace(filename))
            {
                throw new ArgumentException("filename");
            }

            try
            {
                var source = CodecFactory.Instance.GetCodec(filename);
                source = new LoopStream(source);
                (source as LoopStream).EnableLoop = false;

                if (source.WaveFormat.Channels == 1)
                {
                    source = new MonoToStereoSource(source).ToWaveSource(16);
                }
                _panSource = new PanSource(source)
                {
                    Pan = this.Pan
                };
                var _notification = new SimpleNotificationSource(_panSource);
                _notification.DataRead += OnNotification;

                source = _notification.ToWaveSource(16);
                //source = new BufferSource(source, source.WaveFormat.BytesPerSecond * 2);

                _source = source;

                if (oninitcallback != null)
                {
                    SoundOutManager.Initialize(oninitcallback(source));
                }
                else
                {
                    SoundOutManager.Initialize(source);
                }
            }
            catch (Exception)
            {
                return(false);
            }
            RaiseUpdated();
            return(true);
        }
Ejemplo n.º 4
0
 public void Pause()
 {
     SoundOutManager.Pause();
 }
Ejemplo n.º 5
0
 public void Play()
 {
     SoundOutManager.Play();
 }
Ejemplo n.º 6
0
 public void SetupAudioPlayer(SoundOutType soundOutType)
 {
     SoundOutManager.CreateSoundOut(soundOutType);
 }