Пример #1
0
 private void init()
 {
     //this is in the wrong place as I need to pass in canvas size.
     //it should be done in the view itself
     RecordingSingleton.ReadFileIntoSampleArray();
     RunOnUiThread(() => updateChartAndText());
 }
Пример #2
0
        async Task ReadAudioAsync()
        {
            using (var fileStream = new FileStream(filePath, System.IO.FileMode.Create, System.IO.FileAccess.Write)) {
                while (true)
                {
                    if (endRecording)
                    {
                        endRecording = false;
                        break;
                    }
                    try {
                        // Keep reading the buffer while there is audio input.
                        int numBytes = await audioRecord.ReadAsync(audioBuffer, 0, audioBuffer.Length);

                        await fileStream.WriteAsync(audioBuffer, 0, numBytes);

                        // Do something with the audio input.
                    } catch (Exception ex) {
                        Console.Out.WriteLine(ex.Message);
                        break;
                    }
                }
                fileStream.Close();
            }
            audioRecord.Stop();
            audioRecord.Release();
            isRecording = false;
            RecordingSingleton.NewRecordingMade();
            RaiseRecordingStateChangedEvent();
        }
Пример #3
0
        private void DrawGraph(Canvas canvas)
        {
            var linesToDraw = RecordingSingleton.GetDisplayLines();
            var baseLine = RecordingSingleton.GetBaseLine();

            if (linesToDraw != null && baseLine != null)
            {
                canvas.DrawLine(baseLine.Start.X, baseLine.Start.Y, baseLine.End.X, baseLine.End.Y, GetBlue());//base line

                for (var i = 0; i < (linesToDraw.Length); i++)
                {
                    var line = linesToDraw[i];
                    canvas.DrawLine(line.Start.X, line.Start.Y, line.End.X, line.End.Y, GetRed());

                }
            }
        }
Пример #4
0
 private void SendToRecordingArray(List <Int16> toSet)
 {
     RecordingSingleton.SetSamples(toSet);
 }
Пример #5
0
 protected override void OnDraw(Canvas canvas)
 {
     RecordingSingleton.ProcessDisplayLines(canvas.Width);
     DrawGraph(canvas);
     DrawInfo(canvas);
 }