Example #1
0
        /// <summary>
        /// The pitch was detected - add the record
        /// </summary>
        /// <param name="pitch"></param>
        private void AddPitchRecord(float pitch)
        {
            var midiNote  = 0;
            var midiCents = 0;

            PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents);

            var record = new PitchRecord();

            record.RecordIndex = m_curPitchIndex;
            record.Pitch       = pitch;
            record.MidiNote    = midiNote;
            record.MidiCents   = midiCents;

            m_curPitchRecord = record;

            if (m_recordPitchRecords)
            {
                if (m_pitchRecordHistorySize > 0 && m_pitchRecords.Count >= m_pitchRecordHistorySize)
                {
                    m_pitchRecords.RemoveAt(0);
                }

                m_pitchRecords.Add(record);
            }

            if (this.PitchDetected != null)
            {
                this.PitchDetected(this, record);
            }
        }
        /// <summary>
        /// The pitch was detected - add the record
        /// </summary>
        /// <param name="pitch"></param>
        private void AddPitchRecord(float pitch)
        {
            var midiNote = 0;
            var midiCents = 0;

            PitchDsp.PitchToMidiNote(pitch, out midiNote, out midiCents);

            var record = new PitchRecord();

            record.RecordIndex = m_curPitchIndex;
            record.Pitch = pitch;
            record.MidiNote = midiNote;
            record.MidiCents = midiCents;

            m_curPitchRecord = record;

            if (m_recordPitchRecords)
            {
                if (m_pitchRecordHistorySize > 0 && m_pitchRecords.Count >= m_pitchRecordHistorySize)
                    m_pitchRecords.RemoveAt(0);

                m_pitchRecords.Add(record);
            }
            
            if (this.PitchDetected != null)
                this.PitchDetected(this, record);
        }