Exemplo n.º 1
0
        /// <inheritdoc />
        public Jacobi.Vst.Core.VstTimeInfo GetTimeInfo(Jacobi.Vst.Core.VstTimeInfoFlags filterFlags)
        {
            RaisePluginCalled("GetTimeInfo(" + filterFlags + ")");

              // our sample calculator performs:
              // Create TimeInfo class
              VstTimeInfo vstTimeInfo = new VstTimeInfo();

              // most common settings
              vstTimeInfo.SamplePosition = Parent.SampleOffset + Parent.BufferIncrement;
              vstTimeInfo.SampleRate = Parent.Settings.Rate;
              //
              filterFlags |= VstTimeInfoFlags.ClockValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.ClockValid)) {
            // should we floor this?
            int cp = MasterClock.SolvePPQ(Parent.SampleOffset, Parent.Settings).ClocksAtPosition.ToInt32();

            vstTimeInfo.SamplesToNearestClock = MasterClock.SolveSamples(cp * 24, Parent.Settings).Samples32Floor;
              }
              // NanoSecondsValid
              filterFlags |= VstTimeInfoFlags.NanoSecondsValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.NanoSecondsValid)) {
            vstTimeInfo.NanoSeconds = (Parent.SampleOffset / Parent.Settings.Rate) * billionth;
              }
              // TempoValid
              filterFlags |= VstTimeInfoFlags.TempoValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.TempoValid)) {
            vstTimeInfo.Tempo = Parent.Settings.Tempo;
              }
              // PpqPositionValid
              filterFlags |= VstTimeInfoFlags.PpqPositionValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.PpqPositionValid)) {
            vstTimeInfo.PpqPosition	= MasterClock.SolvePPQ(vstTimeInfo.SamplePosition, Parent.Settings).Frame;
              }
              // BarStartPositionValid
              filterFlags |= VstTimeInfoFlags.BarStartPositionValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.BarStartPositionValid)) {
            vstTimeInfo.BarStartPosition = MasterClock.SolvePPQ(vstTimeInfo.SamplePosition, Parent.Settings).Pulses; // * st.SamplesPerQuarter
              }
              // CyclePositionValid
              filterFlags |= VstTimeInfoFlags.CyclePositionValid;
              if (filterFlags.HasFlag(VstTimeInfoFlags.CyclePositionValid)) {
            vstTimeInfo.CycleStartPosition = Parent.SampleOffset;//st.SolvePPQ(Parent.SampleOffset,Parent.Settings).Frame;
            vstTimeInfo.CycleEndPosition = Parent.SampleOffset + Parent.CurrentSampleLength;
              }
              // TimeSignatureValid
              if (filterFlags.HasFlag(VstTimeInfoFlags.TimeSignatureValid)) {
            vstTimeInfo.TimeSignatureNumerator = Parent.Settings.TimeSignature.Numerator;
            vstTimeInfo.TimeSignatureDenominator = Parent.Settings.TimeSignature.Denominator;
              }
              // SmpteValid
              if (filterFlags.HasFlag(VstTimeInfoFlags.SmpteValid)) {
            vstTimeInfo.SmpteFrameRate = smpte_rate; /* 30 fps no-drop */
            vstTimeInfo.SmpteOffset	= 0;
            /* not quite valid */
              }
              vstTimeInfo.Flags = filterFlags;
              return vstTimeInfo;
        }