barelymusician/dsp/sample_player_test.cpp
// Tests that the sample data is played back as expected, when set to loop.
Tests that the sample data is played back as expected, when set to loop.
Tests that the sample data is played back as expected when set to loop .
TEST(SamplePlayerTest, SimplePlaybackLoop) {
  SamplePlayer sample_player(kSampleRate);
  sample_player.SetData(kData, kSampleRate, kDataLength);
  sample_player.SetLoop(true);
  const int kNumLoops = 10;
  for (int i = 0; i < kDataLength * kNumLoops; ++i) {
    EXPECT_DOUBLE_EQ(sample_player.Next(), kData[i % kDataLength])
        << "at index " << i;
  }
}
TEST ( SamplePlayerTest , SimplePlaybackLoop ) { SamplePlayer sample_player ( kSampleRate ) ; sample_player . SetData ( kData , kSampleRate , kDataLength ) ; sample_player . SetLoop ( true ) ; const int kNumLoops = 10 ; for ( int i = 0 ; i < kDataLength * kNumLoops ; ++ i ) { EXPECT_DOUBLE_EQ ( sample_player . Next ( ) , kData [ i % kDataLength ] ) << " " << i ; } }
Tests that the sample data is played back as expected, when set to loop.
Tests that the sample data is played back as expected when set to loop .