Class HapticTrigger

  • java.lang.Object
    • uk.ac.qmul.eecs.depic.daw.haptics.HapticTrigger
  • All Implemented Interfaces:
    SoundWaveListener, SequenceListener, SequenceMapping


    public class HapticTrigger
    extends java.lang.Object
    implements SequenceMapping, SequenceListener, SoundWaveListener
    Listens to elements of the DAW and sends commands to the haptic device in order to render such elements in haptics. It implements all the listeners interfaces because it reacts to changes and mirrors them in haptics. It is used to render sound waves and automations (sequences) in haptics
    • Method Detail

      • renderCurve

        public void renderCurve(Sequence m,
                                float startTime)
        Description copied from interface: SequenceMapping
        Renders the whole curve, from start to end
        Specified by:
        renderCurve in interface SequenceMapping
        startTime - the time in millisecond the curve rendering has to start from, if -1 will immediately stop the rendering.
      • renderCurveAt

        public void renderCurveAt(Sequence sequence,
                                  float time,
                                  float duration)
        Description copied from interface: SequenceMapping
        Render a curve at precise time If sound is used for rendering, the sound lasts duration milliseconds and then fades out. If INF is passed as duration the sound will go on forever. Successive calls with INF as duration will have the effect of changing the sound in order to represent the curve at the new time passed as argument. Successive calls with duration different from DURATION_INF will carry on the sound for duration millisecond (and therefore setting duration to 0 will stop the sound).
        Specified by:
        renderCurveAt in interface SequenceMapping
        Parameters:
        sequence - the sequence to render
        time - the time at which the sequence has to be rendered
        duration - the duration of sound in millisecond. If (@code DURATION_INF) is used the sound will go on forever until it's stopped. To stop the sound use duration = -1;
      • sequenceUpdated

        public <T extends SequenceEvent> void sequenceUpdated(T t)
        Description copied from interface: SequenceListener
        This method has to be implemented by classes that provide a continuous representation of the sequence. The method a callback that is called as soon as one of the values of the the sequence is added, deleted or modified. Implementors can thus promptly update their representation to reflect the changes in the sequence.
        Specified by:
        sequenceUpdated in interface SequenceListener
        Parameters:
        t - an event holding information about the sequence that has been modfied.
      • update

        public void update(SoundWaveEvent evt)
        Gets an update from a SoundWave this class is a listener of, and send a message to the HapticDevice thread accordingly.
        Specified by:
        update in interface SoundWaveListener
        Parameters:
        evt - the new event