code: function winwheelTriggerSound()
  {
      // If this property does not exist then add it as a property of the winwheel.
      if (winwheelToDrawDuringAnimation.hasOwnProperty('_lastSoundTriggerNumber') == false) {
          winwheelToDrawDuringAnimation._lastSoundTriggerNumber = 0;
      }
  
      let callbackSound = winwheelToDrawDuringAnimation.animation.callbackSound;
      let currentTriggerNumber = 0;
  
      // Now figure out if the sound callback should be called depending on the sound trigger type.
      if (winwheelToDrawDuringAnimation.animation.soundTrigger == 'pin') {
          // So for the pin type we need to work out which pin we are between.
          currentTriggerNumber = winwheelToDrawDuringAnimation.getCurrentPinNumber();
      } else {
          // Check on the change of segment by working out which segment we are in.
          // We can utilise the existing getIndiatedSegmentNumber function.
          currentTriggerNumber = winwheelToDrawDuringAnimation.getIndicatedSegmentNumber();
      }
  
      // If the current number is not the same as last time then call the sound callback.
      if (currentTriggerNumber != winwheelToDrawDuringAnimation._lastSoundTriggerNumber) {
          // If the property is a function then call it, otherwise eval the proptery as javascript code.
          if (typeof callbackSound === 'function') {
              callbackSound();
          } else {
              eval(callbackSound);
          }
  
          // Also update the last sound trigger with the current number.
          winwheelToDrawDuringAnimation._lastSoundTriggerNumber = currentTriggerNumber;
      }
  }
docs: ==================================================================================================================== This function figures out if the callbackSound function needs to be called by working out if the segment or pin has changed since the last animation loop. ====================================================================================================================