コード例 #1
0
        /// <summary>
        /// Updates the meters.
        /// </summary>
        private void UpdateMeters()
        {
            if (m_audioRecorder.Recording)
            {
                m_audioRecorder.UpdateMeters();

                var normalizedValue = Math.Pow(10, m_audioRecorder.AveragePower(0) / 20);

                mMusicFlowView.WaveColor = RecordingTintColor;
                mMusicFlowView.UpdateWithLevel((nfloat)normalizedValue);

                this.NavigationItem.Title = NSStringExtensions.TimeStringForTimeInterval(m_audioRecorder.currentTime);
            }
            else if (m_audioPlayer != null && m_audioPlayer.Playing)
            {
                m_audioPlayer.UpdateMeters();

                var normalizedValue = Math.Pow(10, m_audioPlayer.AveragePower(0) / 20);

                mMusicFlowView.WaveColor = PlayingTintColor;
                mMusicFlowView.UpdateWithLevel((nfloat)normalizedValue);
            }
            else
            {
                mMusicFlowView.WaveColor = NormalTintColor;
                mMusicFlowView.UpdateWithLevel(0);
            }
        }