예제 #1
0
 public override void Setup(WaveFormatEx format)
 {
     _format = new WaveFormatExtensible(format.nSamplesPerSec, format.wBitsPerSample, format.nChannels);
     _voice = new SourceVoice(_xaudio2, _format);
     _voice.StreamEnd += _voice_StreamEnd;
     _voice.VoiceError += _voice_VoiceError;
     _emitter = new Emitter
     {
         ChannelAzimuths = GetAzimuths(_format.Channels),
         ChannelCount = _format.Channels,
         ChannelRadius = 10,
         CurveDistanceScaler = float.MinValue,
         OrientFront = new Vector3(0, 0, 1),
         OrientTop = new Vector3(0, 1, 0),
         Position = new Vector3(0, 0, 0),
         Velocity = new Vector3(0, 0, 0)
     };
 }
예제 #2
0
        public WaveFormatEx GetSampleGrabberFormat(ISampleGrabber sampleGrabber)
        {
            int hr;

            AMMediaType mediaInfo = new AMMediaType();
            hr = sampleGrabber.GetConnectedMediaType(mediaInfo);
            DsError.ThrowExceptionForHR(hr);

            if ((mediaInfo.formatType != FormatType.WaveEx) || (mediaInfo.formatPtr == IntPtr.Zero))
            {
                throw new NotSupportedException("Unknown Grabber Media Format");
            }

            WaveFormatEx format = new WaveFormatEx();
            format = (WaveFormatEx)Marshal.PtrToStructure(mediaInfo.formatPtr, typeof(WaveFormatEx));
            Marshal.FreeCoTaskMem(mediaInfo.formatPtr);
            mediaInfo.formatPtr = IntPtr.Zero;

            return format;
        }
예제 #3
0
 public abstract void Setup(WaveFormatEx format);