NiCMidi 1.1.0
A MIDI library derived from J.D.Koftinoff jdksmidi
SMPTE Class Reference

Performs conversions between number of samples, milliseconds and smpte format (hours::minutes::seconds::frames::subframes). More...

#include <smpte.h>

Public Member Functions

 SMPTE (SMPTE_RATE smpte_rate=SMPTE_RATE_30, SAMPLE_RATE sample_rate=SAMPLE_48000)
 The constructor sets the smpte rate to SMPTE_30, the sample rate to SAMPLE_48000 and the offset time to 0. More...
 
void SetSMPTERate (SMPTE_RATE r)
 Sets the smpte rate. See SMPTE_RATE for avalaible smpte rate formats. More...
 
SMPTE_RATE GetSMPTERate () const
 Returns the smpte rate. See SMPTE_RATE for avalaible smpte rate formats. More...
 
void SetSampleRate (SAMPLE_RATE r)
 Sets the sample rate. See SAMPLE_RATE for avalaible sample rates formats. More...
 
SAMPLE_RATE GetSampleRate () const
 Returns the sample rate. See SAMPLE_RATE for avalaible sample rates formats. More...
 
void SetOffset (unsigned long n)
 Sets an offset to be added to the current time, given the amount of samples. More...
 
void SetOffset (unsigned char h, unsigned char m, unsigned char s, unsigned char f=0, unsigned char sf=0)
 Sets an offset to be added to the current time, given the smpte time parameters. More...
 
unsigned long GetOffset () const
 Returns the time offset (in samples). More...
 
unsigned long GetSampleNumber ()
 Performs a smpte-to-samples or milliseconds-to-samples conversion. More...
 
void SetSampleNumber (unsigned long n)
 Loads the SMPTE with the given amount of samples. More...
 
unsigned long GetMilliSeconds ()
 Performs a smpte-to-millisecond or sample-to-millisecond conversion. More...
 
void SetMilliSeconds (unsigned long msecs)
 Loads the SMPTE with the given time in milliseconds. More...
 
Conversion to smpte

These perform a samples-to-smpte or milliseconds-to-smpte conversion. You must first load the SMPTE with the number of samples (using SetSampleNumber()) or the number of milliseconds (using SetMilliSeconds()) to convert; then you can call these to get the converted smpte values.

Note
These are NOT const! May perform an internal conversion.
unsigned char GetHours ()
 Returns the smpte hours. More...
 
unsigned char GetMinutes ()
 Returns the smpte minutes. More...
 
unsigned char GetSeconds ()
 Returns the smpte seconds. More...
 
unsigned char GetFrames ()
 Returns the smpte frames. More...
 
unsigned char GetSubFrames ()
 Returns the smpte subframes. More...
 
Conversion from smpte

Use these to convert from smpte.

void SetTime (unsigned char h, unsigned char m, unsigned char s, unsigned char f=0, unsigned char sf=0)
 Loads the SMPTE with the given time (in smpte format). More...
 
void SetHours (unsigned char h)
 Loads the SMPTE with the given smpte hours, leaving unchanged other parameters. More...
 
void SetMinutes (unsigned char m)
 Loads the SMPTE with the given smpte minutes, leaving unchanged other parameters. More...
 
void SetSeconds (unsigned char s)
 Loads the SMPTE with the given smpte seconds, leaving unchanged other parameters. More...
 
void SetFrames (unsigned char f)
 Loads the SMPTE with the given smpte frames, leaving unchanged other parameters. More...
 
void SetSubFrames (unsigned char sf)
 Loads the SMPTE with the given smpte subframes, leaving unchanged other parameters. More...
 
To add, increment and decrement samples

These functions add, increment or decrement the current sample number.

void AddSamples (long n)
 Adds n samples. More...
 
void IncSamples ()
 Adds one sample. More...
 
void DecSamples ()
 Subtracts one sample. More...
 
To add, increment and decrement smpte

These functions add, increment or decrement smpte time parameters.

void AddHours (signed char h)
 Adds hours to smpte time. More...
 
void AddMinutes (signed char m)
 Adds minutes to smpte time. More...
 
void AddSeconds (signed char s)
 Adds seconds to smpte time. More...
 
void AddFrames (signed char f)
 Adds frames to smpte time. More...
 
void AddSubFrames (signed char sf)
 Adds subframes to smpte time. More...
 
void IncHours ()
 Adds one hour to smpte time. More...
 
void IncMinutes ()
 Adds one minute to smpte time. More...
 
void IncSeconds ()
 Adds one second to smpte time. More...
 
void IncFrames ()
 Adds one frame to smpte time. More...
 
void IncSubFrames ()
 Adds one subframe to smpte time. More...
 
void DecHours ()
 Subtract one hour from smpte time. More...
 
void DecMinutes ()
 Subtract one minute from smpte time. More...
 
void DecSeconds ()
 Subtract one second from smpte time. More...
 
void DecFrames ()
 Subtract one frame from smpte time. More...
 
void DecSubFrames ()
 Subtract one subframe from smpte time. More...
 
The operators (these compare the current time)
Note
All these are NOT const! May perform an internal conversion
bool operator== (SMPTE &s)
 Equal. More...
 
bool operator!= (SMPTE &s)
 Not equal. More...
 
bool operator< (SMPTE &s)
 Lesser. More...
 
bool operator> (SMPTE &s)
 Greater. More...
 
bool operator<= (SMPTE &s)
 Lesser or equal. More...
 
bool operator>= (SMPTE &s)
 Greater or equal. More...
 

Protected Member Functions

void SampleToTime ()
 Performs internal samples-to-smpte conversion. More...
 
void TimeToSample ()
 Performs internal smpte-to-samples conversion. More...
 
int Compare (SMPTE &s)
 Performs internal comparison between sample numbers. More...
 

Detailed Description

Performs conversions between number of samples, milliseconds and smpte format (hours::minutes::seconds::frames::subframes).

You can choose between several smpte formats and sample rates (see SMPTE_RATE and SAMPLE_RATE). Moreover you can set an initial time offset to be added to every value passed to the SMPTE.

Note
Many get functions are NOT const because they can perform internal conversions
Examples
test_win32_player.cpp.

Constructor & Destructor Documentation

◆ SMPTE()

SMPTE::SMPTE ( SMPTE_RATE  smpte_rate = SMPTE_RATE_30,
SAMPLE_RATE  sample_rate = SAMPLE_48000 
)

The constructor sets the smpte rate to SMPTE_30, the sample rate to SAMPLE_48000 and the offset time to 0.

Member Function Documentation

◆ SetSMPTERate()

void SMPTE::SetSMPTERate ( SMPTE_RATE  r)
inline

Sets the smpte rate. See SMPTE_RATE for avalaible smpte rate formats.

◆ GetSMPTERate()

SMPTE_RATE SMPTE::GetSMPTERate ( ) const
inline

Returns the smpte rate. See SMPTE_RATE for avalaible smpte rate formats.

◆ SetSampleRate()

void SMPTE::SetSampleRate ( SAMPLE_RATE  r)
inline

Sets the sample rate. See SAMPLE_RATE for avalaible sample rates formats.

◆ GetSampleRate()

SAMPLE_RATE SMPTE::GetSampleRate ( ) const
inline

Returns the sample rate. See SAMPLE_RATE for avalaible sample rates formats.

◆ SetOffset() [1/2]

void SMPTE::SetOffset ( unsigned long  n)
inline

Sets an offset to be added to the current time, given the amount of samples.

◆ SetOffset() [2/2]

void SMPTE::SetOffset ( unsigned char  h,
unsigned char  m,
unsigned char  s,
unsigned char  f = 0,
unsigned char  sf = 0 
)

Sets an offset to be added to the current time, given the smpte time parameters.

◆ GetOffset()

unsigned long SMPTE::GetOffset ( ) const
inline

Returns the time offset (in samples).

◆ GetSampleNumber()

unsigned long SMPTE::GetSampleNumber ( )

Performs a smpte-to-samples or milliseconds-to-samples conversion.

You must first load the SMPTE with the smpte values (using SetTime() or SetHours() ...) or the number of milliseconds (using SetMilliSeconds()) to convert; then you can call this to get the converted value.

Note
This is NOT const! May perform an internal conversion.

◆ SetSampleNumber()

void SMPTE::SetSampleNumber ( unsigned long  n)
inline

Loads the SMPTE with the given amount of samples.

You can then call GetHour(), GetMinutes() etc. to perform a samples-to-smpte conversion or GetMilliseconds() to perform a sample-to-milliseconds conversion.

◆ GetMilliSeconds()

unsigned long SMPTE::GetMilliSeconds ( )

Performs a smpte-to-millisecond or sample-to-millisecond conversion.

You must first load the SMPTE with the number of samples (using SetSampleNumber()) or with smpte values (using SetTime() or SetHours() ...) to convert; then you can call this to get the converted value.

Note
This is NOT const! May perform an internal conversion.

◆ SetMilliSeconds()

void SMPTE::SetMilliSeconds ( unsigned long  msecs)

Loads the SMPTE with the given time in milliseconds.

You can then call GetSampleNumber() to perform a milliseconds-to-sample conversion or GetHours(), GetMinutes() etc. to perform a milliseconds-to-smpte conversion.

Examples
test_win32_player.cpp.

◆ GetHours()

unsigned char SMPTE::GetHours ( )

Returns the smpte hours.

Examples
test_win32_player.cpp.

◆ GetMinutes()

unsigned char SMPTE::GetMinutes ( )

Returns the smpte minutes.

Examples
test_win32_player.cpp.

◆ GetSeconds()

unsigned char SMPTE::GetSeconds ( )

Returns the smpte seconds.

Examples
test_win32_player.cpp.

◆ GetFrames()

unsigned char SMPTE::GetFrames ( )

Returns the smpte frames.

Examples
test_win32_player.cpp.

◆ GetSubFrames()

unsigned char SMPTE::GetSubFrames ( )

Returns the smpte subframes.

◆ SetTime()

void SMPTE::SetTime ( unsigned char  h,
unsigned char  m,
unsigned char  s,
unsigned char  f = 0,
unsigned char  sf = 0 
)

Loads the SMPTE with the given time (in smpte format).

You can then call GetSampleNumber() to perform a smpte-to-sample conversion or GetMilliSeconds() to perform a smpte-to-milliseconds conversion.

◆ SetHours()

void SMPTE::SetHours ( unsigned char  h)
inline

Loads the SMPTE with the given smpte hours, leaving unchanged other parameters.

◆ SetMinutes()

void SMPTE::SetMinutes ( unsigned char  m)
inline

Loads the SMPTE with the given smpte minutes, leaving unchanged other parameters.

◆ SetSeconds()

void SMPTE::SetSeconds ( unsigned char  s)
inline

Loads the SMPTE with the given smpte seconds, leaving unchanged other parameters.

◆ SetFrames()

void SMPTE::SetFrames ( unsigned char  f)
inline

Loads the SMPTE with the given smpte frames, leaving unchanged other parameters.

◆ SetSubFrames()

void SMPTE::SetSubFrames ( unsigned char  sf)
inline

Loads the SMPTE with the given smpte subframes, leaving unchanged other parameters.

◆ AddSamples()

void SMPTE::AddSamples ( long  n)

Adds n samples.

◆ IncSamples()

void SMPTE::IncSamples ( )
inline

Adds one sample.

◆ DecSamples()

void SMPTE::DecSamples ( )
inline

Subtracts one sample.

◆ AddHours()

void SMPTE::AddHours ( signed char  h)

Adds hours to smpte time.

◆ AddMinutes()

void SMPTE::AddMinutes ( signed char  m)

Adds minutes to smpte time.

◆ AddSeconds()

void SMPTE::AddSeconds ( signed char  s)

Adds seconds to smpte time.

◆ AddFrames()

void SMPTE::AddFrames ( signed char  f)

Adds frames to smpte time.

◆ AddSubFrames()

void SMPTE::AddSubFrames ( signed char  sf)

Adds subframes to smpte time.

◆ IncHours()

void SMPTE::IncHours ( )
inline

Adds one hour to smpte time.

◆ IncMinutes()

void SMPTE::IncMinutes ( )
inline

Adds one minute to smpte time.

◆ IncSeconds()

void SMPTE::IncSeconds ( )
inline

Adds one second to smpte time.

◆ IncFrames()

void SMPTE::IncFrames ( )
inline

Adds one frame to smpte time.

◆ IncSubFrames()

void SMPTE::IncSubFrames ( )
inline

Adds one subframe to smpte time.

◆ DecHours()

void SMPTE::DecHours ( )
inline

Subtract one hour from smpte time.

◆ DecMinutes()

void SMPTE::DecMinutes ( )
inline

Subtract one minute from smpte time.

◆ DecSeconds()

void SMPTE::DecSeconds ( )
inline

Subtract one second from smpte time.

◆ DecFrames()

void SMPTE::DecFrames ( )
inline

Subtract one frame from smpte time.

◆ DecSubFrames()

void SMPTE::DecSubFrames ( )
inline

Subtract one subframe from smpte time.

◆ operator==()

bool SMPTE::operator== ( SMPTE s)
inline

Equal.

◆ operator!=()

bool SMPTE::operator!= ( SMPTE s)
inline

Not equal.

◆ operator<()

bool SMPTE::operator< ( SMPTE s)
inline

Lesser.

◆ operator>()

bool SMPTE::operator> ( SMPTE s)
inline

Greater.

◆ operator<=()

bool SMPTE::operator<= ( SMPTE s)
inline

Lesser or equal.

◆ operator>=()

bool SMPTE::operator>= ( SMPTE s)
inline

Greater or equal.

◆ SampleToTime()

void SMPTE::SampleToTime ( )
protected

Performs internal samples-to-smpte conversion.

◆ TimeToSample()

void SMPTE::TimeToSample ( )
protected

Performs internal smpte-to-samples conversion.

◆ Compare()

int SMPTE::Compare ( SMPTE s)
protected

Performs internal comparison between sample numbers.


The documentation for this class was generated from the following file: