Beispiel #1
0
        public static float Calculate(MusicPcm aMusic, int aChannel, double aSampleCurrent)
        {
            float  a = aMusic.GetSample(aChannel, ( int )aSampleCurrent);
            float  b = aMusic.GetSample(aChannel, ( int )aSampleCurrent + 1);
            double positionDifference = aSampleCurrent - ( int )aSampleCurrent;

            return(( float )(a + (b - a) * positionDifference));
        }
 public SynthesizerPcm(MusicPcm aMusicPcm)
 {
     music        = aMusicPcm;
     timePosition = new SoundTime(44100, 0);
     timeElapsed  = new SoundTime(44100, 0);
     loopNumber1  = 0;
     loopNumber2  = 0;
 }
Beispiel #3
0
        public PlayerPcm(MusicPcm aMusic)
        {
            synthesizer = new SynthesizerPcm(aMusic);
            bufferArray = new float[2];

            delegateUpdate = UpdatePlay;

            volume = 0.5f;
        }
Beispiel #4
0
        public PlayerPcm(string aFilePath, MusicPcm aMusic)
        {
            FilePath    = aFilePath;
            music       = aMusic;
            synthesizer = new SynthesizerPcm(music.Waveform, music.Loop);
            bufferArray = new float[2];

            delegateUpdate = UpdatePlay;

            Volume = 0.5f;
            IsMute = false;
            IsLoop = true;
        }
Beispiel #5
0
        public void UpdateMesh()
        {
            try
            {
                MusicPcm lMusicPcm = ( MusicPcm )player.Music;

                if (lMusicPcm != null)
                {
                    RiffWaveRiff lRiffWaveRiff = new RiffWaveRiff(player.GetFilePath());
                    WaveformPcm  lWaveform     = new WaveformPcm(lRiffWaveRiff);
                    sbyte[]      lWaveformByte = lWaveform.data.sampleByteArray[0];

                    componentWaveform.Set(player, lWaveformByte);
                    componentWaveformSmall.Set(player, lWaveformByte);
                }

                componentWaveform.UpdateVertex(player, scale, positionWaveform);
            }
            catch (Exception e)
            {
                Logger.Warning("Execpstion:" + e);
            }
        }