SDK example usb_device_audio_speaker: how is the codec volume changed?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

SDK example usb_device_audio_speaker: how is the codec volume changed?

跳至解决方案
1,295 次查看
lucasrangit
Contributor III

In the example usb_examples/usb_device_audio_speaker example (from TWR-K22F120M SDK version 2.4.1) how are the volume changes from the host over USB sent to the codec over I2C?

There is a USB audio codec task that prints "Set Cur Volume :" in the debug console when I adjust the volume but I don't see how/where the changes are applied to the codec. Setting a breakpoint in SGTL_SetVolume() is never hit. Shouldn't there be another I2C audio codec task?

Any hints would be appreciated.

标记 (3)
1 解答
1,129 次查看
FelipeGarcia
NXP Employee
NXP Employee

Hi Lucas,

Actually the  USB_Device_Audio_speaker demo it's not using SGTL_SetVolume() function.

As you can see in the sgtl5000_interface.c file, the demo only has a function to initialize the codec.

pastedImage_1.png

If you want to change the volume or mute the audio you will have to create your own functions, for example:

pastedImage_7.png

Then you call the function in USB_AudioCodecTask() in the appropriate line.

pastedImage_8.png

If you do that you will see now how the debug console hits the breakpoint when you make changes in the volume of your PC.

I hope this helps.

Best regards,

Felipe.

在原帖中查看解决方案

1 回复
1,130 次查看
FelipeGarcia
NXP Employee
NXP Employee

Hi Lucas,

Actually the  USB_Device_Audio_speaker demo it's not using SGTL_SetVolume() function.

As you can see in the sgtl5000_interface.c file, the demo only has a function to initialize the codec.

pastedImage_1.png

If you want to change the volume or mute the audio you will have to create your own functions, for example:

pastedImage_7.png

Then you call the function in USB_AudioCodecTask() in the appropriate line.

pastedImage_8.png

If you do that you will see now how the debug console hits the breakpoint when you make changes in the volume of your PC.

I hope this helps.

Best regards,

Felipe.