Hi Anton,
Unfortunately, I do not have a MacBook PC on my side to do the tests you mentioned.
Regarding the volume update, it is true that the example works at a fixed volume. However, you can modify that in USB_AudioCodecTask. If you debug the program, you will see that VOLUME_CHANGE_TASK is already called when you change the volume of your PC, however, that only prints the value through UART interface.
You will need to called this HAL_CODEC_SetVolume function as follows. Please keep in mind that volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. You will need to implement your own logic here.
if (g_UsbDeviceAudioSpeaker.codecTask & VOLUME_CHANGE_TASK)
{
#if USBCFG_AUDIO_CLASS_2_0
usb_echo("Set Cur Volume : %x\r\n",
(uint16_t)(g_UsbDeviceAudioSpeaker.curVolume20[1] << 8U) | g_UsbDeviceAudioSpeaker.curVolume20[0]);
#else
usb_echo("Set Cur Volume : %x\r\n",
(uint16_t)(g_UsbDeviceAudioSpeaker.curVolume[1] << 8U) | g_UsbDeviceAudioSpeaker.curVolume[0]);
#endif
HAL_CODEC_SetVolume(&codecHandle, kWM8960_HeadphoneLeft, volume);
g_UsbDeviceAudioSpeaker.codecTask &= ~VOLUME_CHANGE_TASK;
}
Hope it helps!
Best regards,
Felipe
-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!
- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------