Exemple #1
0
        public WaveFile(WAVEFORMATEX format)
        {
            WaveHeader        = new WAVEHEADER();
            WaveHeader.dwRiff = BitConverter.ToUInt32(RIFF, 0);
            WaveHeader.dwWave = BitConverter.ToUInt32(WAVE, 0);
            WaveHeader.dwFmt  = BitConverter.ToUInt32(fmt, 0);

            WaveFormatEx = format;
        }
Exemple #2
0
        public WaveFile(WAVEFORMATEX format)
        {
            WaveHeader = new WAVEHEADER();
            WaveHeader.dwRiff = BitConverter.ToUInt32(RIFF, 0);
            WaveHeader.dwWave = BitConverter.ToUInt32(WAVE, 0);
            WaveHeader.dwFmt = BitConverter.ToUInt32(fmt, 0);

            WaveFormatEx = format;
        }
Exemple #3
0
        public MediaFoundationAudioWriter(MF.SinkWriter sinkWriter, ref WAVEFORMATEX waveFormat, int desiredBitRate = 192000)
        {
            var sharpWf = waveFormat.ToSharpDX();

            // Information on configuring an AAC media type can be found here:
            // http://msdn.microsoft.com/en-gb/library/windows/desktop/dd742785%28v=vs.85%29.aspx
            var outputMediaType = SelectMediaType(AudioFormat, sharpWf, desiredBitRate);

            if (outputMediaType == null)
            {
                throw new InvalidOperationException("No suitable encoders available");
            }

            var inputMediaType = new MF.MediaType();
            var size           = 18 + sharpWf.ExtraSize;

            sinkWriter.AddStream(outputMediaType, out streamIndex);

            MF.MediaFactory.InitMediaTypeFromWaveFormatEx(inputMediaType, new[] { sharpWf }, size);
            sinkWriter.SetInputMediaType(streamIndex, inputMediaType, null);
        }
 public AACAudioWriter(MF.SinkWriter sinkWriter, ref WAVEFORMATEX waveFormat, int desiredBitRate = 192000)
     : base(sinkWriter, ref waveFormat, desiredBitRate)
 {
 }
 public MP3AudioWriter(MF.SinkWriter sinkWriter, ref WAVEFORMATEX waveFormat, int desiredBitRate = 192000)
     : base(sinkWriter, ref waveFormat, desiredBitRate)
 {
 }
        public MediaFoundationAudioWriter(MF.SinkWriter sinkWriter, ref WAVEFORMATEX waveFormat, int desiredBitRate = 192000)
        {
            var sharpWf = waveFormat.ToSharpDX();

            // Information on configuring an AAC media type can be found here:
            // http://msdn.microsoft.com/en-gb/library/windows/desktop/dd742785%28v=vs.85%29.aspx
            var outputMediaType = SelectMediaType(AudioFormat, sharpWf, desiredBitRate);
            if (outputMediaType == null) throw new InvalidOperationException("No suitable encoders available");

            var inputMediaType = new MF.MediaType();
            var size = 18 + sharpWf.ExtraSize;

            sinkWriter.AddStream(outputMediaType, out streamIndex);

            MF.MediaFactory.InitMediaTypeFromWaveFormatEx(inputMediaType, new[] { sharpWf }, size);
            sinkWriter.SetInputMediaType(streamIndex, inputMediaType, null);
        }