Ejemplo n.º 1
0
    protected override void Awake()
    {
        base.Awake();

        _playhead       = new Playhead();
        _playhead.Skip += OnPlayheadSkip;

        if (_createAudioSources)
        {
            _audioSources = new AudioSource[1 + _song.Stems.Length];
            for (int i = 0; i < _audioSources.Length; ++i)
            {
                var playbackObject = new GameObject("Playback Source " + i);
                playbackObject.transform.parent = transform;
                var audioSource = playbackObject.AddComponent <AudioSource>();
                audioSource.playOnAwake = false;
                _audioSources[i]        = audioSource;
            }
        }

        SetupSong();

        if (_autoplay)
        {
            Play();
        }
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Awake()
    {
        tempo       = Random.Range(80.0f, 140.0f);
        signatureHi = Random.Range(3, 6);

        subdivisionLength = 60.0f / (tempo * subdivisions);              //Determine the subdivision length in seconds
        nextSubdivision   = subdivisionLength + lookAhead;               //The time when the next subdivision will be determined

        playhead = new Playhead(signatureHi, signatureLo, subdivisions); //A playhead object that will keep track of the measures and beats of the music
    }
Ejemplo n.º 3
0
    private readonly float _REVERSEHORIZONTALOFFSET = 60.0f;  // Better note alignment.
    //--------------------------------------------------------------------------
    /// <summary>
    /// Start this instance by getting dynamic data from our staff canvas
    /// and playhead.
    /// </summary>
    void Start()
    {
        _keyNotes = new KeyNotes();          // Note sprite data.

        _staffData   = GameObject.Find("StaffCanvas").GetComponent <StaffData> ();
        _staffWidth  = _staffData.width;
        _staffHeight = _staffData.height;

        _timer    = GameObject.Find("Timer").GetComponent <Timer> ();
        _playhead = GameObject.Find("PlayheadSprite").GetComponent <Playhead> ();
        _recorder = GameObject.Find("Recorder").GetComponent <Recorder> ();
    }
Ejemplo n.º 4
0
 internal StemPlayhead(Playhead playhead, StemData stem)
 {
     _playhead = playhead;
     _stem     = stem;
 }