- smpte_wrap_t wrap = smpte_wrap_none;
-
-
- if (smpte.negative || SMPTE_IS_ZERO(smpte)) {
- smpte.negative = false;
- wrap = smpte_increment( smpte );
- smpte.negative = true;
- return wrap;
- } else if (SMPTE_IS_AROUND_ZERO(smpte) && smpte.subframes) {
- // We have a zero transition involving only subframes
- smpte.subframes = 80 - smpte.subframes;
- smpte.negative = true;
- return smpte_wrap_seconds;
- }
-
- switch (mtc_smpte_bits >> 5) {
- case MIDI::MTC_24_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 23;
- wrap = smpte_wrap_seconds;
- }
- break;
- case MIDI::MTC_25_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 24;
- wrap = smpte_wrap_seconds;
- }
- break;
- case MIDI::MTC_30_FPS_DROP:
- if ((smpte.minutes % 10) && (smpte.seconds == 0)) {
- if (smpte.frames <= 2) {
- smpte.frames = 29;
- wrap = smpte_wrap_seconds;
- }
- } else if (smpte.frames == 0) {
- smpte.frames = 29;
- wrap = smpte_wrap_seconds;
- }
- break;
- case MIDI::MTC_30_FPS:
- if (smpte.frames == 0) {
- smpte.frames = 29;
- wrap = smpte_wrap_seconds;
- }
- break;
- }
-
- if (wrap == smpte_wrap_seconds) {
- if (smpte.seconds == 0) {
- smpte.seconds = 59;
- wrap = smpte_wrap_minutes;
- if (smpte.minutes == 0) {
- smpte.minutes = 59;
- wrap = smpte_wrap_hours;
- smpte.hours--;
- }
- else {
- smpte.minutes--;
- }
- } else {
- smpte.seconds--;
- }
- } else {
- smpte.frames--;
- }
-
- if (SMPTE_IS_ZERO( smpte )) {
- smpte.negative = false;
- }
-
- return wrap;
-}