Ejemplo n.º 1
0
 // Use this for initialization
 void Start()
 {
     _grabber = new GstCustomAudioGrabber();
     _grabber.Init("filesrc location=\"" + AudioFile + "\" ! decodebin3 ! audioconvert ! audioresample", Channels, SamplingRate);
     _grabber.Start();
     _grabber.OnDataArrived += OnDataArrived;
 }
Ejemplo n.º 2
0
    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);
        }
    }