Skip to content

Commit

Permalink
more VS 2022 warning fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fdetro committed Jul 24, 2024
1 parent 52a986e commit fc0a6b7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v1.8.3

* more VS 2022 warning fixes

# v1.8.2

* fix VS 2022 warnings in as_double() tests
Expand Down
8 changes: 4 additions & 4 deletions tests/channel_voice_message_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -931,10 +931,10 @@ TEST_F(channel_voice_message, as_midi1_channel_voice_message)
// 98, 99, 100, and 101.
// * In MIDI 2.0 Protocol, Control Change 88 shall not be used for High Resolution Velocity. The Note On 16 bit
// Velocity value has a higher range than the MIDI 1.0 High Resolution Velocity controller and Note On combined.
for (midi::uint7_t index : { 0, 6, 32, 38, 88, 98, 99, 100, 101 })
for (auto index : { 0, 6, 32, 38, 88, 98, 99, 100, 101 })
{
EXPECT_FALSE(as_midi1_channel_voice_message(midi2_channel_voice_message_view{
make_midi2_control_change_message(9, 0, index, controller_value{ uint32_t{ 12345 } }) }));
make_midi2_control_change_message(9, 0, midi::uint7_t(index), controller_value{ uint32_t{ 12345 } }) }));
}
}

Expand Down Expand Up @@ -1074,10 +1074,10 @@ TEST_F(channel_voice_message, as_midi2_channel_voice_message)
// Instead they should transmit the new MIDI 2.0 Program Change message (see Section 7.4.9).
// * In MIDI 2.0 Protocol, Control Change 88 shall not be used for High Resolution Velocity. The Note On 16 bit
// Velocity value has a higher range than the MIDI 1.0 High Resolution Velocity controller and Note On combined.
for (midi::uint7_t index : { 0, 6, 32, 38, 88, 98, 99, 100, 101 })
for (auto index : { 0, 6, 32, 38, 88, 98, 99, 100, 101 })
{
EXPECT_FALSE(as_midi2_channel_voice_message(midi1_channel_voice_message_view{
make_midi1_control_change_message(9, 0, index, controller_value{ uint32_t{ 12345 } }) }));
make_midi1_control_change_message(9, 0, midi::uint7_t(index), controller_value{ uint32_t{ 12345 } }) }));
}
}

Expand Down
12 changes: 6 additions & 6 deletions tests/type_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -640,11 +640,11 @@ TEST(pitch_bend, as_double)
{
using namespace midi;

EXPECT_FLOAT_EQ(-1.0f, pitch_bend{ uint32_t{ 0x00000000 } }.as_double());
EXPECT_FLOAT_EQ(-0.5f, pitch_bend{ uint32_t{ 0x40000000 } }.as_double());
EXPECT_FLOAT_EQ(0.0f, pitch_bend{ uint32_t{ 0x80000000 } }.as_double());
EXPECT_FLOAT_EQ(0.5f, pitch_bend{ uint32_t{ 0xBFFFFFFF } }.as_double());
EXPECT_FLOAT_EQ(1.0f, pitch_bend{ uint32_t{ 0xFFFFFFFF } }.as_double());
EXPECT_DOUBLE_EQ(-1.0, pitch_bend{ uint32_t{ 0x00000000 } }.as_double());
EXPECT_DOUBLE_EQ(-0.5, pitch_bend{ uint32_t{ 0x40000000 } }.as_double());
EXPECT_DOUBLE_EQ(0.0, pitch_bend{ uint32_t{ 0x80000000 } }.as_double());
EXPECT_NEAR(0.5, pitch_bend{ uint32_t{ 0xBFFFFFFF } }.as_double(), 1e-8);
EXPECT_DOUBLE_EQ(1.0, pitch_bend{ uint32_t{ 0xFFFFFFFF } }.as_double());
}

//-----------------------------------------------
Expand Down Expand Up @@ -1687,7 +1687,7 @@ TEST(pitch_7_25, operator_plus_pitch_increment)
// underflow
EXPECT_EQ(0.f, (pitch_7_25{ 0.1f } + pitch_increment{ -1.5f }).as_float());
// overflow
EXPECT_FLOAT_EQ(128.f, (pitch_7_25{ 127.9 } + pitch_increment{ 0.2 }).as_double());
EXPECT_FLOAT_EQ(128.f, (pitch_7_25{ 127.9 } + pitch_increment{ 0.2 }).as_float());
}

//-----------------------------------------------
Expand Down

0 comments on commit fc0a6b7

Please sign in to comment.