コード例 #1
0
ファイル: WaveExport.cs プロジェクト: q4a/SparkIV
        public static void Export(AudioFile file, AudioWave wave, Stream outStream)
        {
            WaveHeader header = new WaveHeader();

            // Skip the header
            outStream.Seek(header.HeaderSize, SeekOrigin.Begin);

            // Write the data
            file.SoundBank.ExportAsPCM(wave.Index, file.Stream, outStream);

            // Create header and write it
            outStream.Seek(0, SeekOrigin.Begin);
            header.FileSize         = (int)outStream.Length;
            header.SamplesPerSecond = wave.SamplesPerSecond;
            header.Write(new BinaryWriter(outStream));
        }
コード例 #2
0
ファイル: WaveExport.cs プロジェクト: tjhorner/gtaivtools
        public static void Export(AudioFile file, AudioWave wave, Stream outStream)
        {
            WaveHeader header = new WaveHeader();
            
            // Skip the header
            outStream.Seek(header.HeaderSize, SeekOrigin.Begin);

            // Write the data
            file.SoundBank.ExportAsPCM(wave.Index, file.Stream, outStream);

            // Create header and write it
            outStream.Seek(0, SeekOrigin.Begin);
            header.FileSize = (int)outStream.Length;
            header.SamplesPerSecond = wave.SamplesPerSecond;
            header.Write(new BinaryWriter(outStream));
        }
コード例 #3
0
ファイル: WaveExport.cs プロジェクト: tjhorner/gtaivtools
        public static void ExportMultichannel(AudioFile file, Stream outStream)
        {
            WaveHeader header = new WaveHeader(true);

            // Skip the header
            outStream.Seek(header.HeaderSize, SeekOrigin.Begin);

            // Write the data
            IMultichannelSound sound = file.SoundBank as IMultichannelSound;
            sound.ExportMultichannelAsPCM(file.Stream, outStream);

            // Create header and write it
            outStream.Seek(0, SeekOrigin.Begin);
            header.FileSize = (int)outStream.Length;
            header.SamplesPerSecond = sound.CommonSamplesPerSecond;
            header.ChannelMask = sound.ChannelMask;
            header.Write(new BinaryWriter(outStream));
        }
コード例 #4
0
ファイル: WaveExport.cs プロジェクト: q4a/SparkIV
        public static void ExportMultichannel(AudioFile file, Stream outStream)
        {
            WaveHeader header = new WaveHeader(true);

            // Skip the header
            outStream.Seek(header.HeaderSize, SeekOrigin.Begin);

            // Write the data
            IMultichannelSound sound = file.SoundBank as IMultichannelSound;

            sound.ExportMultichannelAsPCM(file.Stream, outStream);

            // Create header and write it
            outStream.Seek(0, SeekOrigin.Begin);
            header.FileSize         = (int)outStream.Length;
            header.SamplesPerSecond = sound.CommonSamplesPerSecond;
            header.ChannelMask      = sound.ChannelMask;
            header.Write(new BinaryWriter(outStream));
        }