Exemplo n.º 1
0
        internal ISampleProvider SupplyDoublePad(DoublePadVelocityType velocity, WaveFileReader file)
        {
            TimeSpan totalTimeSpan;

            totalTimeSpan = file.TotalTime; //get length of audio file

            //adjust starting point of file accordingly
            if (velocity.Equals(DoublePadVelocityType.High))
            {
                return(file.ToSampleProvider());
            }
            else if (velocity.Equals(DoublePadVelocityType.Middle))
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, (int)(totalTimeSpan.TotalSeconds * 0.70));
                return(file.ToSampleProvider().Skip(timeSpan));
            }
            else if (velocity.Equals(DoublePadVelocityType.Low))
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, (int)(totalTimeSpan.TotalSeconds * 0.40));
                return(file.ToSampleProvider().Skip(timeSpan));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 2
0
        public ISampleProvider SupplyDoublePad(DoublePadType type, DoublePadVelocityType velocity)
        {
            WaveFileReader waveFileReader;
            TimeSpan       totalTimeSpan;

            if (type.Equals(DoublePadType.PadOne)) //retrieve corresponding audio file
            {
                waveFileReader = new WaveFileReader(Host_Alpha.Properties.Resources.DP_1);
            }
            else if (type.Equals(DoublePadType.PadTwo))
            {
                waveFileReader = new WaveFileReader(Host_Alpha.Properties.Resources.DP_2);
            }
            else
            {
                return(null);
            }
            // waveFileReader = new WaveFileReader(Host_Alpha.Properties.Resources.test);



            totalTimeSpan = waveFileReader.TotalTime; //get length of audio file

            //adjust starting point of file accordingly
            if (velocity.Equals(DoublePadVelocityType.High))
            {
                return(waveFileReader.ToSampleProvider());
            }
            else if (velocity.Equals(DoublePadVelocityType.Middle))
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, (int)(totalTimeSpan.TotalSeconds * 0.70));
                return(waveFileReader.ToSampleProvider().Skip(timeSpan));
            }
            else if (velocity.Equals(DoublePadVelocityType.Low))
            {
                TimeSpan timeSpan = new TimeSpan(0, 0, (int)(totalTimeSpan.TotalSeconds * 0.40));
                return(waveFileReader.ToSampleProvider().Skip(timeSpan));
            }
            else
            {
                return(null);
            }
        }