Beispiel #1
0
 /*
  * Constructor that creates a wave from a file
  *
  * params:
  * fs - File stream to read from
  * main - reference to the main container
  */
 public unsafe WaveViewer(MainContainer main, FileStream fs)
 {
     readWaveHeader(fs);
     samples     = new byte[dataLen];
     numSamples  = (int)(dataLen * 8 / sampleBit);
     fs.Position = 44;
     fs.Read(samples, 0, (int)dataLen);
     hScale      = numSamples <= this.Width ? this.Width : (numSamples + this.Width) / 2;
     this.main   = main;
     startSample = 0;
     endSample   = hScale;
     selStart    = 0;
     selEnd      = 0;
     desel       = false;
     InitializeComponent();
 }
Beispiel #2
0
        private float[] filterResult;                                                                           // store for combining filtered result

        /*
         *  Constructor that creates a blank wave.
         *
         *  params:
         *  sr - Desired sampling rate for the wave
         *  q - Quantization level of audio
         *  main - reference to main container
         */
        public unsafe WaveViewer(MainContainer main, int sr, short q)
        {
            recDlg     = DlgShow(sr, q);
            dataLen    = GetLength();
            numSamples = sr;
            sampleBit  = q;
            dataLen    = (uint)(numSamples * sampleBit / 8);
            saveBuffer = GetSaveBuffer();
            samples    = new byte[dataLen];
            for (int i = 0; i < samples.Length; i++)
            {
                samples[i] = (byte)(sampleBit == 8 ? 128 : 0);
            }
            sampleRate  = sr;
            startSample = 0;
            hScale      = numSamples <= this.Width ? this.Width : (numSamples + this.Width) / 2;
            endSample   = hScale;
            this.main   = main;
            channels    = 1;
            selStart    = 0;
            selEnd      = 0;
            desel       = false;
            InitializeComponent();
        }
Beispiel #3
0
        private MainContainer caller; // Reference to the main container

        public NewWave(MainContainer caller)
        {
            this.caller = caller;
            InitializeComponent();
        }