barelymusician/engine/instrument_test.cpp
// Tests that instrument stops all notes as expected.
Tests that instrument stops all notes as expected.
Tests that instrument stops all notes as expected .
TEST(InstrumentTest, StopAllNotes) {
  const std::vector<double> kPitches = {1.0, 2.0, 3.0};
  Instrument instrument(GetTestDefinition(), kFrameRate);
  for (const double pitch : kPitches) {
    EXPECT_FALSE(instrument.IsNoteOn(pitch));
  }
  for (const double pitch : kPitches) {
    instrument.StartNote(pitch, 1.0, 0.0);
    EXPECT_TRUE(instrument.IsNoteOn(1.0));
  }
  instrument.StopAllNotes(0.0);
  for (const double pitch : kPitches) {
    EXPECT_FALSE(instrument.IsNoteOn(pitch));
  }
}
TEST ( InstrumentTest , StopAllNotes ) { const std :: vector < double > kPitches = { 1.0 , 2.0 , 3.0 } ; Instrument instrument ( GetTestDefinition ( ) , kFrameRate ) ; for ( const double pitch : kPitches ) { EXPECT_FALSE ( instrument . IsNoteOn ( pitch ) ) ; } for ( const double pitch : kPitches ) { instrument . StartNote ( pitch , 1.0 , 0.0 ) ; EXPECT_TRUE ( instrument . IsNoteOn ( 1.0 ) ) ; } instrument . StopAllNotes ( 0.0 ) ; for ( const double pitch : kPitches ) { EXPECT_FALSE ( instrument . IsNoteOn ( pitch ) ) ; } }
Tests that instrument stops all notes as expected.
Tests that instrument stops all notes as expected .
// Start multiple notes. // Stop all notes.