// Use this for initialization void Start() { _grabber = new GstUnityAudioGrabber(); _grabber2 = new GstCustomAudioGrabber(); _grabber2.Init("filesrc location=\"" + AudioFile + "\" ! decodebin3 ! audioconvert ! audioresample", Channels, SampleRate); _osc = new Oscillator(); _osc.SetNote(70); _grabber.Init(_osc.SamplesCount() * 10, 1, AudioSettings.outputSampleRate); float[] data = new float[_grabber.BufferLength]; for (int i = 0; i < data.Length; ++i) { data [i] = _osc.Sample(); } _data = data; _streamer = new GstAppNetAudioStreamer(); _streamer.AttachGrabber(_grabber2); _grabber2.Start(); _streamer.SetIP("127.0.0.1", 5001); _streamer.CreateStream(); _streamer.Stream(); }
void _CreateRTPAudio() { RTPAudioStream a; if (_audioStream != null) { _audioStream.Close(); } _audioStream = (a = new RTPAudioStream()); if (InitWithMicrophone) { GstCustomAudioGrabber grabber; grabber = new GstCustomAudioGrabber(); //grabber.Init ("filesrc location=c:/Users/Torso/Downloads/2537.mp3 ! decodebin ! audioconvert ",1, 44100); grabber.Init("directsoundsrc buffer-time=10", 1, 44100); a.Grabber = grabber; } else { if (Output == null) { return; } var grabber = new GstUnityAudioGrabber(); grabber.Init(2048, 1, Output.SamplingRate); a.Grabber = grabber; } a.AudioStreamPort = _audioStreamPort; a.TargetNode = gameObject; a.RobotConnector = RobotConnector; a.Init(_robotIfo); a.Grabber.Start(); if (OnAudioStreamCreated != null) { OnAudioStreamCreated(this, _audioStream); } }
// Use this for initialization void Start() { _grabber = new GstUnityAudioGrabber(); _grabber.Init(BufferLength, Channels, SamplingRate); _grabber.Start(); }