diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2017-09-18 12:39:17 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2017-09-18 12:39:17 -0400 |
commit | 30b087ab3d28f1585987fa3f6ae006562ae192e3 (patch) | |
tree | 620ae0250b5d77f90a18f8c2b83be61e4fe7b0b5 /libs/ardour/test | |
parent | cb956e3e480716a3efd280a5287bdd7bee1cedc5 (diff) |
globally change all use of "frame" to refer to audio into "sample".
Generated by tools/f2s. Some hand-editing will be required in a few places to fix up comments related to timecode
and video in order to keep the legible
Diffstat (limited to 'libs/ardour/test')
-rw-r--r-- | libs/ardour/test/audio_region_read_test.cc | 8 | ||||
-rw-r--r-- | libs/ardour/test/audio_region_test.h | 2 | ||||
-rw-r--r-- | libs/ardour/test/bbt_test.cc | 2 | ||||
-rw-r--r-- | libs/ardour/test/combine_regions_test.cc | 4 | ||||
-rw-r--r-- | libs/ardour/test/framepos_minus_beats_test.cc | 46 | ||||
-rw-r--r-- | libs/ardour/test/framepos_plus_beats_test.cc | 56 | ||||
-rw-r--r-- | libs/ardour/test/framewalk_to_beats_test.cc | 58 | ||||
-rw-r--r-- | libs/ardour/test/interpolation_test.cc | 32 | ||||
-rw-r--r-- | libs/ardour/test/midi_clock_slave_test.cc | 10 | ||||
-rw-r--r-- | libs/ardour/test/midi_clock_slave_test.h | 34 | ||||
-rw-r--r-- | libs/ardour/test/playlist_read_test.cc | 2 | ||||
-rw-r--r-- | libs/ardour/test/profiling/lots_of_regions.cc | 4 | ||||
-rw-r--r-- | libs/ardour/test/tempo_test.cc | 146 |
13 files changed, 202 insertions, 202 deletions
diff --git a/libs/ardour/test/audio_region_read_test.cc b/libs/ardour/test/audio_region_read_test.cc index c7ae50afd5..5dbe337de5 100644 --- a/libs/ardour/test/audio_region_read_test.cc +++ b/libs/ardour/test/audio_region_read_test.cc @@ -38,7 +38,7 @@ AudioRegionReadTest::readTest () int const P = 100; - /* Simple read: 256 frames from start of region, no fades */ + /* Simple read: 256 samples from start of region, no fades */ _ar[0]->set_position (P); _ar[0]->set_length (1024); @@ -50,11 +50,11 @@ AudioRegionReadTest::readTest () buf[i] = 0; } - /* Offset read: 256 frames from 128 frames into the region, no fades */ + /* Offset read: 256 samples from 128 samples into the region, no fades */ _ar[0]->read_from_sources (_ar[0]->_sources, _ar[0]->_length, buf, P + 128, 256, 0); check_staircase (buf, 128, 256); - /* Simple read with a fade-in: 256 frames from start of region, with fades */ + /* Simple read with a fade-in: 256 samples from start of region, with fades */ _ar[0]->set_default_fade_in (); CPPUNIT_ASSERT_EQUAL (double (64), _ar[0]->_fade_in->back()->when); @@ -71,7 +71,7 @@ AudioRegionReadTest::readTest () CPPUNIT_ASSERT_EQUAL (i, int (buf[i])); } - /* Offset read: 256 frames from 128 frames into the region, with fades + /* Offset read: 256 samples from 128 samples into the region, with fades (though the fade should not affect it, as it is finished before the read starts) */ diff --git a/libs/ardour/test/audio_region_test.h b/libs/ardour/test/audio_region_test.h index 29ea51caa6..a9a65c64b5 100644 --- a/libs/ardour/test/audio_region_test.h +++ b/libs/ardour/test/audio_region_test.h @@ -42,7 +42,7 @@ protected: boost::shared_ptr<ARDOUR::AudioPlaylist> _audio_playlist; boost::shared_ptr<ARDOUR::Source> _source; /** 16 regions, of length 100, each referencing a source which is 4096 - * frames of a staircase waveform. + * samples of a staircase waveform. */ boost::shared_ptr<ARDOUR::Region> _r[16]; /** AudioRegion downcasts of _r[] */ diff --git a/libs/ardour/test/bbt_test.cc b/libs/ardour/test/bbt_test.cc index f1a8934905..b6f3c07d46 100644 --- a/libs/ardour/test/bbt_test.cc +++ b/libs/ardour/test/bbt_test.cc @@ -16,7 +16,7 @@ BBTTest::addTest () Tempo tempo(120, 4.0); Meter meter(4.0, 4.0); - /* no need to supply the frame for a new music-locked meter */ + /* no need to supply the sample for a new music-locked meter */ map.add_meter (meter, BBT_Time(2, 1, 0), 0, MusicTime); /* add some good stuff here */ diff --git a/libs/ardour/test/combine_regions_test.cc b/libs/ardour/test/combine_regions_test.cc index 5eee1d47d0..18bb79bee4 100644 --- a/libs/ardour/test/combine_regions_test.cc +++ b/libs/ardour/test/combine_regions_test.cc @@ -97,7 +97,7 @@ CombineRegionsTest::check_crossfade1 () void CombineRegionsTest::crossfadeTest1 () { - /* Two regions, both 256 frames in length, overlapping by 128 frames in the middle */ + /* Two regions, both 256 samples in length, overlapping by 128 samples in the middle */ _ar[0]->set_default_fade_in (); _ar[0]->set_default_fade_out (); @@ -201,7 +201,7 @@ CombineRegionsTest::check_crossfade2 () void CombineRegionsTest::crossfadeTest2 () { - /* Two regions, both 256 frames in length, overlapping by 128 frames in the middle */ + /* Two regions, both 256 samples in length, overlapping by 128 samples in the middle */ _ar[0]->set_default_fade_in (); _ar[0]->set_default_fade_out (); diff --git a/libs/ardour/test/framepos_minus_beats_test.cc b/libs/ardour/test/framepos_minus_beats_test.cc index fcf20e9238..5d2d95ac74 100644 --- a/libs/ardour/test/framepos_minus_beats_test.cc +++ b/libs/ardour/test/framepos_minus_beats_test.cc @@ -1,4 +1,4 @@ -#include "framepos_minus_beats_test.h" +#include "samplepos_minus_beats_test.h" #include "ardour/tempo.h" #include "timecode/bbt_time.h" @@ -16,22 +16,22 @@ FrameposMinusBeatsTest::singleTempoTest () int const sampling_rate = 48000; int const bpm = 120; - double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); + double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate); TempoMap map (sampling_rate); Tempo tempo (bpm); Meter meter (4, 4); - map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime); + map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime); map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, TempoSection::Constant, AudioTime); /* Subtract 1 beat from beat 3 of the first bar */ - framepos_t r = map.framepos_minus_qn (frames_per_beat * 2, Beats(1)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (frames_per_beat * 1)); + samplepos_t r = map.samplepos_minus_qn (samples_per_beat * 2, Beats(1)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (samples_per_beat * 1)); /* Subtract 4 beats from 3 beats in, to go beyond zero */ - r = map.framepos_minus_qn (frames_per_beat * 3, Beats(4)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (- frames_per_beat)); + r = map.samplepos_minus_qn (samples_per_beat * 3, Beats(4)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (- samples_per_beat)); } /* Test adding things that overlap a tempo change */ @@ -42,7 +42,7 @@ FrameposMinusBeatsTest::doubleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime); + map.replace_meter (map.first_meter(), meter, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime); /* 120bpm at bar 1, 240bpm at bar 4 @@ -56,7 +56,7 @@ FrameposMinusBeatsTest::doubleTempoTest () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 4 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 | @@ -71,16 +71,16 @@ FrameposMinusBeatsTest::doubleTempoTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_qn (24e3, Beats(1)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); + samplepos_t r = map.samplepos_minus_qn (24e3, Beats(1)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_qn (288e3 + 12e3, Beats(2)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); + r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_qn (288e3 + 12e3, Beats(2.5)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); + r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2.5)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3 - 12e3)); } /* Same as doubleTempoTest () except put a meter change at the same time as the @@ -95,7 +95,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () TempoMap map (sampling_rate); Meter meterA (4, 4); - map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), (framepos_t) 0, AudioTime); + map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), (samplepos_t) 0, AudioTime); /* 120bpm at bar 1, 240bpm at bar 4 @@ -109,7 +109,7 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -126,16 +126,16 @@ FrameposMinusBeatsTest::doubleTempoWithMeterTest () /* Now some tests */ /* Subtract 1 beat from 1|2 */ - framepos_t r = map.framepos_minus_qn (24e3, Beats(1)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (0)); + samplepos_t r = map.samplepos_minus_qn (24e3, Beats(1)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (0)); /* Subtract 2 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_qn (288e3 + 12e3, Beats(2)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3)); + r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3)); /* Subtract 2.5 beats from 4|2 (over the tempo change) */ - r = map.framepos_minus_qn (288e3 + 12e3, Beats(2.5)); - CPPUNIT_ASSERT_EQUAL (r, framepos_t (288e3 - 24e3 - 12e3)); + r = map.samplepos_minus_qn (288e3 + 12e3, Beats(2.5)); + CPPUNIT_ASSERT_EQUAL (r, samplepos_t (288e3 - 24e3 - 12e3)); } diff --git a/libs/ardour/test/framepos_plus_beats_test.cc b/libs/ardour/test/framepos_plus_beats_test.cc index d52717bb60..d567f4691c 100644 --- a/libs/ardour/test/framepos_plus_beats_test.cc +++ b/libs/ardour/test/framepos_plus_beats_test.cc @@ -1,4 +1,4 @@ -#include "framepos_plus_beats_test.h" +#include "samplepos_plus_beats_test.h" #include "ardour/tempo.h" #include "timecode/bbt_time.h" @@ -15,7 +15,7 @@ FrameposPlusBeatsTest::singleTempoTest () int const sampling_rate = 48000; int const bpm = 120; - double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); + double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate); TempoMap map (sampling_rate); Tempo tempo (bpm, 4.0); @@ -25,12 +25,12 @@ FrameposPlusBeatsTest::singleTempoTest () map.replace_tempo (map.first_tempo(), tempo, 0.0, 0, AudioTime); /* Add 1 beat to beat 3 of the first bar */ - framepos_t r = map.framepos_plus_qn (frames_per_beat * 2, Evoral::Beats(1)); - CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r); + samplepos_t r = map.samplepos_plus_qn (samples_per_beat * 2, Evoral::Beats(1)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (samples_per_beat * 3), r); - /* Add 4 beats to a -ve frame of 1 beat before zero */ - r = map.framepos_plus_qn (-frames_per_beat * 1, Evoral::Beats(4)); - CPPUNIT_ASSERT_EQUAL (framepos_t (frames_per_beat * 3), r); + /* Add 4 beats to a -ve sample of 1 beat before zero */ + r = map.samplepos_plus_qn (-samples_per_beat * 1, Evoral::Beats(4)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (samples_per_beat * 3), r); } /* Test adding things that overlap a tempo change */ @@ -55,7 +55,7 @@ FrameposPlusBeatsTest::doubleTempoTest () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 | @@ -70,16 +70,16 @@ FrameposPlusBeatsTest::doubleTempoTest () /* Now some tests */ /* Add 1 beat to 1|2 */ - framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1)); - CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r); + samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r); /* Add 2 beats to 3|4 (over the tempo change) */ - r = map.framepos_plus_qn (264e3, Evoral::Beats(2)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3, Evoral::Beats(2)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); /* Add 2.5 beats to 3|3|960 (over the tempo change) */ - r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); } /* Same as doubleTempoTest () except put a meter change at the same time as the @@ -108,7 +108,7 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -125,16 +125,16 @@ FrameposPlusBeatsTest::doubleTempoWithMeterTest () /* Now some tests */ /* Add 1 beat to 1|2 */ - framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1)); - CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r); + samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r); /* Add 2 beats to 3|4 (over the tempo change) */ - r = map.framepos_plus_qn (264e3, Evoral::Beats(2)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3, Evoral::Beats(2)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); /* Add 2.5 beats to 3|3|960 (over the tempo change) */ - r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); } /* Same as doubleTempoWithMeterTest () except use odd meter divisors @@ -164,7 +164,7 @@ FrameposPlusBeatsTest::doubleTempoWithComplexMeterTest () 120bpm 5/8 240bpm 0 beats 9 quarter note beats 12 quarter note beats 9 meter-based beat 15 meter-based beat - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses | 3 pulses | | | | | | 1.1 1.2 1.3 | 2.1 2.2 2.3 | 3.1 3.2 3.3 |4.14.24.34.44.5|5.15.2^5.35.45.5| @@ -181,16 +181,16 @@ FrameposPlusBeatsTest::doubleTempoWithComplexMeterTest () /* Now some tests */ /* Add 1 beat to 1|2 */ - framepos_t r = map.framepos_plus_qn (24e3, Evoral::Beats(1)); - CPPUNIT_ASSERT_EQUAL (framepos_t (48e3), r); + samplepos_t r = map.samplepos_plus_qn (24e3, Evoral::Beats(1)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (48e3), r); /* Add 2 beats to 5|1 (over the tempo change) */ - r = map.framepos_plus_qn (264e3, Evoral::Beats(2)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3, Evoral::Beats(2)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); /* Add 2.5 beats to 4|5 (over the tempo change) */ - r = map.framepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); - CPPUNIT_ASSERT_EQUAL (framepos_t (264e3 + 24e3 + 12e3), r); + r = map.samplepos_plus_qn (264e3 - 12e3, Evoral::Beats(2.5)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264e3 + 24e3 + 12e3), r); } diff --git a/libs/ardour/test/framewalk_to_beats_test.cc b/libs/ardour/test/framewalk_to_beats_test.cc index 8c430b9230..3bf45050a7 100644 --- a/libs/ardour/test/framewalk_to_beats_test.cc +++ b/libs/ardour/test/framewalk_to_beats_test.cc @@ -14,29 +14,29 @@ FramewalkToBeatsTest::singleTempoTest () int const sampling_rate = 48000; int const bpm = 120; - double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); + double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate); TempoMap map (sampling_rate); Tempo tempo (bpm, 4.0); Meter meter (4, 4); - map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime); + map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); + map.replace_tempo (map.tempo_section_at_sample (0), tempo, 0.0, 0, AudioTime); - /* Walk 1 beats-worth of frames from beat 3 */ - double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double(); + /* Walk 1 beats-worth of samples from beat 3 */ + double r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1).to_double(); CPPUNIT_ASSERT_EQUAL (1.0, r); - /* Walk 6 beats-worth of frames from beat 4 */ - r = map.framewalk_to_qn (frames_per_beat * 3, frames_per_beat * 6).to_double(); + /* Walk 6 beats-worth of samples from beat 4 */ + r = map.framewalk_to_qn (samples_per_beat * 3, samples_per_beat * 6).to_double(); CPPUNIT_ASSERT_EQUAL (6.0, r); - /* Walk 1.5 beats-worth of frames from beat 3 */ - r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1.5).to_double(); + /* Walk 1.5 beats-worth of samples from beat 3 */ + r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1.5).to_double(); CPPUNIT_ASSERT_EQUAL (1.5, r); - /* Walk 1.5 beats-worth of frames from beat 2.5 */ - r = map.framewalk_to_qn (frames_per_beat * 2.5, frames_per_beat * 1.5).to_double(); + /* Walk 1.5 beats-worth of samples from beat 2.5 */ + r = map.framewalk_to_qn (samples_per_beat * 2.5, samples_per_beat * 1.5).to_double(); CPPUNIT_ASSERT_EQUAL (1.5, r); } @@ -47,7 +47,7 @@ FramewalkToBeatsTest::doubleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); + map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); /* 120bpm at bar 1, 240bpm at bar 4 @@ -61,8 +61,8 @@ FramewalkToBeatsTest::doubleTempoTest () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames - 24e3 frames per beat 12e3 frames per beat + 0 samples 288e3 samples + 24e3 samples per beat 12e3 samples per beat 0 pulses 4 pulses | | | | | 1.1 1.2 1.3 1.4 2.1 2.2 2.3 2.4 3.1 3.2 3.3 3.4 4.1 4.2 4.3 4.4 5.1 @@ -71,7 +71,7 @@ FramewalkToBeatsTest::doubleTempoTest () */ Tempo tempoA (120); - map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime); + map.replace_tempo (map.tempo_section_at_sample (0), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240); map.add_tempo (tempoB, 12.0 / tempoB.note_type(), 0, MusicTime); @@ -104,7 +104,7 @@ FramewalkToBeatsTest::tripleTempoTest () TempoMap map (sampling_rate); Meter meter (4, 4); - map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); + map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); /* 120bpm at bar 1, 240bpm at bar 2, 160bpm at bar 3 @@ -119,7 +119,7 @@ FramewalkToBeatsTest::tripleTempoTest () 120bpm 240bpm 160bpm 0 beats 4 beats 8 beats - 0 frames 96e3 frames 144e3 frames + 0 samples 96e3 samples 144e3 samples 0 pulses 1 pulse 2 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 4.4 | @@ -127,7 +127,7 @@ FramewalkToBeatsTest::tripleTempoTest () */ Tempo tempoA (120, 4.0); - map.replace_tempo (map.tempo_section_at_frame (0), tempoA, 0.0, 0, AudioTime); + map.replace_tempo (map.tempo_section_at_sample (0), tempoA, 0.0, 0, AudioTime); Tempo tempoB (240, 4.0); map.add_tempo (tempoB, 4.0 / tempoB.note_type(), 0, MusicTime); Tempo tempoC (160, 4.0); @@ -144,28 +144,28 @@ FramewalkToBeatsTest::singleTempoMeterTest () int const sampling_rate = 48000; int const bpm = 120; - double const frames_per_beat = (60 / double (bpm)) * double (sampling_rate); + double const samples_per_beat = (60 / double (bpm)) * double (sampling_rate); TempoMap map (sampling_rate); Tempo tempo (bpm, 4.0); Meter meter (7, 8); - map.replace_meter (map.meter_section_at_frame (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); - map.replace_tempo (map.tempo_section_at_frame (0), tempo, 0.0, 0, AudioTime); + map.replace_meter (map.meter_section_at_sample (0), meter, BBT_Time (1, 1, 0), 0, AudioTime); + map.replace_tempo (map.tempo_section_at_sample (0), tempo, 0.0, 0, AudioTime); - /* Walk 1 qn beats-worth of frames from beat 3 */ - double r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1).to_double(); + /* Walk 1 qn beats-worth of samples from beat 3 */ + double r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1).to_double(); CPPUNIT_ASSERT_EQUAL (1.0, r); - /* Walk 6 qn beats-worth of frames from beat 4 */ - r = map.framewalk_to_qn (frames_per_beat * 3, frames_per_beat * 6).to_double(); + /* Walk 6 qn beats-worth of samples from beat 4 */ + r = map.framewalk_to_qn (samples_per_beat * 3, samples_per_beat * 6).to_double(); CPPUNIT_ASSERT_EQUAL (6.0, r); - /* Walk 1.5 qn beats-worth of frames from beat 3 */ - r = map.framewalk_to_qn (frames_per_beat * 2, frames_per_beat * 1.5).to_double(); + /* Walk 1.5 qn beats-worth of samples from beat 3 */ + r = map.framewalk_to_qn (samples_per_beat * 2, samples_per_beat * 1.5).to_double(); CPPUNIT_ASSERT_EQUAL (1.5, r); - /* Walk 1.5 qn beats-worth of frames from beat 2.5 */ - r = map.framewalk_to_qn (frames_per_beat * 2.5, frames_per_beat * 1.5).to_double(); + /* Walk 1.5 qn beats-worth of samples from beat 2.5 */ + r = map.framewalk_to_qn (samples_per_beat * 2.5, samples_per_beat * 1.5).to_double(); CPPUNIT_ASSERT_EQUAL (1.5, r); } diff --git a/libs/ardour/test/interpolation_test.cc b/libs/ardour/test/interpolation_test.cc index 7a91160e7a..c9fae7e64f 100644 --- a/libs/ardour/test/interpolation_test.cc +++ b/libs/ardour/test/interpolation_test.cc @@ -9,7 +9,7 @@ using namespace ARDOUR; void InterpolationTest::linearInterpolationTest () { - framecnt_t result = 0; + samplecnt_t result = 0; // cout << "\nLinear Interpolation Test\n"; // cout << "\nSpeed: 1/3"; @@ -25,7 +25,7 @@ InterpolationTest::linearInterpolationTest () linear.set_speed (1.0); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result); for (int i = 0; i < NUM_SAMPLES; i += INTERVAL) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -35,7 +35,7 @@ InterpolationTest::linearInterpolationTest () linear.set_speed (0.5); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result); for (int i = 0; i < NUM_SAMPLES; i += (INTERVAL / linear.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -45,14 +45,14 @@ InterpolationTest::linearInterpolationTest () linear.set_speed (0.2); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result); // cout << "\nSpeed: 0.02"; linear.reset(); linear.set_speed (0.02); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result); // cout << "\nSpeed: 0.002"; linear.reset(); @@ -60,14 +60,14 @@ InterpolationTest::linearInterpolationTest () linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES, input, output); linear.speed(); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * linear.speed()), result); // cout << "\nSpeed: 2.0"; linear.reset(); linear.set_speed (2.0); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES / 2, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 2 * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 2 * linear.speed()), result); for (int i = 0; i < NUM_SAMPLES / 2; i += (INTERVAL / linear.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -76,7 +76,7 @@ InterpolationTest::linearInterpolationTest () linear.set_speed (10.0); linear.set_target_speed (linear.speed()); result = linear.interpolate (0, NUM_SAMPLES / 10, input, output); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 10 * linear.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 10 * linear.speed()), result); for (int i = 0; i < NUM_SAMPLES / 10; i += (INTERVAL / linear.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -90,7 +90,7 @@ InterpolationTest::linearInterpolationTest () void InterpolationTest::cubicInterpolationTest () { - framecnt_t result = 0; + samplecnt_t result = 0; // cout << "\nCubic Interpolation Test\n"; // cout << "\nSpeed: 1/3"; @@ -107,7 +107,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result); for (int i = 0; i < NUM_SAMPLES; i += INTERVAL) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -118,7 +118,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result); for (int i = 0; i < NUM_SAMPLES; i += (INTERVAL / cubic.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -129,7 +129,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result); // cout << "\nSpeed: 0.02"; cubic.reset(); @@ -137,7 +137,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result); /* This one fails due too error accumulation cout << "\nSpeed: 0.002"; @@ -146,7 +146,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES, input, output); cubic.speed(); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES * cubic.speed()), result); */ // cout << "\nSpeed: 2.0"; @@ -155,7 +155,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES / 2, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES / 2, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 2 * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 2 * cubic.speed()), result); for (int i = 0; i < NUM_SAMPLES / 2; i += (INTERVAL / cubic.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } @@ -165,7 +165,7 @@ InterpolationTest::cubicInterpolationTest () cubic.set_target_speed (cubic.speed()); result = cubic.interpolate (0, NUM_SAMPLES / 10, input, output); CPPUNIT_ASSERT_EQUAL (result, cubic.interpolate (0, NUM_SAMPLES / 10, NULL, NULL)); - CPPUNIT_ASSERT_EQUAL ((framecnt_t)(NUM_SAMPLES / 10 * cubic.speed()), result); + CPPUNIT_ASSERT_EQUAL ((samplecnt_t)(NUM_SAMPLES / 10 * cubic.speed()), result); for (int i = 0; i < NUM_SAMPLES / 10; i += (INTERVAL / cubic.speed() +0.5)) { CPPUNIT_ASSERT_EQUAL (1.0f, output[i]); } diff --git a/libs/ardour/test/midi_clock_slave_test.cc b/libs/ardour/test/midi_clock_slave_test.cc index cea7a06ce9..93262483f1 100644 --- a/libs/ardour/test/midi_clock_slave_test.cc +++ b/libs/ardour/test/midi_clock_slave_test.cc @@ -10,24 +10,24 @@ void MIDIClock_SlaveTest::testStepResponse () { double speed = 1.0; - framepos_t position = 0; + samplepos_t position = 0; MIDI::Parser* parser = 0; TestSlaveSessionProxy *sess = (TestSlaveSessionProxy *) session; - framecnt_t period_size = 4096; + samplecnt_t period_size = 4096; sess->set_period_size (period_size); bandwidth = 1.0 / 60.0; - framepos_t start_time = 1000000; + samplepos_t start_time = 1000000; start (*parser, start_time); update_midi_clock (*parser, start_time); - for (framecnt_t i = 1; i<= 100 * period_size; i++) { + for (samplecnt_t i = 1; i<= 100 * period_size; i++) { // simulate jitter - framecnt_t input_delta = framecnt_t (one_ppqn_in_frames + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_frames); + samplecnt_t input_delta = samplecnt_t (one_ppqn_in_samples + 0.1 * (double(g_random_int()) / double (RAND_MAX)) * one_ppqn_in_samples); if (i % input_delta == 0) { update_midi_clock (*parser, start_time + i); diff --git a/libs/ardour/test/midi_clock_slave_test.h b/libs/ardour/test/midi_clock_slave_test.h index 0996c6360d..5cb40db169 100644 --- a/libs/ardour/test/midi_clock_slave_test.h +++ b/libs/ardour/test/midi_clock_slave_test.h @@ -28,11 +28,11 @@ namespace ARDOUR { class TestSlaveSessionProxy : public ISlaveSessionProxy { #define FRAME_RATE 44100 - framecnt_t _period_size; + samplecnt_t _period_size; double transport_speed; - framepos_t _transport_frame; - framepos_t _frame_time; + samplepos_t _transport_sample; + samplepos_t _sample_time; TempoMap *_tempo_map; Tempo tempo; @@ -41,8 +41,8 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy { public: TestSlaveSessionProxy() : transport_speed (1.0), - _transport_frame (0), - _frame_time (1000000), + _transport_sample (0), + _sample_time (1000000), _tempo_map (0), tempo (120, 4.0), meter (4.0, 4.0) @@ -53,23 +53,23 @@ class TestSlaveSessionProxy : public ISlaveSessionProxy { } // Controlling the mock object - void set_period_size (framecnt_t a_size) { _period_size = a_size; } - framecnt_t period_size () const { return _period_size; } + void set_period_size (samplecnt_t a_size) { _period_size = a_size; } + samplecnt_t period_size () const { return _period_size; } void next_period () { - _transport_frame += double(_period_size) * double(transport_speed); - _frame_time += _period_size; + _transport_sample += double(_period_size) * double(transport_speed); + _sample_time += _period_size; } // Implementation TempoMap& tempo_map () const { return *_tempo_map; } - framecnt_t frame_rate () const { return FRAME_RATE; } - framepos_t audible_frame () const { return _transport_frame; } - framepos_t transport_frame () const { return _transport_frame; } - pframes_t frames_since_cycle_start () const { return 0; } - framepos_t frame_time () const { return _frame_time; } - - void request_locate (framepos_t frame, bool with_roll = false) { - _transport_frame = frame; + samplecnt_t sample_rate () const { return FRAME_RATE; } + samplepos_t audible_sample () const { return _transport_sample; } + samplepos_t transport_sample () const { return _transport_sample; } + pframes_t samples_since_cycle_start () const { return 0; } + samplepos_t sample_time () const { return _sample_time; } + + void request_locate (samplepos_t sample, bool with_roll = false) { + _transport_sample = sample; } void request_transport_speed (const double speed) { transport_speed = speed; } diff --git a/libs/ardour/test/playlist_read_test.cc b/libs/ardour/test/playlist_read_test.cc index e87179fac6..f3003dfec9 100644 --- a/libs/ardour/test/playlist_read_test.cc +++ b/libs/ardour/test/playlist_read_test.cc @@ -83,7 +83,7 @@ PlaylistReadTest::singleReadTest () void PlaylistReadTest::overlappingReadTest () { - /* Overlapping read; _ar[0] and _ar[1] are both 1024 frames long, _ar[0] starts at 0, + /* Overlapping read; _ar[0] and _ar[1] are both 1024 samples long, _ar[0] starts at 0, _ar[1] starts at 128. We test a read from 0 to 256, which should consist of the start of _ar[0], with its fade in, followed by _ar[1]'s fade in (mixed with _ar[0] faded out with the inverse gain), and some more of _ar[1]. diff --git a/libs/ardour/test/profiling/lots_of_regions.cc b/libs/ardour/test/profiling/lots_of_regions.cc index 0e5a4c2ce6..afad346232 100644 --- a/libs/ardour/test/profiling/lots_of_regions.cc +++ b/libs/ardour/test/profiling/lots_of_regions.cc @@ -35,7 +35,7 @@ main (int argc, char* argv[]) /* Duplicate it a lot */ session->begin_reversible_command ("foo"); playlist->clear_changes (); - playlist->duplicate (region, region->last_frame() + 1, 1000); + playlist->duplicate (region, region->last_sample() + 1, 1000); session->add_command (new StatefulDiffCommand (playlist)); session->commit_reversible_command (); @@ -45,7 +45,7 @@ main (int argc, char* argv[]) /* And do it again */ session->begin_reversible_command ("foo"); playlist->clear_changes (); - playlist->duplicate (region, region->last_frame() + 1, 1000); + playlist->duplicate (region, region->last_sample() + 1, 1000); session->add_command (new StatefulDiffCommand (playlist)); session->commit_reversible_command (); } diff --git a/libs/ardour/test/tempo_test.cc b/libs/ardour/test/tempo_test.cc index c3ca93f86a..c8817028c0 100644 --- a/libs/ardour/test/tempo_test.cc +++ b/libs/ardour/test/tempo_test.cc @@ -28,7 +28,7 @@ TempoTest::recomputeMapTest48 () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -43,13 +43,13 @@ TempoTest::recomputeMapTest48 () map.add_meter (meterB, BBT_Time (4, 1, 0), 0, MusicTime); //map.dump (map._metrics, std::cout); list<MetricSection*>::iterator i = map._metrics.begin(); - CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ()); i = map._metrics.end(); --i; - CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), (*i)->sample ()); /* check the tempo section for expected result (no map) */ - const TempoSection& tsa (map.tempo_section_at_frame (0)); + const TempoSection& tsa (map.tempo_section_at_sample (0)); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_pulse (3.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 2.0, tsa.minute_at_pulse (1.5), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 3.0, tsa.minute_at_pulse (1.0), 1e-17); @@ -58,7 +58,7 @@ TempoTest::recomputeMapTest48 () CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5, tsa.pulse_at_minute (0.1 / 2.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.pulse_at_minute (0.1 / 3.0), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_frame (60.0 * sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_sample (60.0 * sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17); @@ -67,15 +67,15 @@ TempoTest::recomputeMapTest48 () /* quarter note */ - /* quarter note - frame*/ - CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), map.frame_at_quarter_note (12.0)); - CPPUNIT_ASSERT_EQUAL (framepos_t (144e3), map.frame_at_quarter_note (6.0)); - CPPUNIT_ASSERT_EQUAL (framepos_t (96e3), map.frame_at_quarter_note (4.0)); + /* quarter note - sample*/ + CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), map.sample_at_quarter_note (12.0)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (144e3), map.sample_at_quarter_note (6.0)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (96e3), map.sample_at_quarter_note (4.0)); - /* frame - quarter note*/ - CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, map.quarter_note_at_frame (288e3), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (6.0, map.quarter_note_at_frame (144e3), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, map.quarter_note_at_frame (96e3), 1e-17); + /* sample - quarter note*/ + CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, map.quarter_note_at_sample (288e3), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (6.0, map.quarter_note_at_sample (144e3), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (4.0, map.quarter_note_at_sample (96e3), 1e-17); /* pulse - internal minute based interface */ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minute_at_pulse_locked (map._metrics, 3.0), 1e-17); @@ -83,10 +83,10 @@ TempoTest::recomputeMapTest48 () /* tempo */ - /* tempo - frame */ - CPPUNIT_ASSERT_EQUAL (framepos_t (288e3), map.frame_at_tempo (tempoB)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_frame (288e3).note_types_per_minute(), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_frame (288e3 - 1).note_types_per_minute(), 1e-17); + /* tempo - sample */ + CPPUNIT_ASSERT_EQUAL (samplepos_t (288e3), map.sample_at_tempo (tempoB)); + CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_sample (288e3).note_types_per_minute(), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_sample (288e3 - 1).note_types_per_minute(), 1e-17); /* tempo - quarter note */ CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_quarter_note (24.0).note_types_per_minute(), 1e-17); @@ -126,7 +126,7 @@ TempoTest::recomputeMapTest44 () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -141,13 +141,13 @@ TempoTest::recomputeMapTest44 () map.add_meter (meterB, BBT_Time (4, 1, 0), 288e3, MusicTime); list<MetricSection*>::iterator i = map._metrics.begin(); - CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ()); i = map._metrics.end(); --i; - CPPUNIT_ASSERT_EQUAL (framepos_t (264600), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), (*i)->sample ()); /* check the tempo section for expected result (no map) */ - const TempoSection& tsa (map.tempo_section_at_frame (0)); + const TempoSection& tsa (map.tempo_section_at_sample (0)); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_pulse (3.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 2.0, tsa.minute_at_pulse (1.5), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1 / 3.0, tsa.minute_at_pulse (1.0), 1e-17); @@ -156,7 +156,7 @@ TempoTest::recomputeMapTest44 () CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5, tsa.pulse_at_minute (0.1 / 2.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.pulse_at_minute (0.1 / 3.0), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_frame (60.0 * sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tsa.minute_at_sample (60.0 * sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, tsa.minute_at_ntpm (240.0, 3.0), 1e-17); @@ -167,15 +167,15 @@ TempoTest::recomputeMapTest44 () /* quarter note */ - /* quarter note - frame */ - CPPUNIT_ASSERT_EQUAL (framepos_t (264600), map.frame_at_quarter_note (12.0)); - CPPUNIT_ASSERT_EQUAL (framepos_t (132300), map.frame_at_quarter_note (6.0)); - CPPUNIT_ASSERT_EQUAL (framepos_t (88200), map.frame_at_quarter_note (4.0)); + /* quarter note - sample */ + CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), map.sample_at_quarter_note (12.0)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (132300), map.sample_at_quarter_note (6.0)); + CPPUNIT_ASSERT_EQUAL (samplepos_t (88200), map.sample_at_quarter_note (4.0)); - /* frame - quarter note */ - CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0 * 4.0, map.quarter_note_at_frame (264600), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5 * 4.0, map.quarter_note_at_frame (132300), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0 * 4.0, map.quarter_note_at_frame (88200), 1e-17); + /* sample - quarter note */ + CPPUNIT_ASSERT_DOUBLES_EQUAL (3.0 * 4.0, map.quarter_note_at_sample (264600), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (1.5 * 4.0, map.quarter_note_at_sample (132300), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0 * 4.0, map.quarter_note_at_sample (88200), 1e-17); /* pulse - internal minute based interface */ CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minute_at_pulse_locked (map._metrics, 3.0), 1e-17); @@ -183,10 +183,10 @@ TempoTest::recomputeMapTest44 () /* tempo */ - /* tempo - frame */ - CPPUNIT_ASSERT_EQUAL (framepos_t (264600), map.frame_at_tempo (tempoB)); - CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_frame (264600).note_types_per_minute(), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_frame (264600 - 1).note_types_per_minute(), 1e-17); + /* tempo - sample */ + CPPUNIT_ASSERT_EQUAL (samplepos_t (264600), map.sample_at_tempo (tempoB)); + CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_sample (264600).note_types_per_minute(), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, map.tempo_at_sample (264600 - 1).note_types_per_minute(), 1e-17); /* tempo - quarter note */ CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, map.tempo_at_quarter_note (24.0).note_types_per_minute(), 1e-17); @@ -226,7 +226,7 @@ TempoTest::qnDistanceTestConstant () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | 1.1 1.2 1.3 1.4 | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -248,42 +248,42 @@ TempoTest::qnDistanceTestConstant () Tempo tempoF (123.7, 4.0); map.add_tempo (tempoF, 15.0, 0, MusicTime); Tempo tempoG (111.8, 4.0); - map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime); + map.add_tempo (tempoG, 0.0, (samplepos_t) 2 * 60 * sampling_rate, AudioTime); Meter meterB (3, 4); map.add_meter (meterB, BBT_Time (4, 1, 0), 288e3, MusicTime); list<MetricSection*>::iterator i = map._metrics.begin(); - CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ()); i = map._metrics.end(); --i; - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); --i; /* tempoF */ - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 15.0 * 4.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 15.0 * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 15.0 * 4.0), 1e-17); --i; /* tempoE */ - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 12.0 * 4.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 12.0 * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 12.0 * 4.0), 1e-17); --i; - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 9.0 * 4.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 9.0 * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 9.0 * 4.0), 1e-17); --i; /* tempoC */ - CPPUNIT_ASSERT_EQUAL (framecnt_t (6 * sampling_rate), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (6 * sampling_rate), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17); /* distance from beat 12.0 to 0.0 should be 6.0 seconds */ - CPPUNIT_ASSERT_EQUAL (framecnt_t (264600), map.frames_between_quarter_notes (0.0, 3.0 * 4.0)); - CPPUNIT_ASSERT_EQUAL (framecnt_t (-264600), map.frames_between_quarter_notes (3.0 * 4.0, 0.0)); - CPPUNIT_ASSERT_EQUAL (framecnt_t (396900), map.frames_between_quarter_notes (0.0, 24.0)); - CPPUNIT_ASSERT_EQUAL (framecnt_t (-396900), map.frames_between_quarter_notes (24.0, 0.0)); - CPPUNIT_ASSERT_EQUAL (framecnt_t (88200), map.frames_between_quarter_notes (2.0 * 4.0, 3.0 * 4.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (264600), map.samples_between_quarter_notes (0.0, 3.0 * 4.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (-264600), map.samples_between_quarter_notes (3.0 * 4.0, 0.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (396900), map.samples_between_quarter_notes (0.0, 24.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (-396900), map.samples_between_quarter_notes (24.0, 0.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (88200), map.samples_between_quarter_notes (2.0 * 4.0, 3.0 * 4.0)); } void TempoTest::qnDistanceTestRamp () @@ -306,7 +306,7 @@ TempoTest::qnDistanceTestRamp () 120bpm 240bpm 0 beats 12 beats - 0 frames 288e3 frames + 0 samples 288e3 samples 0 pulses 3 pulses | | | | | | | 1.1 1.2 1.3 1.4 | -no music- | 2.1 2.2 2.3.2.4 | 3.1 3.2 3.3 3.4 | 4.1 4.2 4.3 | @@ -327,35 +327,35 @@ TempoTest::qnDistanceTestRamp () Tempo tempoF (123.9, 4.0, 111.8); map.add_tempo (tempoF, 15.0, 0, MusicTime); Tempo tempoG (111.8, 4.0); - map.add_tempo (tempoG, 0.0, (framepos_t) 2 * 60 * sampling_rate, AudioTime); + map.add_tempo (tempoG, 0.0, (samplepos_t) 2 * 60 * sampling_rate, AudioTime); Meter meterB (3, 4); map.add_meter (meterB, BBT_Time (2, 1, 0), 288e3, AudioTime); map.recompute_map (map._metrics, 1); list<MetricSection*>::iterator i = map._metrics.begin(); - CPPUNIT_ASSERT_EQUAL (framepos_t (0), (*i)->frame ()); + CPPUNIT_ASSERT_EQUAL (samplepos_t (0), (*i)->sample ()); i = map._metrics.end(); --i; /* tempoG */ - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17); --i; - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 60.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 60.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 60.0), 1e-17); --i; /* tempoE */ - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 48.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 48.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 48.0), 1e-17); --i; - CPPUNIT_ASSERT_EQUAL ((*i)->frame(), map.frames_between_quarter_notes (0.0, 36.0)); + CPPUNIT_ASSERT_EQUAL ((*i)->sample(), map.samples_between_quarter_notes (0.0, 36.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL ((*i)->minute(), map.minutes_between_quarter_notes_locked (map._metrics, 0.0, 36.0), 1e-17); --i; /* tempoC */ - CPPUNIT_ASSERT_EQUAL (framecnt_t (6 * sampling_rate), map.frames_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); + CPPUNIT_ASSERT_EQUAL (samplecnt_t (6 * sampling_rate), map.samples_between_quarter_notes (0.0, (*i)->pulse() * 4.0)); CPPUNIT_ASSERT_DOUBLES_EQUAL (0.1, map.minutes_between_quarter_notes_locked (map._metrics, 0.0, (*i)->pulse() * 4.0), 1e-17); } @@ -370,13 +370,13 @@ TempoTest::rampTest48 () Tempo tempoA (77.0, 4.0, 217.0); Tempo tempoB (217.0, 4.0); map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); - map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime); + map.add_tempo (tempoB, 0.0, (samplepos_t) 60 * sampling_rate, AudioTime); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); /* 77bpm 217bpm - 0 frames 60 * sample rate frames + 0 samples 60 * sample rate samples | | | | | | *| | * | @@ -393,7 +393,7 @@ TempoTest::rampTest48 () */ TempoSection& tA = map.first_tempo(); - const TempoSection& tB = map.tempo_section_at_frame ((framepos_t) 60 * sampling_rate); + const TempoSection& tB = map.tempo_section_at_sample ((samplepos_t) 60 * sampling_rate); CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tA.minute_at_ntpm (217.0, 300.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (217.0, tA.tempo_at_minute (1.0).note_types_per_minute(), 1e-17); @@ -416,7 +416,7 @@ TempoTest::rampTest48 () CPPUNIT_ASSERT_DOUBLES_EQUAL (147.0, tA.tempo_at_pulse (tB.pulse() / 2.0).note_types_per_minute(), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL ((tB.pulse() - tA.pulse()) / 2.0, tA.pulse_at_ntpm (147.0, 0), 1e-17); - /* self-check frame at pulse 20 seconds in. */ + /* self-check sample at pulse 20 seconds in. */ const double target = 20.0 / 60.0; const double result = tA.minute_at_pulse (tA.pulse_at_minute (target)); CPPUNIT_ASSERT_DOUBLES_EQUAL (target, result, 1e-14); @@ -432,13 +432,13 @@ TempoTest::rampTest44 () Tempo tempoA (77.0, 4.0, 217.0); Tempo tempoB (217.0, 4.0); map.replace_tempo (map.first_tempo(), tempoA, 0.0, 0, AudioTime); - map.add_tempo (tempoB, 0.0, (framepos_t) 60 * sampling_rate, AudioTime); + map.add_tempo (tempoB, 0.0, (samplepos_t) 60 * sampling_rate, AudioTime); map.replace_meter (map.first_meter(), meterA, BBT_Time (1, 1, 0), 0, AudioTime); /* 77bpm 217bpm - 0 frames 60 * sample rate frames + 0 samples 60 * sample rate samples | | | | | | *| | * | @@ -455,7 +455,7 @@ TempoTest::rampTest44 () */ TempoSection& tA = map.first_tempo(); - const TempoSection& tB = map.tempo_section_at_frame ((framepos_t) 60 * sampling_rate); + const TempoSection& tB = map.tempo_section_at_sample ((samplepos_t) 60 * sampling_rate); CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, tA.minute_at_ntpm (217.0, 300.0), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (217.0, tA.tempo_at_minute (1.0).note_types_per_minute(), 1e-17); @@ -478,7 +478,7 @@ TempoTest::rampTest44 () CPPUNIT_ASSERT_DOUBLES_EQUAL (147.0, tA.tempo_at_pulse (tB.pulse() / 2.0).note_types_per_minute(), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL ((tB.pulse() - tA.pulse()) / 2.0, tA.pulse_at_ntpm (147.0, 0), 1e-17); - /* self-check frame at pulse 20 seconds in. */ + /* self-check sample at pulse 20 seconds in. */ const double target = 20.0 / 60.0; const double result = tA.minute_at_pulse (tA.pulse_at_minute (target)); CPPUNIT_ASSERT_DOUBLES_EQUAL (target, result, 1e-14); @@ -610,28 +610,28 @@ TempoTest::tempoFundamentalsTest () } } - CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->frames_per_quarter_note (sampling_rate), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->frames_per_note_type (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->samples_per_quarter_note (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tA->samples_per_note_type (sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (120.0, tA->quarter_notes_per_minute (), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (30.0, tA->pulses_per_minute (), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (48000.0, tB->frames_per_quarter_note (sampling_rate), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tB->frames_per_note_type (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (48000.0, tB->samples_per_quarter_note (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tB->samples_per_note_type (sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (60.0, tB->quarter_notes_per_minute (), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (15.0, tB->pulses_per_minute (), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (12000.0, tC->frames_per_quarter_note (sampling_rate), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tC->frames_per_note_type (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (12000.0, tC->samples_per_quarter_note (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (24000.0, tC->samples_per_note_type (sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (240.0, tC->quarter_notes_per_minute (), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (60.0, tC->pulses_per_minute (), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (9000.0, tD->frames_per_quarter_note (sampling_rate), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (18000.0, tD->frames_per_note_type (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (9000.0, tD->samples_per_quarter_note (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (18000.0, tD->samples_per_note_type (sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (320.0, tD->quarter_notes_per_minute (), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (80.0, tD->pulses_per_minute (), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (17560.975609756097, tE->frames_per_quarter_note (sampling_rate), 1e-17); - CPPUNIT_ASSERT_DOUBLES_EQUAL (23414.634146341465, tE->frames_per_note_type (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (17560.975609756097, tE->samples_per_quarter_note (sampling_rate), 1e-17); + CPPUNIT_ASSERT_DOUBLES_EQUAL (23414.634146341465, tE->samples_per_note_type (sampling_rate), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (164.0, tE->quarter_notes_per_minute (), 1e-17); CPPUNIT_ASSERT_DOUBLES_EQUAL (41.0, tE->pulses_per_minute (), 1e-17); } |