Beispiel #1
0
        //This calls the functionality to enroll the recorded audio samlpe
        private async void EnrollProfile()
        {
            DataGridViewRow dr = dgvProfiles.CurrentRow;

            if (dr != null)
            {
                string profileID            = dr.Cells["SpeakerID"].Value.ToString();
                projectOxfordSpeaker s      = new projectOxfordSpeaker();
                functionResult       result = await s.enrollSpeaker(audioStream1, new Guid(profileID), Convert.ToDouble(lblSample1Length.Text));

                if (result.Result == true)
                {
                    //setValidStream(true);
                    LoadProfiles();
                }
                else
                {
                    MessageBox.Show(result.Message, "Function Result: Enroll Profile", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("Please select a profile to enroll to", "Enroll Sample", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #2
0
        //This will perform the verification of the user sample against the profile ID
        //INPUT: profile ID
        //OUPUT:
        private async void performSpeakerEnrollment(string profileID)
        {
            //Disable the buttons so the user doesn't try to re-record
            btnRecord.Enabled        = false;
            btnStopRecording.Enabled = false;
            btnCreate.Enabled        = false;

            //Validate the audio stream against the profile ID
            projectOxfordSpeaker s      = new projectOxfordSpeaker();
            functionResult       result = await s.enrollSpeaker(audioStream1, new Guid(profileID), Convert.ToDouble(lblRecordingLength.Text));

            //If all is good, set the validation as true
            if (result.Result == true)
            {
                this.DialogResult = DialogResult.OK;
            }

            else
            {
                //If there are errors. display the message
                MessageBox.Show(result.Message, "Function Result: Enroll Speaker", MessageBoxButtons.OK, MessageBoxIcon.Error);

                this.Cursor       = Cursors.Default;
                btnCreate.Text    = "Create";
                btnCancel.Enabled = true;
                btnCreate.Enabled = true;
            }
        }