Exemplo n.º 1
0
 /// <summary>
 /// Handler for the Click event of the Edit button. Opens the editor.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void click_Edit(object sender, EventArgs e)
 {
     using (var editor = new EditorPhonF(this, _dt1))
     {
         editor.ShowDialog(this);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// cTor. Instantiates a 'WaverF' object.
        /// </summary>
        /// <param name="editor">parent</param>
        /// <param name="wavefile">fullpath of PCM-wave file</param>
        /// <param name="dt">pointer to the 'FxeGeneratorF._dt1' PHONEMES
        /// datatable</param>
        internal WaverF(EditorPhonF editor, string wavefile, DataTable dt)
        {
//#if DEBUG
//			logfile.Log();
//			logfile.Log("WaverF.cTor");
//#endif
            InitializeComponent();
            _editor = editor;
            _dt     = dt;

            if (_x != -1)
            {
                Location   = new Point(_x, _y);
                ClientSize = new Size(_w, _h);
            }
            else
            {
                Location = new Point(_editor.Left + 20, _editor.Top + 20);
            }

            Conatiner(wavefile);                   // <-- Parse the wavefile into a short-array.

            if (ClientSize.Width > _shorts.Length) // ensure min 1 sample/pixel
            {
                ClientSize = new Size(_shorts.Length, ClientSize.Height);
                // TODO: Should set the form's MaxSize restriction here.
                // But what are the odds that user is going to try to deal with
                // a wave that's less than ~20 millisecs ...
                //
                // I'm just saying that I'm not considering rounding errors/
                // ambiguities that could and will occur when one sample is
                // represented by 2+ pixels; my plate is full dealing with the
                // standard case where one pixel represents 1+ samples: recall
                // that 1 sec of audio drawn across a 1000 pixel panel shall
                // have 44.1 samples in each pixel. And that's a lowball
                // estimate
            }

            Text = TITLE + " - " + FxeGeneratorF.Filelabel + " - " + _dur.ToString("F3") + " sec";

            PosStart = 0;

            tb_start.BackColor      =
                tb_offset.BackColor = Color.MintCream;
            tb_offset.Text          = _sapiDelay.ToString("F3");

            bu_reset.Text = tb_offset.Text;

            pa_wave.Select();

            _wavereader = new WaveFileReader(SapiLipsync.That.Wavefile);             // <-- Parse the wavefile into a byte-array.
            _waveout    = new WaveOutEvent(_wavereader);

            _waveout.PlaybackStopped += OnPlaybackStopped;

            _t1.Tick    += Track;
            _t1.Interval = 15;
        }