31#ifndef _NICMIDI_SMPTE_H
32#define _NICMIDI_SMPTE_H
88 void SetOffset (
unsigned long n) { sample_offset = n; }
90 void SetOffset (
unsigned char h,
unsigned char m,
unsigned char s,
91 unsigned char f = 0,
unsigned char sf = 0);
93 unsigned long GetOffset ()
const {
return sample_offset; }
106 { sample_number = n; sample_number_dirty =
true; }
145 void SetTime (
unsigned char h,
unsigned char m,
unsigned char s,
146 unsigned char f = 0,
unsigned char sf = 0);
148 void SetHours (
unsigned char h) { hours = h; sample_number_dirty =
true; }
150 void SetMinutes (
unsigned char m) { minutes = m; sample_number_dirty =
true; }
152 void SetSeconds (
unsigned char s) { seconds = s; sample_number_dirty =
true; }
154 void SetFrames (
unsigned char f) { frames = f; sample_number_dirty =
true; }
156 void SetSubFrames (
unsigned char sf) { sub_frames = sf; sample_number_dirty =
true; }
241 static const unsigned char smpte_max_frames[];
243 static const double smpte_rates[];
245 static const long smpte_rates_long[];
247 static const double sample_rates[];
249 static const long sample_rates_long[];
255 unsigned long sample_number;
257 unsigned long sample_offset;
260 unsigned char minutes;
261 unsigned char seconds;
262 unsigned char frames;
263 unsigned char sub_frames;
264 bool sample_number_dirty;
Performs conversions between number of samples, milliseconds and smpte format (hours::minutes::second...
Definition: smpte.h:69
void SetSubFrames(unsigned char sf)
Loads the SMPTE with the given smpte subframes, leaving unchanged other parameters.
Definition: smpte.h:156
void AddSamples(long n)
Adds n samples.
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 ...
bool operator>=(SMPTE &s)
Greater or equal.
Definition: smpte.h:222
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.
void DecFrames()
Subtract one frame from smpte time.
Definition: smpte.h:202
void IncFrames()
Adds one frame to smpte time.
Definition: smpte.h:192
void DecSamples()
Subtracts one sample.
Definition: smpte.h:168
void SetHours(unsigned char h)
Loads the SMPTE with the given smpte hours, leaving unchanged other parameters.
Definition: smpte.h:148
int Compare(SMPTE &s)
Performs internal comparison between sample numbers.
unsigned char GetMinutes()
Returns the smpte minutes.
void DecHours()
Subtract one hour from smpte time.
Definition: smpte.h:196
unsigned char GetSeconds()
Returns the smpte seconds.
SAMPLE_RATE GetSampleRate() const
Returns the sample rate. See SAMPLE_RATE for avalaible sample rates formats.
Definition: smpte.h:84
unsigned long GetOffset() const
Returns the time offset (in samples).
Definition: smpte.h:93
void SetSMPTERate(SMPTE_RATE r)
Sets the smpte rate. See SMPTE_RATE for avalaible smpte rate formats.
Definition: smpte.h:77
void SetFrames(unsigned char f)
Loads the SMPTE with the given smpte frames, leaving unchanged other parameters.
Definition: smpte.h:154
unsigned char GetHours()
Returns the smpte hours.
bool operator!=(SMPTE &s)
Not equal.
Definition: smpte.h:214
unsigned char GetFrames()
Returns the smpte frames.
bool operator<=(SMPTE &s)
Lesser or equal.
Definition: smpte.h:220
bool operator==(SMPTE &s)
Equal.
Definition: smpte.h:212
void SetSampleRate(SAMPLE_RATE r)
Sets the sample rate. See SAMPLE_RATE for avalaible sample rates formats.
Definition: smpte.h:81
void AddMinutes(signed char m)
Adds minutes to smpte time.
void IncSeconds()
Adds one second to smpte time.
Definition: smpte.h:190
unsigned long GetSampleNumber()
Performs a smpte-to-samples or milliseconds-to-samples conversion.
void SetMinutes(unsigned char m)
Loads the SMPTE with the given smpte minutes, leaving unchanged other parameters.
Definition: smpte.h:150
void SetSampleNumber(unsigned long n)
Loads the SMPTE with the given amount of samples.
Definition: smpte.h:105
SMPTE_RATE GetSMPTERate() const
Returns the smpte rate. See SMPTE_RATE for avalaible smpte rate formats.
Definition: smpte.h:79
void AddSeconds(signed char s)
Adds seconds to smpte time.
void AddFrames(signed char f)
Adds frames to smpte time.
void SetMilliSeconds(unsigned long msecs)
Loads the SMPTE with the given time in milliseconds.
void IncSubFrames()
Adds one subframe to smpte time.
Definition: smpte.h:194
void IncMinutes()
Adds one minute to smpte time.
Definition: smpte.h:188
unsigned long GetMilliSeconds()
Performs a smpte-to-millisecond or sample-to-millisecond conversion.
void AddSubFrames(signed char sf)
Adds subframes to smpte time.
void SampleToTime()
Performs internal samples-to-smpte conversion.
unsigned char GetSubFrames()
Returns the smpte subframes.
void DecSeconds()
Subtract one second from smpte time.
Definition: smpte.h:200
bool operator<(SMPTE &s)
Lesser.
Definition: smpte.h:216
void TimeToSample()
Performs internal smpte-to-samples conversion.
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).
void IncSamples()
Adds one sample.
Definition: smpte.h:166
void DecMinutes()
Subtract one minute from smpte time.
Definition: smpte.h:198
void SetSeconds(unsigned char s)
Loads the SMPTE with the given smpte seconds, leaving unchanged other parameters.
Definition: smpte.h:152
void AddHours(signed char h)
Adds hours to smpte time.
void IncHours()
Adds one hour to smpte time.
Definition: smpte.h:186
bool operator>(SMPTE &s)
Greater.
Definition: smpte.h:218
void SetOffset(unsigned long n)
Sets an offset to be added to the current time, given the amount of samples.
Definition: smpte.h:88
void DecSubFrames()
Subtract one subframe from smpte time.
Definition: smpte.h:204
SMPTE_RATE
The smpte rates (determine the frames/sec rate)
Definition: smpte.h:39
SAMPLE_RATE
The sample rates (determine the sample/sec rate)
Definition: smpte.h:50
@ SMPTE_RATE_25
25 frames/sec
Definition: smpte.h:41
@ SMPTE_RATE_30DF
30 frames/sec drop
Definition: smpte.h:45
@ SMPTE_RATE_24
24 frames/sec
Definition: smpte.h:40
@ SMPTE_RATE_30
30 frames/sec
Definition: smpte.h:44
@ SMPTE_RATE_2997DF
29.97 frames/sec drop
Definition: smpte.h:43
@ SMPTE_RATE_2997
29.97 frames/sec
Definition: smpte.h:42
@ SAMPLE_47952
47952 samples/sec
Definition: smpte.h:54
@ SAMPLE_32000
32000 samples/sec
Definition: smpte.h:51
@ SAMPLE_44100
44100 samples/sec
Definition: smpte.h:53
@ SAMPLE_48000
48000 samples/sec
Definition: smpte.h:55
@ SAMPLE_48048
48048 samples/sec
Definition: smpte.h:56
@ SAMPLE_44056
44056 samples/sec
Definition: smpte.h:52