From 12e66af86858da4647ea49ce9d74540ee6a318bc Mon Sep 17 00:00:00 2001 From: Li Bo Date: Wed, 9 Oct 2024 17:44:24 +0800 Subject: [PATCH] test: add uac_host_device_set_volume_db use case --- .../uac/usb_host_uac/test_app/main/test_host_uac.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/host/class/uac/usb_host_uac/test_app/main/test_host_uac.c b/host/class/uac/usb_host_uac/test_app/main/test_host_uac.c index 3004e540..2f9134fc 100644 --- a/host/class/uac/usb_host_uac/test_app/main/test_host_uac.c +++ b/host/class/uac/usb_host_uac/test_app/main/test_host_uac.c @@ -619,6 +619,7 @@ 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; @@ -626,7 +627,14 @@ TEST_CASE("test uac tx writing", "[uac_host][tx]") 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));