Esempio n. 1
0
        public XAudio2_StreamingSoundBuffer(XAudio2_Audio audio, Stream input, SoundFormat format)
        {
            mAudio  = audio;
            mInput  = input;
            mFormat = format;

            Initialize();
        }
        public XAudio2_Music(XAudio2_Audio audio, string filename)
        {
            mAudio = audio;

            if (System.IO.Path.GetExtension(filename) == ".mp3")
            {
                throw new Exception("MP3 files cannot be played due to license restrictions.");
            }

            //LoadMusic(filename);
        }
Esempio n. 3
0
        public XAudio2_SoundBufferSession(XAudio2_Audio audio, XAudio2_SoundBuffer source)
        {
            mAudio  = audio;
            mSource = source;
            mBuffer = source.Buffer;
            mVolume = source.Volume;
            mLoop   = source.Loop;

            mVoice            = new SourceVoice(mAudio.Device, mSource.Format);
            mVoice.BufferEnd += new EventHandler <ContextEventArgs>(mVoice_BufferEnd);
        }
        public XAudio2_SoundBuffer(XAudio2_Audio audio, Stream inStream)
        {
            mAudio = audio;

            WaveStream stream = new WaveStream(inStream);

            mBuffer            = new AudioBuffer();
            mBuffer.AudioData  = stream;
            mBuffer.AudioBytes = (int)stream.Length;

            mFormat = stream.Format;
        }
        public XAudio2_Music(XAudio2_Audio audio, Stream infile)
        {
            mAudio = audio;

            //string tempfile = Path.GetTempFileName();
            //using (FileStream writer = File.OpenWrite(tempfile))
            //{
            //    ReadWriteStream(infile, writer);
            //}

            //try
            //{
            //    LoadMusic(tempfile);
            //}
            //catch (Microsoft.DirectX.DirectXException e)
            //{
            //    throw new AgateLib.AgateException(
            //        "Could not load the music file.  The file format may be unsupported by DirectX.", e);
            //}
            //finally
            //{
            //    File.Delete(tempfile);
            //}
        }
 public XAudio2_SoundBuffer(XAudio2_Audio audio, string filename)
     : this(audio, File.OpenRead(filename))
 {
 }