Esempio n. 1
0
 private void saveToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (_waveOutDevice != null && _filtered != null)
     {
         if (saveFileDialog.ShowDialog() == DialogResult.OK)
         {
             WaveFileWriter.CreateWaveFile(saveFileDialog.FileName, _filtered.ToWaveProvider16());
         }
     }
     else
     {
         MessageBox.Show("Open an audio file first", "Error");
     }
 }
Esempio n. 2
0
        public ISampleProvider ProcessSample(ISampleProvider input)
        {
            Wave16toIeeeProvider ieeeprovider;

            if (!input.WaveFormat.Equals(Mixer.Instance.mixer.WaveFormat))
            {
                ieeeprovider = new Wave16toIeeeProvider(input.ToWaveProvider16());
                return(ieeeprovider.ToSampleProvider());
            }
            else
            {
                return(input);
            }
        }
Esempio n. 3
0
        /* Applies volume and pan parameters to outgoing samples*/
        private ISampleProvider ProcessInput(ISampleProvider input, int bankIndex, int padIndex)
        {
            VolumeSampleProvider VSP = new VolumeSampleProvider(input);

            VSP.Volume = samplerModel.song.banks[bankIndex].pads[padIndex].volume;
            PanningSampleProvider PSP = new PanningSampleProvider(VSP.ToWaveProvider16().ToSampleProvider());                                                  // <- this throws ArgumentException

            PSP.Pan = samplerModel.song.banks[bankIndex].pads[padIndex].pan;

            //ISampleProvider result = PSP.Skip(new TimeSpan(0, 0, (int) samplerModel.song.banks[bankIndex].pads[padIndex].startPoint));
            ISampleProvider result = PSP.Skip(samplerModel.song.banks[bankIndex].pads[padIndex].startPoint);
            //int duration = (int)(samplerModel.song.banks[bankIndex].pads[padIndex].endPoint - samplerModel.song.banks[bankIndex].pads[padIndex].startPoint);
            TimeSpan duration = (samplerModel.song.banks[bankIndex].pads[padIndex].endPoint - samplerModel.song.banks[bankIndex].pads[padIndex].startPoint);

            //result = result.Take(new TimeSpan(0,0,duration));
            result = result.Take(duration);

            return(result.ToWaveProvider16().ToSampleProvider());
        }
 public MonoStereoSwapProvider(ISampleProvider sampleProvider)
 {
     BackingSampleProvider = sampleProvider;
     MonoProvider          = new MonoToStereoProvider16(sampleProvider.ToWaveProvider16()).ToSampleProvider();
     StereoProvider        = new StereoToMonoProvider16(sampleProvider.ToWaveProvider16()).ToSampleProvider();
 }