Skip to content

Commit

Permalink
review: accept roman's suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
leeebo committed Oct 10, 2024
1 parent 8cb1101 commit f7be607
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions host/class/uac/usb_host_uac/uac_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ static const char *TAG = "uac-host";
#define INTERFACE_FLAGS_OFFSET (16)
#define FLAG_INTERFACE_WAIT_USER_DELETE (1 << INTERFACE_FLAGS_OFFSET)
#define UAC_EP_DIR_IN (0x80)
#define VOLUME_DB_MIN (-127.9961f)
#define VOLUME_DB_MAX (127.9961f)

/**
* @brief UAC Device structure.
Expand Down Expand Up @@ -220,10 +222,10 @@ static float _volume_db_i16_2_f(int16_t volume_db)

static int16_t _volume_db_f_2_i16(float volume_db_f)
{
if (volume_db_f > 127.9961) {
volume_db_f = 127.9961;
} else if (volume_db_f < -127.9961) {
volume_db_f = -127.9961;
if (volume_db_f > VOLUME_DB_MAX) {
volume_db_f = VOLUME_DB_MAX;
} else if (volume_db_f < VOLUME_DB_MIN) {
volume_db_f = VOLUME_DB_MIN;
}
return (int16_t)(volume_db_f * 256);
}
Expand Down

0 comments on commit f7be607

Please sign in to comment.