示例#1
0
        /**
         * Methods
         */
        /// <summary>
        /// Initializes a new instance of the <see cref="RawMDCEncode"/> class.
        /// </summary>
        public RawMDCEncoder(MDCEncoder encoder)
        {
            this.encoder = encoder;

            this.firstOp      = 0x00;
            this.firstArg     = 0x00;
            this.firstUnitID  = 0x00;
            this.secondOp     = 0x00;
            this.secondArg    = 0x00;
            this.secondUnitID = 0x00;

            InitializeComponent();
        }
示例#2
0
        /**
         * Methods
         */
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            Decoder = new MDCDecoder(SAMPLE_RATE);
            Encoder = new MDCEncoder(SAMPLE_RATE);

            this.myID     = 0x0001;
            this.targetID = 0x0001;

            this.Encoder.NumberOfPreambles = 3;

            this.emergAck.Enabled = false;

            this.audioDeviceModal = new ConfigureAudioDevice();

            if (!File.Exists(Environment.CurrentDirectory + Path.DirectorySeparatorChar + XML_FILE))
            {
                this.myID = 0x0001;
                this.Encoder.NumberOfPreambles = 3;

                SaveXml();
            }
            else
            {
                LoadXml();
            }

            toolMDCID.Text             = this.myID.ToString("X4");
            numOfPreamblesTextBox.Text = this.Encoder.NumberOfPreambles.ToString();

            this.FormClosed += new FormClosedEventHandler(MainWindow_FormClosed);

            this.waveFormat   = new WaveFormat(SAMPLE_RATE, BITS_PER_SAMPLE, 1);
            this.waveProvider = new BufferedWaveProvider(waveFormat);
            this.waveProvider.DiscardOnBufferOverflow = true;

            InitializeInputAudio();
            InitializeOutputAudio();

            // hook decoder callback to display any decoded packets
            Decoder.DecoderCallback += new MDCDecoderCallback(Decoder_DecoderCallback);
        }