Example #1
0
        /// <summary>
        /// Processes a new note with slide effect
        /// </summary>
        /// <param name="note">The note to create<see cref="P8Note"/></param>
        private void ProcessNoteSlide(P8Note note)
        {
            int  pitchFrom  = _currentNote == 0 ? 32 : notes[_currentNote - 1].pitch;
            Note noteToPlay = new Note(ref _audioBuffer, _sampleRate, ref _oscillator, duration, note.volume, note.waveform, note.pitch, pitchFrom, _fadeIn, 0);

            notesToPlay.Enqueue(noteToPlay);
        }
Example #2
0
        /// <summary>
        /// Processes a new note with slow arpeggio effect
        /// </summary>
        /// <param name="note">The note to create<see cref="P8Note"/></param>
        private void ProcessNoteArpeggioSlow(P8Note note)
        {
            Note noteToPlay = new Note(ref _audioBuffer, _sampleRate, ref _oscillator, duration, note.volume, note.waveform, note.pitch, note.pitch, 0, 0);

            notesToPlay.Enqueue(noteToPlay);
        }
Example #3
0
        /// <summary>
        /// Queue next notes for playing.
        /// </summary>
        private void QueueNextNotes()
        {
            if (_currentNote > _lastIndex)
            {
                return;
            }

            P8Note nextNote = notes[_currentNote];

            switch (nextNote.effect)
            {
            case 0:
                ProcessNoteNoEffect(nextNote);
                _fadeIn = 0;
                break;

            case 1:
                ProcessNoteSlide(nextNote);
                _fadeIn = 0;
                break;

            case 2:
                ProcessNoteVibrato(nextNote);
                _fadeIn = 0;
                break;

            case 3:
                ProcessNoteDrop(nextNote);
                _fadeIn = 0;
                break;

            case 4:
                ProcessNoteFadeIn(nextNote);
                _fadeIn = 0;
                break;

            case 5:
                ProcessNoteFadeOut(nextNote);
                _fadeIn = 1.0f / duration;
                break;

            case 6:
                ProcessNoteArpeggioFast(nextNote);
                _fadeIn = 0;
                break;

            case 7:
                ProcessNoteArpeggioSlow(nextNote);
                _fadeIn = 0;
                break;

            default:
                _fadeIn = 0.5f / duration;
                break;
            }

            // If sfx has loop defined, process it. Otherwise keep incrementing note index.
            if (loop && startLoop < endLoop && _currentNote == endLoop - 1)
            {
                _currentNote = startLoop;
            }
            else
            {
                _currentNote += 1;
            }
        }