Esempio n. 1
0
        public void pasteAtSelection()
        {
            if (!Clipboard.ContainsData("WaveFile"))
            {
                MessageBox.Show("No samples in clipboard.");
                return;
            }
            WaveFile data = (WaveFile)Clipboard.GetData("WaveFile");

            if (data == null)
            {
                MessageBox.Show("Error reading clipboard.");
                return;
            }
            //match number of channels
            data.samples  = DSP.matchChannels(data.samples, wave.channels);
            data.channels = wave.channels;

            //match sampling rate
            for (int channel = 0; channel < data.channels; channel++)
            {
                data.samples[channel] = DSP.resample(ref data.samples[channel], data.sampleRate, wave.sampleRate);
            }
            data.sampleRate = wave.sampleRate;

            wave.cutSelection(tSelStart, tSelEnd);
            wave.pasteSelection(tSelStart, data);
            updateReport(data.getNumSamples() + " samples pasted from the clipboard!");
            panelWave.SelectionEnd = tSelStart + data.getNumSamples();
            panelWave.setSamples(wave.samples);
            waveStop();
            invalidPlayer = true;
        }
Esempio n. 2
0
 public void changeChannels(short nChannels)
 {
     wave.samples  = DSP.matchChannels(wave.samples, nChannels);
     wave.channels = nChannels;
     updateStatusBar();
     panelWave.setSamples(wave.samples);
     panelWave.Invalidate();
 }