コード例 #1
0
        public override bool Load()
        {
            ALError e;

            OggDecodeStream stream = new OggDecodeStream(File.Open(path, FileMode.Open));

            byte[] audioData = LoadRiffData(stream);

            AL.BufferData(base.GetDataHandle,
                GetSoundFormat(base.NumberOfChannels, base.BitsPerSample),
                audioData,
                audioData.Length,
                base.SampleRate);

            if ((e = AL.GetError()) != ALError.NoError)
            {
                Console.WriteLine("There was an error loading file: " + path +
                    " ; " + AL.GetErrorString(e));

                return false;
            }

            stream.Dispose();

            return true;
        }
コード例 #2
0
ファイル: OggDecoder.cs プロジェクト: skolima/csvorbis
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        //[STAThread]
        static void Main(string[] args)
        {
            TextWriter s_err = Console.Error;
            FileStream input = null, output = null;

            if(args.Length == 2)
            {
                try
                {
                    input = new FileStream(args[0], FileMode.Open, FileAccess.Read);
                    output = new FileStream(args[1], FileMode.OpenOrCreate);
                }
                catch(Exception e)
                {
                    s_err.WriteLine(e);
                }
            }
            else
            {
                return;
            }

            OggDecodeStream decode = new OggDecodeStream(input, true);

            byte[] buffer = new byte[4096];
            int read;
            while ((read = decode.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, read);
            }

            // Close some files
            input.Close();
            output.Close();
        }
コード例 #3
0
ファイル: OggDecoder.cs プロジェクト: HongSic/csvorbis
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        //[STAThread]
        static void Main(string[] args)
        {
            TextWriter s_err = Console.Error;
            FileStream input = null, output = null;

            if (args.Length != 2)
            {
                return;
            }

            try
            {
                input  = new FileStream(args[0], FileMode.Open, FileAccess.Read);
                output = new FileStream(args[1], FileMode.OpenOrCreate);

                OggDecodeStream decode = new OggDecodeStream(input, true);

                byte[] buffer = new byte[4096];
                int    read;

                while ((read = decode.Read(buffer, 0, buffer.Length)) > 0)
                {
                    output.Write(buffer, 0, read);
                }
            }
            catch (Exception e)
            {
                s_err.WriteLine(e);
            }
            finally
            {
                // make sure the files are always closed

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

                if (output != null)
                {
                    output.Dispose();
                }
            }
        }
コード例 #4
0
ファイル: OggDecoder.cs プロジェクト: lioncash/csvorbis
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        //[STAThread]
        private static void Main(string[] args)
        {
            TextWriter s_err = Console.Error;
            FileStream input = null, output = null;

            if (args.Length == 2)
            {
                try
                {
                    input  = new FileStream(args[0], FileMode.Open, FileAccess.Read);
                    output = new FileStream(args[1], FileMode.OpenOrCreate);
                }
                catch (Exception e)
                {
                    s_err.WriteLine(e);
                }
            }
            else
            {
                Console.WriteLine("Invalid number of commands entered.");
                Console.WriteLine("Should resemble: OggDecoder [input] [output]");
                return;
            }

            OggDecodeStream decode = new OggDecodeStream(input, false);

            byte[] buffer = new byte[4096];
            int    read;

            while ((read = decode.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, read);
            }

            // Close some files
            input.Close();
            output.Close();
        }
コード例 #5
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        //[STAThread]
        static void Main(string[] args)
        {
            TextWriter s_err = Console.Error;
            FileStream input = null, output = null;

            if (args.Length == 2)
            {
                try
                {
                    input  = new FileStream(args[0], FileMode.Open, FileAccess.Read);
                    output = new FileStream(args[1], FileMode.OpenOrCreate);
                }
                catch (Exception e)
                {
                    s_err.WriteLine(e);
                }
            }
            else
            {
                return;
            }

            OggDecodeStream decode = new OggDecodeStream(input, true);

            byte[] buffer = new byte[4096];
            int    read;

            while ((read = decode.Read(buffer, 0, buffer.Length)) > 0)
            {
                output.Write(buffer, 0, read);
            }

            // Close some files
            input.Close();
            output.Close();
        }
コード例 #6
0
ファイル: SoundEngine.cs プロジェクト: Morphan1/Voxalia
 public SoundEffect LoadVorbisSound(DataStream stream, string name)
 {
     OggDecodeStream oggds = new OggDecodeStream(stream);
     return LoadSound(new DataStream(oggds.decodedStream.ToArray()), name);
 }