Ejemplo n.º 1
0
        public MDX1_Music(MDX1_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);
            }
        }
Ejemplo n.º 2
0
        public MDX1_Music(MDX1_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);
        }
Ejemplo n.º 3
0
        public MDX1_SoundBuffer(MDX1_Audio audio, Stream inStream)
        {
            mAudio = audio;

            DirectSound.BufferDescription desc = new Microsoft.DirectX.DirectSound.BufferDescription();

            desc.PrimaryBuffer    = false;
            desc.ControlVolume    = true;
            desc.ControlFrequency = true;
            desc.ControlPan       = true;
            desc.ControlEffects   = false;
            desc.LocateInSoftware = true;

            mBuffer = new DirectSound.SecondaryBuffer(inStream, desc, mAudio.DS_Device);
        }
Ejemplo n.º 4
0
 public MDX1_SoundBufferSession(MDX1_Audio audio, MDX1_SoundBuffer source)
 {
     mAudio  = audio;
     mBuffer = source.Buffer.Clone(mAudio.DS_Device);
 }
Ejemplo n.º 5
0
 public MDX1_SoundBuffer(MDX1_Audio audio, string filename)
     : this(audio, File.OpenRead(filename))
 {
 }