[gmpi] Re: Reqs 3.9. Time - opening arguments.1

  • From: RonKuper@xxxxxxxxxxxx
  • To: gmpi@xxxxxxxxxxxxx
  • Date: Thu, 5 Feb 2004 13:43:02 -0500

Sure.  There are actually 2 interfaces that deal with tempo-like time
versions.  In both cases, they are exposed by the host, and queried by the
plugin.  The plugin uses them to convert time values around during
streaming.

The older one is called IMfxTempoMap:

-----

interface IMfxTempoMap : public IUnknown
{
   // Convert between musical ticks and absolute milliseconds
   LONG TicksToMsecs( LONG lTicks ) ;
   LONG MsecsToTicks( LONG lMsecs ) ;

   // Get the PPQN or "timebase"
   int GetTicksPerQuarterNote() ;

   // Get the index of the tempo in at time 'dwTicks'
   int GetTempoIndexForTime( LONG lTicks ) ;

   // Get the number of tempo changes in the map
   int GetTempoCount() ;

   // Get a tempo change. Returns:
   // pdwTicks: the time of the tempo change
   // pnBPM100: the value of the tempo in 100ths of beats per minute (for
   // example, 100.05 BPM is returned as 10005).
   HRESULT GetTempoAt( int ix, LONG* plTicks, int* pnBPM100 ) ;
};

-----

The reason this is "old" is because it was orignally specs for MFX MIDI
plugins, where conversions needed only to be accurate to within a msec (the
minimum resolution of the Windows multimedia timer.)

When we did DXi, we replaced this with a more generic time converter
interface.  First, there's time struct:

-----

typedef enum MFX_TIME_FORMAT
{
   TF_NULL,          // no time value (used to clear a time value)
   TF_SECONDS,       // time in absolute seconds from song top (double)
   TF_SAMPLES,       // time in absolute samples from song top (LONGLONG)
   TF_TICKS,         // time in MIDI ticks @ 960 ppqn, from song top
(LONGLONG)
   TF_UTICKS,        // time in hi-res MIDI ticks @ 960*(2^16) ppqn, from
song top (LONGLONG)
   TF_MBT,           // time in measure:beat:ticks, from song top
   TF_FRAMES,        // time in SMPTE frames, including the projects SMPTE
offset
   TF_FRAMES_REL,    // time in SMPTE frames, relative to song top (no
offset applied)
   TF_SMPTE,         // time in SMPTE HMSF format, including the projects
SMPTE offset
   TF_SMPTE_REL      // time in SMPTE HMSF format, relative to song top (no
offset applied)
}
MFX_TIME_FORMAT;

typedef enum MFX_FPS
{
   FPS_24,           // 24 fps
   FPS_25,           // 25 fps
   FPS_2997,         // 29.97 fps
   FPS_2997_DROP,    // 29.97 fps, drop-frame
   FPS_30,           // 30 fps
   FPS_30_DROP       // 30 fps, drop-frame
}
MFX_FPS;

typedef struct MFX_TIME
{
   MFX_TIME_FORMAT   timeFormat;
   union
   {
      double      dSeconds;
      LONGLONG    llSamples;
      LONG        lTicks;
      LONGLONG    llUTicks;
      struct
      {
         int      nMeas;
         short    nBeat;
         short    nTick;
      }
      mbt;
      struct
      {
         short       fps;     // uses values from the enum MFX_FPS
         short       nSub400; // subframe in 400ths of a frame
         char        nFrame;
         char        nSec;
         char        nMin;
         char        nHour;
      }
      smpte;
      struct
      {
         short    fps;
         LONG     lFrame;
      }
      frames;
   };
}
MFX_TIME;

-----

Then there's a simple converter interface:

-----

interface IMfxTimeConverter : public IUnknown
{
   HRESULT ConvertMfxTime( MFX_TIME* pTime, MFX_TIME_FORMAT newFormat );
};

-----

The time converter is handy because you don't really need to care about
tempo if you don't want to.

-----Original Message-----
From: Tim Hockin [mailto:thockin@xxxxxxxxxx] 
Sent: Thursday, February 05, 2004 1:27 PM
To: gmpi@xxxxxxxxxxxxx
Subject: [gmpi] Re: Reqs 3.9. Time - opening arguments.1


On Thu, Feb 05, 2004 at 01:15:06PM -0500, RonKuper@xxxxxxxxxxxx wrote:
> FWIW, in DXi the host gives a tempo map to the plugin, even when 
> streaming.

Can you detail (for my info) what a Tempo Map tastes like?  What dat ais
encapsulated in that?  What does the struct/class look like?

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the following
rules:  Please stay on topic.  You are responsible for your own words.
Please respect your fellow subscribers.  Please do not redistribute anyone
else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

----------------------------------------------------------------------
Generalized Music Plugin Interface (GMPI) public discussion list
Participation in this list is contingent upon your abiding by the
following rules:  Please stay on topic.  You are responsible for your own
words.  Please respect your fellow subscribers.  Please do not
redistribute anyone else's words without their permission.

Archive: //www.freelists.org/archives/gmpi
Email gmpi-request@xxxxxxxxxxxxx w/ subject "unsubscribe" to unsubscribe

Other related posts: