예제 #1
0
        public override void Process(float[] buffer)
        {
            StepEnvelope();

            ChannelVolume vol = GetVolume();
            float         interStep = (bFixed ? sampleHeader.SampleRate >> 10 : frequency) * mixer.SampleRateReciprocal;
            int           bufPos = 0; int samplesPerBuffer = mixer.SamplesPerBuffer;

            do
            {
                float samp = (mixer.Config.ROM[pos + sampleOffset] - 0x80) / (float)0x80;

                buffer[bufPos++] += samp * vol.LeftVol;
                buffer[bufPos++] += samp * vol.RightVol;

                interPos += interStep;
                int posDelta = (int)interPos;
                interPos -= posDelta;
                pos      += posDelta;
                if (pos >= sampleHeader.Length)
                {
                    if (sampleHeader.DoesLoop == 0x40000000)
                    {
                        pos = sampleHeader.LoopOffset;
                    }
                    else
                    {
                        Stopped = true;
                        break;
                    }
                }
            } while (--samplesPerBuffer > 0);
        }
예제 #2
0
 public void GetSongState(UI.SongInfoControl.SongInfo info)
 {
     info.Tempo = tempo;
     for (int i = 0; i < 0x10; i++)
     {
         Track track = tracks[i];
         if (track.Enabled)
         {
             UI.SongInfoControl.SongInfo.Track tin = info.Tracks[i];
             tin.Position  = Events[i][track.CurEvent].Offset;
             tin.Rest      = track.Rest;
             tin.Voice     = track.Voice;
             tin.Type      = track.Type;
             tin.Volume    = track.Volume;
             tin.PitchBend = track.GetPitch();
             tin.Panpot    = track.Panpot;
             if (track.NoteDuration != 0 && !track.Channel.Stopped)
             {
                 tin.Keys[0] = track.Channel.Key;
                 ChannelVolume vol = track.Channel.GetVolume();
                 tin.LeftVolume  = vol.LeftVol;
                 tin.RightVolume = vol.RightVol;
             }
             else
             {
                 tin.Keys[0]     = byte.MaxValue;
                 tin.LeftVolume  = 0f;
                 tin.RightVolume = 0f;
             }
         }
     }
 }
예제 #3
0
        public override void Process(float[] buffer)
        {
            StepEnvelope();

            ChannelVolume vol       = GetVolume();
            float         interStep = frequency * mixer.SampleRateReciprocal;

            int bufPos = 0; int samplesPerBuffer = mixer.SamplesPerBuffer;

            do
            {
                float samp = pat[pos];

                buffer[bufPos++] += samp * vol.LeftVol;
                buffer[bufPos++] += samp * vol.RightVol;

                interPos += interStep;
                int posDelta = (int)interPos;
                interPos -= posDelta;
                pos       = (pos + posDelta) & 0x7;
            } while (--samplesPerBuffer > 0);
        }