/**
  * @brief Sets the parent VirtualInstrumentManager and sets up diagnostics if needed.
  * @param[in] aVIM The parent VirtualInstrumentManager.
  */
 public void SetVIM(VirtualInstrumentManager aVIM)
 {
     mVIM = aVIM;
     #if DEBUG_AUDIO_DIAGNOSTICS
     mDiagnosticsHandler = mVIM.GetDiagnosticsHandler();
     mReported           = false;
     #endif
 }
Esempio n. 2
0
    /**
     * @brief Handles a key in the container being pressed.
     * @param[in] aPianoKey The white key that was pressed.
     */
    private void HandleKeyPressed(PianoKey aPianoKey, int aNoteVelocity)
    {
        if (EnableAudio && mVIM != null)
        {
            #if DEBUG_AUDIO_DIAGNOSTICS
            mVIM.GetDiagnosticsHandler().SetInputTime.Invoke();
            #endif

            mVIM.PlayNote.Invoke(aPianoKey.Pitch, aNoteVelocity);
        }
    }
    /** @} */

    /*************************************************************************//**
     * @defgroup MusTypPrivFunc Musical Typing Private Functions
     * @ingroup MusTyp
     * Functions used internally by @link MusTyp Musical Typing@endlink.
     ****************************************************************************/
    /** @{ */

    /**
     * @brief Sets the default values for musical typing.
     */
    private void SetMusicalTypingVariables()
    {
        #if DEBUG_AUDIO_DIAGNOSTICS
        // Get the diagnostics handler
        mDiagnosticsHandler = mVIM.GetDiagnosticsHandler();
        #endif

        // Set up the key velocities and the pressed keys.
        mKeyVelocities = new int[DEBUG_numMusicalTypingKeys];
        mPressedKeys   = new bool[DEBUG_numMusicalTypingKeys];
        for (int i = 0; i < DEBUG_numMusicalTypingKeys; i++)
        {
            mKeyVelocities[i] = 100;
            mPressedKeys[i]   = false;
        }

        // Set up the default range used when velocities are random.
        mRandomVelocityRange    = new int[2];
        mRandomVelocityRange[0] = 0;
        mRandomVelocityRange[1] = 100;
    }