コード例 #1
0
 public void Shutdown()
 {
     buffer.Dispose();
     sourceVoice.FlushSourceBuffers();
     buffer = null;
     sourceVoice.Dispose();
     sourceVoice = null;
     masteringVoice.Dispose();
     masteringVoice = null;
     device.StopEngine();
     device.Dispose();
 }
コード例 #2
0
ファイル: DSound.cs プロジェクト: yplassiard/Three-D-Velocity
 /// <summary>
 /// Gets rid of audio objects.
 /// </summary>
 public static void cleanUp()
 {
     musicMasteringVoice.Dispose();
     musicDevice.Dispose();
     mainMasteringVoice.Dispose();
     mainSoundDevice.Dispose();
 }
コード例 #3
0
 public void Dispose()
 {
     buffer.Dispose();
     srcVoice.Dispose();
     masteringVoice.Dispose();
     device.Dispose();
 }
コード例 #4
0
 public override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (sourceVoice != null)
         {
             sourceVoice.FlushSourceBuffers();
             sourceVoice.Stop();
             sourceVoice.Dispose();
             sourceVoice = null;
         }
         if (xAudioBuffer != null)
         {
             xAudioBuffer.Stream.Dispose();
             xAudioBuffer.Stream = null;
             xAudioBuffer        = null;
         }
         if (xAudio != null)
         {
             xAudio.StopEngine();
             xAudio.Dispose();
             xAudio = null;
         }
     }
 }
コード例 #5
0
ファイル: AudioManager.cs プロジェクト: exomia/framework
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (disposing)
                {
                    StopFxSounds();
                    StopEnvSounds();

                    _currentBgm?.DestroyVoice();
                    _currentBgm?.Dispose();
                    _currentBgm = null;

                    _fxLinkedSoundList.Clear();
                    _envLinkedSoundList.Clear();

                    UnloadAll();

                    _fxSubmixVoice.DestroyVoice();
                    _fxSubmixVoice.Dispose();

                    _envSubmixVoice.DestroyVoice();
                    _envSubmixVoice.Dispose();

                    _masteringVoice.DestroyVoice();
                    _masteringVoice.Dispose();

                    _xAudio2.Dispose();
                }

                _disposed = true;
            }
        }
コード例 #6
0
        public override void Dispose()
        {
            if (InvokeRequired)
            {
                stopThread = true;

                int count = 0;

                while (xaudThread.ThreadState == ThreadState.Running)
                {
                    Thread.Sleep(10);
                    count++;

                    if (count > 20)
                    {
                        xaudThread.Abort();
                    }
                }

                return;
            }

            masteringVoice.Dispose();
            mDevice.Dispose();
        }
コード例 #7
0
ファイル: SoundEffect.cs プロジェクト: zielakbn/MonoGame
        static SoundEffect()
        {
            // This cannot fail.
            Device = new XAudio2();

            try
            {
                Device.StartEngine();

                // Let windows autodetect number of channels and sample rate.
                MasterVoice = new MasteringVoice(Device, XAudio2.DefaultChannels, XAudio2.DefaultSampleRate);
                MasterVoice.SetVolume(_masterVolume, 0);

                // The autodetected value of MasterVoice.ChannelMask corresponds to the speaker layout.
                Speakers = (Speakers)MasterVoice.ChannelMask;
            }
            catch
            {
                // Release the device and null it as
                // we have no audio support.
                Device.Dispose();
                Device      = null;
                MasterVoice = null;
            }
        }
コード例 #8
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         _xAudio.Dispose();
     }
 }
コード例 #9
0
        protected virtual void Dispose(bool disposing)
        {
            if (!m_Disposed)
            {
                if (disposing)
                {
                    Stop();
                    m_CancellationToken?.Dispose();
                    m_Current?.Dispose();
                    m_ProcessingTask.Dispose();

                    SoundMsgStart?.Dispose();
                    SoundMsgEnd?.Dispose();

                    foreach (var msg in SupportedMessages)
                    {
                        msg?.Dispose();
                    }

                    m_MasteringVoice.Dispose();
                    m_Device.Dispose();
                }
                m_Disposed = true;
            }
        }
コード例 #10
0
ファイル: SoundManager.cs プロジェクト: redox114514/Ched
 public void Dispose()
 {
     foreach (var item in voices)
     {
         item.Key.Dispose();
     }
     xAudio?.Dispose();
 }
コード例 #11
0
        // Does someone actually need to call this if it only happens when the whole
        // game closes? And if so, who would make the call?
        internal static void Shutdown()
        {
            MasterVoice.DestroyVoice();
            MasterVoice.Dispose();

            Device.StopEngine();
            Device.Dispose();
        }
コード例 #12
0
        /// <summary>
        /// Não necessariamente um dispose.
        /// </summary>
        public void Dispose()
        {
            StopEngine();
            XAudio2.Dispose();

            XAudio2        = null;
            MasteringVoice = null;
        }
コード例 #13
0
        public static DeviceDetails[] GetAudioDevices()
        {
            XAudio2 system = new XAudio2();
            var     dd     = GetAudioDevices(system);

            system.Dispose();
            return(dd);
        }
コード例 #14
0
 public static void disposeAudio()
 {
     mv.Dispose();
     xa2.Dispose();
     foreach (SourceVoice s in sources.Keys)
     {
         finishSource(s);
     }
 }
コード例 #15
0
ファイル: AwcForm.cs プロジェクト: pnwparksfan/CodeWalker
 private void AwcForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     Stop();
     if (xAudio2 != null)
     {
         masteringVoice.Dispose();
         xAudio2.Dispose();
     }
 }
コード例 #16
0
 private void Dispose(bool isDisposing)
 {
     if (!isDisposing)
     {
         return;
     }
     //disposed managed items:
     XAudio2.Dispose();
     MasteringVoice.Dispose();
 }
コード例 #17
0
ファイル: SoundController.cs プロジェクト: zxc88645/ExileApi
        public void Dispose()
        {
            foreach (var wave in Sounds)
            {
                wave.Value.Buffer.Stream.Dispose();
            }

            xAudio2.StopEngine();
            masteringVoice?.Dispose();
            xAudio2?.Dispose();
        }
コード例 #18
0
 private void finalizeXAudio2()
 {
     if (xaMaster != null)
     {
         xaMaster.Dispose();
     }
     if (xaDevice != null)
     {
         xaDevice.Dispose();
     }
 }
コード例 #19
0
 public void DisposeAudio()
 {
     if (xAudio2 != null)
     {
         masteringVoice.Dispose();
         xAudio2.Dispose();
     }
     foreach (var voice in voices)
     {
         voice?.audioBuffer?.Stream?.Dispose();
     }
 }
コード例 #20
0
        /// <summary>
        /// SharpDX XAudio2 sample. Plays wav/xwma/adpcm files from the disk.
        /// </summary>
        static void Main(string[] args)
        {
            var xaudio2        = new XAudio2();
            var masteringVoice = new MasteringVoice(xaudio2);

            PLaySoundFile(xaudio2, "1) Playing a standard WAV file", "ergon.wav");
            PLaySoundFile(xaudio2, "2) Playing a XWMA file", "ergon.xwma");
            PLaySoundFile(xaudio2, "3) Playing an ADPCM file", "ergon.adpcm.wav");

            masteringVoice.Dispose();
            xaudio2.Dispose();
        }
コード例 #21
0
 public void Stop()
 {
     thread?.Abort();
     if (sourceVoice != null && buffer != null && xaudio2 != null && masteringVoice != null)
     {
         sourceVoice.DestroyVoice();
         sourceVoice.Dispose();
         sourceVoice = null;
         xaudio2.Dispose();
         masteringVoice.Dispose();
     }
 }
コード例 #22
0
 public void Dispose()
 {
     _quit = true;
     _audioThread.Wait();
     Stop();
     foreach (var buffer in _buffers)
     {
         buffer.Dispose();
     }
     _voice.Dispose();
     _masteringVoice.Dispose();
     _xAudio.Dispose();
 }
コード例 #23
0
        /*-------------------------------------
         * PUBLIC METHODS
         *-----------------------------------*/

        public void Cleanup()
        {
            if (m_MasteringVoice != null)
            {
                m_MasteringVoice.Dispose();
                m_MasteringVoice = null;
            }

            if (m_XAudio2 != null)
            {
                m_XAudio2.Dispose();
                m_XAudio2 = null;
            }
        }
コード例 #24
0
ファイル: AudioTest.cs プロジェクト: AmmRage/mmflex
        const int VK_ESCAPE = 0x1B;                             //

        public static void AudioMain()
        {
            XAudio2 device = new XAudio2();                             //audio output stream/device

            MasteringVoice masteringVoice = new MasteringVoice(device); //no idea, presumably prepares the out stream

            // play a PCM file
            PlayPcm(device, "MusicMono.wav"); //this actually plays a wav file

            // play a 5.1 PCM wave extensible file
            PlayPcm(device, "MusicSurround.wav");

            masteringVoice.Dispose();   //cleanup
            device.Dispose();           //
        }
コード例 #25
0
        public void TestPlaySoundXAudio2()
        {
            XAudio2 device = new XAudio2();

            MasteringVoice masteringVoice = new MasteringVoice(device);

            // play a PCM file
            PlayPCM(device, TWDir.GameData + "\\Core\\TestSound.wav");

            // play a 5.1 PCM wave extensible file
            //PlayPCM(device, "MusicSurround.wav");

            masteringVoice.Dispose();
            device.Dispose();
        }
コード例 #26
0
        static void Main()
        {
            XAudio2 device = new XAudio2();

            MasteringVoice masteringVoice = new MasteringVoice(device);

            // play a PCM file
            PlayPCM(device, "MusicMono.wav");

            // play a 5.1 PCM wave extensible file
            PlayPCM(device, "MusicSurround.wav");

            masteringVoice.Dispose();
            device.Dispose();
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: zhandb/slimdx
        static void Main()
        {
            XAudio2 device = new XAudio2();

            MasteringVoice masteringVoice = new MasteringVoice(device);

            // play a PCM file
            PlayPCM(device, "MusicMono.wav");

            // play a 5.1 PCM wave extensible file
            PlayPCM(device, "MusicSurround.wav");

            masteringVoice.Dispose();
            device.Dispose();
        }
コード例 #28
0
 public override void Dispose()
 {
     if (_voice != null)
     {
         _voice.Dispose();
     }
     if (_masteringVoice != null)
     {
         _masteringVoice.Dispose();
     }
     if (_xaudio2 != null)
     {
         _xaudio2.Dispose();
     }
 }
コード例 #29
0
ファイル: XAudio2Stream.cs プロジェクト: MassVOiD/FamiStudio
        public static bool TryDetectXAudio2()
        {
            try
            {
                var xaudio2 = new XAudio2();

                xaudio2.Dispose();
                xaudio2 = null;

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #30
0
 public void Dispose()
 {
     DeviceMain.Direct3D.Dispose();
     SpriteMain.Dispose();
     if (TextureObjectDictionary != null)
     {
         foreach (TextureObject textureObject in TextureObjectDictionary.Values)
         {
             textureObject.Dispose();
         }
     }
     if (SoundDictionary != null)
     {
         foreach (XAudio2_Player xaudio2Player in SoundDictionary.Values)
         {
             xaudio2Player.Dispose();
         }
     }
     if (BGM_Player != null)
     {
         BGM_Player.Dispose();
     }
     if (ScreenTexMan != null)
     {
         ScreenTexMan.Dispose();
     }
     if (EffectDictionary != null)
     {
         foreach (ComObject comObject in EffectDictionary.Values)
         {
             comObject.Dispose();
         }
     }
     if (ModelDictionary != null)
     {
         foreach (Model model in ModelDictionary.Values)
         {
             model.Dispose();
         }
     }
     if (DeviceXaudio2 == null)
     {
         return;
     }
     DeviceXaudio2.Dispose();
 }
コード例 #31
0
ファイル: XAudio2Stream.cs プロジェクト: ronchaine/FamiStudio
        public void Dispose()
        {
            Stop();

            for (int i = 0; i < audioBuffersRing.Length; i++)
            {
                Utilities.FreeMemory(memBuffers[i].Pointer);
                memBuffers[i].Pointer = IntPtr.Zero;
            }

            masteringVoice.DestroyVoice();
            masteringVoice.Dispose();
            masteringVoice = null;

            xaudio2.Dispose();
            xaudio2 = null;
        }