Ejemplo n.º 1
0
 private void OnDestroy()
 {
     // Dispose/destroy the emitter
     _emitter.stop();
     _emitter.Dispose();
     _emitter = null;
 }
Ejemplo n.º 2
0
 public static void Stop_Emitter()
 {
     if (_emitter != null)
     {
         _emitter.stop();
         _emitter.Dispose();
         _emitter = null;
     }
 }
    public static void Main(string[] args)
    {
        // Create a timepoint streaming emitter
        // Note that this automatically attempts to connect to the device, if present
        _emitter = new TimePointStreamingEmitter();
        // Inform the SDK how many control points you intend to use
        // This also calculates the resulting sample rate in Hz, which is returned to the user
        uint  sample_rate       = _emitter.setMaximumControlPointCount(1);
        float desired_frequency = 200.0f;

        // From here, we can establish how many timepoints there are in a single "iteration" of the cosine wave
        _timepoint_count = (uint)(sample_rate / desired_frequency);

        _positions   = new Vector3[_timepoint_count];
        _intensities = new float[_timepoint_count];

        // Populate the positions and intensities ahead of time, so that the callback is as fast as possible later
        // Modulate the intensity to be a complete cosine waveform over the full set of points.
        for (int i = 0; i < _timepoint_count; i++)
        {
            float intensity = 0.5f * (1.0f - (float)Math.Cos(2.0f * Math.PI * i / _timepoint_count));
            // Set a constant position of 20cm above the array
            _positions[i]   = new Vector3(0.0f, 0.0f, 0.2f);
            _intensities[i] = (intensity);
        }

        // Set our callback to be called each time the device is ready for new points
        _emitter.setEmissionCallback(callback, null);
        // Instruct the device to call our callback and begin emitting
        bool isOK = _emitter.start();

        // Wait until the program is ready to stop
        Console.ReadKey();

        // Stop the device
        _emitter.stop();

        // Dispose/destroy the emitter
        _emitter.Dispose();
        _emitter = null;
    }
Ejemplo n.º 4
0
 void OnApplicationQuit()
 {
     _emitter.stop();
 }