SDK example usb_device_audio_speaker: how is the codec volume changed?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SDK example usb_device_audio_speaker: how is the codec volume changed?

Jump to solution
618 Views
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.

1 Solution
452 Views
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.

View solution in original post

1 Reply
453 Views
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.