13
0

Tempo ramps - re-enabe audio-locked meter sections, fix more locking errors.

This commit is contained in:
nick_m 2016-03-02 03:19:21 +11:00
parent 77abc08d6f
commit 38df1063d3
3 changed files with 26 additions and 17 deletions

View File

@ -466,7 +466,7 @@ MeterDialog::init (const Timecode::BBT_Time& when, double bpb, double divisor, b
lock_styles.insert (make_pair (_("music"), PositionLockStyle::MusicTime)); lock_styles.insert (make_pair (_("music"), PositionLockStyle::MusicTime));
strings.push_back (_("music")); strings.push_back (_("music"));
lock_styles.insert (make_pair (_("audio"), PositionLockStyle::AudioTime)); lock_styles.insert (make_pair (_("audio"), PositionLockStyle::AudioTime));
strings.push_back (_("audio ur brane wul xplod")); strings.push_back (_("audio"));
set_popdown_strings (lock_style, strings); set_popdown_strings (lock_style, strings);
LockStyles::iterator ls; LockStyles::iterator ls;
for (ls = lock_styles.begin(); ls != lock_styles.end(); ++ls) { for (ls = lock_styles.begin(); ls != lock_styles.end(); ++ls) {

View File

@ -327,9 +327,6 @@ class LIBARDOUR_API TempoMap : public PBD::StatefulDestructible
void bbt_time (framepos_t when, Timecode::BBT_Time&); void bbt_time (framepos_t when, Timecode::BBT_Time&);
double tick_at_frame (framecnt_t frame) const;
framecnt_t frame_at_tick (double tick) const;
double beat_at_frame (framecnt_t frame) const; double beat_at_frame (framecnt_t frame) const;
framecnt_t frame_at_beat (double beat) const; framecnt_t frame_at_beat (double beat) const;
@ -421,6 +418,10 @@ private:
Timecode::BBT_Time beats_to_bbt_locked (double beats); Timecode::BBT_Time beats_to_bbt_locked (double beats);
double beat_at_frame_locked (framecnt_t frame) const; double beat_at_frame_locked (framecnt_t frame) const;
framecnt_t frame_at_beat_locked (double beat) const; framecnt_t frame_at_beat_locked (double beat) const;
double tick_at_frame_locked (framecnt_t frame) const;
framecnt_t frame_at_tick_locked (double tick) const;
framepos_t frame_time_locked (const Timecode::BBT_Time&);
friend class ::BBTTest; friend class ::BBTTest;
friend class ::FrameposPlusBeatsTest; friend class ::FrameposPlusBeatsTest;
friend class ::TempoTest; friend class ::TempoTest;

View File

@ -1405,7 +1405,7 @@ TempoMap::recompute_map (bool reassign_tempo_bbt, framepos_t end)
pr.second = where; pr.second = where;
meter->set_beat (pr); meter->set_beat (pr);
} else { } else {
meter->set_frame (frame_at_tick (meter->tick())); meter->set_frame (frame_at_tick_locked (meter->tick()));
} }
} }
} }
@ -1589,7 +1589,7 @@ TempoMap::beats_to_bbt_locked (double beats)
} }
double double
TempoMap::tick_at_frame (framecnt_t frame) const TempoMap::tick_at_frame_locked (framecnt_t frame) const
{ {
/* HOLD (at least) THE READER LOCK */ /* HOLD (at least) THE READER LOCK */
@ -1617,7 +1617,7 @@ TempoMap::tick_at_frame (framecnt_t frame) const
} }
framecnt_t framecnt_t
TempoMap::frame_at_tick (double tick) const TempoMap::frame_at_tick_locked (double tick) const
{ {
/* HOLD THE READER LOCK */ /* HOLD THE READER LOCK */
@ -1649,27 +1649,27 @@ double
TempoMap::beat_at_frame (framecnt_t frame) const TempoMap::beat_at_frame (framecnt_t frame) const
{ {
Glib::Threads::RWLock::ReaderLock lm (lock); Glib::Threads::RWLock::ReaderLock lm (lock);
return tick_at_frame (frame) / BBT_Time::ticks_per_beat; return tick_at_frame_locked (frame) / BBT_Time::ticks_per_beat;
} }
double double
TempoMap::beat_at_frame_locked (framecnt_t frame) const TempoMap::beat_at_frame_locked (framecnt_t frame) const
{ {
return tick_at_frame (frame) / BBT_Time::ticks_per_beat; return tick_at_frame_locked (frame) / BBT_Time::ticks_per_beat;
} }
framecnt_t framecnt_t
TempoMap::frame_at_beat (double beat) const TempoMap::frame_at_beat (double beat) const
{ {
Glib::Threads::RWLock::ReaderLock lm (lock); Glib::Threads::RWLock::ReaderLock lm (lock);
return frame_at_tick (beat * BBT_Time::ticks_per_beat); return frame_at_tick_locked (beat * BBT_Time::ticks_per_beat);
} }
framecnt_t framecnt_t
TempoMap::frame_at_beat_locked (double beat) const TempoMap::frame_at_beat_locked (double beat) const
{ {
return frame_at_tick (beat * BBT_Time::ticks_per_beat); return frame_at_tick_locked (beat * BBT_Time::ticks_per_beat);
} }
framepos_t framepos_t
@ -1685,7 +1685,15 @@ TempoMap::frame_time (const BBT_Time& bbt)
} }
Glib::Threads::RWLock::ReaderLock lm (lock); Glib::Threads::RWLock::ReaderLock lm (lock);
framepos_t const ret = frame_at_beat (bbt_to_beats_locked (bbt)); return frame_time_locked (bbt);;
}
framepos_t
TempoMap::frame_time_locked (const BBT_Time& bbt)
{
/* HOLD THE READER LOCK */
framepos_t const ret = frame_at_beat_locked (bbt_to_beats_locked (bbt));
return ret; return ret;
} }
@ -1742,7 +1750,7 @@ TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir)
{ {
Glib::Threads::RWLock::ReaderLock lm (lock); Glib::Threads::RWLock::ReaderLock lm (lock);
uint32_t ticks = (uint32_t) floor (tick_at_frame (fr) + 0.5); uint32_t ticks = (uint32_t) floor (tick_at_frame_locked (fr) + 0.5);
uint32_t beats = (uint32_t) floor (ticks / BBT_Time::ticks_per_beat); uint32_t beats = (uint32_t) floor (ticks / BBT_Time::ticks_per_beat);
uint32_t ticks_one_subdivisions_worth = (uint32_t)BBT_Time::ticks_per_beat / sub_num; uint32_t ticks_one_subdivisions_worth = (uint32_t)BBT_Time::ticks_per_beat / sub_num;
@ -1828,7 +1836,7 @@ TempoMap::round_to_beat_subdivision (framepos_t fr, int sub_num, RoundMode dir)
/* on the subdivision, do nothing */ /* on the subdivision, do nothing */
} }
} }
return frame_at_tick ((beats * BBT_Time::ticks_per_beat) + ticks); return frame_at_tick_locked ((beats * BBT_Time::ticks_per_beat) + ticks);
} }
framepos_t framepos_t
@ -1874,11 +1882,11 @@ TempoMap::round_to_type (framepos_t frame, RoundMode dir, BBTPointType type)
case Beat: case Beat:
if (dir < 0) { if (dir < 0) {
return frame_at_beat (floor (beat_at_framepos)); return frame_at_beat_locked (floor (beat_at_framepos));
} else if (dir > 0) { } else if (dir > 0) {
return frame_at_beat (ceil (beat_at_framepos)); return frame_at_beat_locked (ceil (beat_at_framepos));
} else { } else {
return frame_at_beat (floor (beat_at_framepos + 0.5)); return frame_at_beat_locked (floor (beat_at_framepos + 0.5));
} }
break; break;
} }