Ejemplo n.º 1
0
 public NotaInfo()
 {
     timbre   = Timbre.SETE;
     duracao  = Duracao.SEMINIMA;
     compasso = -1;
     batida   = -1;
 }
 public SetTimbreAction(Controller controller, int track, Timbre oldTimbre, Timbre newTimbre)
 {
     this.controller = controller;
     this.oldTimbre  = oldTimbre;
     this.newTimbre  = newTimbre;
     this.track      = track;
 }
Ejemplo n.º 3
0
        // Handles the subscriber's NewMeasurements event.
        private void DataSubscriber_NewMeasurements(object sender, EventArgs <ICollection <IMeasurement> > e)
        {
            // Gather statistics.
            Interlocked.Add(ref m_measurementCount, e.Argument.Count);

            // Queue the measurements up in the buffer.
            foreach (IMeasurement measurement in e.Argument)
            {
                if (m_channelIndexes.ContainsKey(measurement.ID))
                {
                    // Perform a rough per signal upsample if minimum sample rate is not met
                    if (m_sampleRate < MINIMUM_SAMPLE_RATE)
                    {
                        IMeasurement upsampledMeasurement;
                        double       frequency = measurement.Value;

                        for (int i = 0; i < MINIMUM_SAMPLE_RATE / m_sampleRate; i++)
                        {
                            upsampledMeasurement       = Measurement.Clone(measurement);
                            upsampledMeasurement.Value = Timbre.PureTone(frequency, i, 0, MINIMUM_SAMPLE_RATE) * Damping.Natural(i, MINIMUM_SAMPLE_RATE / m_sampleRate, MINIMUM_SAMPLE_RATE) * (Int16.MaxValue * 0.90D);
                            m_buffer.Enqueue(upsampledMeasurement);
                        }
                    }
                    else
                    {
                        m_buffer.Enqueue(measurement);
                    }
                }
            }

            // If we've managed to buffer a full second of data,
            // stop the timeout timer and start the dump timer.
            // The dump timer is sending measurements to the sound card
            // so change the playback state to playing.
            if (m_dumpTimer != null && !m_dumpTimer.IsRunning && m_buffer.Count / 2 > m_sampleRate)
            {
                if (m_timeoutTimer != null)
                {
                    m_timeoutTimer.Stop();
                }

                m_dumpTimer.Start();
                OnStateChanged(PlaybackState.Playing);
            }
        }
Ejemplo n.º 4
0
        private void botonValidar_Click(object sender, EventArgs e)
        {
            openFileDialog1.Title = "Seleccione XML de CAF";
            openFileDialog1.ShowDialog();
            string pathFileCaf = openFileDialog1.FileName;
            string xmlCAF      = File.ReadAllText(pathFileCaf, Encoding.GetEncoding("ISO-8859-1"));

            openFileDialog1.Title = "Seleccione XML de DTE";
            openFileDialog1.ShowDialog();
            string pathFileDTE = openFileDialog1.FileName;
            string xmlDTE      = File.ReadAllText(pathFileDTE, Encoding.GetEncoding("ISO-8859-1"));

            var    objetoDte  = XmlHandler.TryDeserializeFromString <DTE>(xmlDTE);
            string firmadelDD = objetoDte.Documento.TED.FirmaDigital.Firma;

            string privateKey = CAFHandler.GetPrivateKey(pathFileCaf);


            string firmaResultante = Timbre.Timbrar(objetoDte.Documento.TED.DatosBasicos.ToString(), privateKey);

            MessageBox.Show((firmaResultante == firmadelDD).ToString());
        }
Ejemplo n.º 5
0
        // Static Methods

        /// <summary>
        /// Computes a dual-tone multi-frequency sound for the given <see cref="DTMF"/> information and time.
        /// </summary>
        /// <param name="tone">Instance of the <see cref="DTMF"/> specifying the duration as well as the low and high frequencies of the dual-tone.</param>
        /// <param name="sampleIndex">Sample index (represents time anywhere from zero to full length of tone).</param>
        /// <param name="sampleRate">Number of samples per second.</param>
        /// <returns>The amplitude for the dual-tone at the given time.</returns>
        /// <remarks>
        /// This method computes an amplitude representing the acoustic pressure of a
        /// <see cref="DTMF"/> of the given frequency for the given time.
        /// </remarks>
        public static double ComputeFrequencies(DTMF tone, long sampleIndex, int sampleRate)
        {
            return((Timbre.PureTone(tone.LowFrequency, sampleIndex, 0, sampleRate) + Timbre.PureTone(tone.HighFrequency, sampleIndex, 0, sampleRate)) / 2);
        }
Ejemplo n.º 6
0
        public void updateHeader()
        {
            if (controller == null)
            {
                return;
            }
            this.updatingHeader = true;

            while (this.trackHeaderList.Count > this.controller.trackCount())
            {
                TrackHeader header = trackHeaderList.ElementAt(this.trackHeaderList.Count - 1);
                header.removeFromControl(this.Controls);
                this.trackHeaderList.Remove(header);
            }
            for (int i = 0; i < this.trackHeaderList.Count; i++)
            {
                Timbre t = controller.getTimbre(i);
                this.trackHeaderList[i].timbreBox.SelectedIndex = (int)t;
                int volume = controller.getVolume(i);
                this.trackHeaderList[i].volumeBar.Value = volume;
            }
            while (this.trackHeaderList.Count < this.controller.trackCount())
            {
                ComboBox cb = new ComboBox();
                cb.Location              = new System.Drawing.Point(0, HEADER_SIZE + this.track_height * this.trackHeaderList.Count);
                cb.Width                 = this.track_header - 2;
                cb.BackColor             = Color.FromArgb(255, 0, 0, 0);
                cb.ForeColor             = Color.FromArgb(255, 255, 255, 255);
                cb.FlatStyle             = FlatStyle.Flat;
                cb.DataSource            = Enum.GetNames(typeof(Timbre)).Select(s => s.Replace("_", " ")).ToArray();
                cb.SelectedValue         = controller.getTimbre(this.trackHeaderList.Count);
                cb.Name                  = Convert.ToString(this.trackHeaderList.Count);
                cb.SelectedIndexChanged += combobox_indexChanged;

                Button b = new Button();
                b.Location        = new System.Drawing.Point(5, HEADER_SIZE + this.track_height * this.trackHeaderList.Count + 26);
                b.Size            = new System.Drawing.Size(18, 18);
                b.BackColor       = System.Drawing.Color.Black;
                b.BackgroundImage = global::MusicaMinimalista.Properties.Resources.remove_icon;
                b.FlatStyle       = System.Windows.Forms.FlatStyle.Flat;
                b.Name            = Convert.ToString(this.trackHeaderList.Count);
                b.Click          += button_Click;

                TrackBar tb = new TrackBar();
                tb.BackColor = System.Drawing.Color.Black;
                tb.Location  = new System.Drawing.Point(55, HEADER_SIZE + this.track_height * this.trackHeaderList.Count + 26);
                System.Drawing.Size size = new System.Drawing.Size(80, 20);
                tb.MaximumSize   = size;
                tb.MinimumSize   = size;
                tb.Size          = size;
                tb.Maximum       = Track.MAX_VOLUME;
                tb.Value         = Track.MAX_VOLUME / 2;
                tb.Name          = Convert.ToString(this.trackHeaderList.Count);
                tb.TickStyle     = System.Windows.Forms.TickStyle.None;
                tb.ValueChanged += trackBar_valueChanged;

                TrackHeader header = new TrackHeader(cb, b, tb);
                this.trackHeaderList.Add(header);
                header.addToControl(this.Controls);
            }

            this.updatingHeader = false;
        }
Ejemplo n.º 7
0
 public override string ValeurNominale()
 => Timbre.ValeurEnString(ValeurTimbres);
Ejemplo n.º 8
0
 public void setSettingsFrom(Track track)
 {
     this.timbre = track.timbre;
     this.volume = track.volume;
 }
Ejemplo n.º 9
0
 public void setTimbre(Timbre timbre)
 {
     this.timbre = timbre;
 }
Ejemplo n.º 10
0
 public Track()
 {
     this.trackElemList = new SortedList <Duration, int>();
     this.timbre        = Timbre.Acoustic_Grand_Piano;
     this.volume        = MAX_VOLUME / 2;
 }
Ejemplo n.º 11
0
 public void setTimbre(Timbre timbre, int track)
 {
     this.tune.getTrack(track).setTimbre(timbre);
 }