Skip to content

Commit

Permalink
test: add uac_host_device_set_volume_db use case
Browse files Browse the repository at this point in the history
  • Loading branch information
leeebo committed Oct 9, 2024
1 parent 503e16b commit 12e66af
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion host/class/uac/usb_host_uac/test_app/main/test_host_uac.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,14 +619,22 @@ TEST_CASE("test uac tx writing", "[uac_host][tx]")
s_buffer += offset_size * freq_offsite_step;

uint8_t volume = 0;
int16_t volume_db = 0;
uint8_t actual_volume = 0;
bool mute = false;
bool actual_mute = false;
TEST_ASSERT_EQUAL(ESP_ERR_INVALID_STATE, uac_host_device_write(uac_device_handle, (uint8_t *)tx_buffer, tx_size, 0));
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_set_mute(uac_device_handle, mute));
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_get_mute(uac_device_handle, &actual_mute));
TEST_ASSERT_EQUAL(mute, actual_mute);
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_get_volume(uac_device_handle, &volume));
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_get_volume_db(uac_device_handle, &volume_db));
printf("Initial Volume db: %.3f \n", (float)volume_db / 256.0);
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_set_volume_db(uac_device_handle, 0));
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_get_volume_db(uac_device_handle, &volume_db));
TEST_ASSERT_EQUAL(0, volume_db);

TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_get_volume(uac_device_handle, &actual_volume));
volume = actual_volume;
printf("Volume: %d \n", volume);
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_resume(uac_device_handle));
TEST_ASSERT_EQUAL(ESP_OK, uac_host_device_write(uac_device_handle, (uint8_t *)tx_buffer, tx_size, 0));
Expand Down

0 comments on commit 12e66af

Please sign in to comment.