converting this c code to matlab

4 views (last 30 days)
Deepa
Deepa on 13 Dec 2018
Commented: Jan on 13 Dec 2018
Its urgent, converting this c code to matlab.
I am also trying but getting erros like
"Refernce to non-exitent"
icouldn't understand this issue.
please some1 help me to sort it out.
its more helpful, if u give converted matlab code also.
% typedef struct volCtrl
% {
% UINT8 u8CurrVolumeLevel;
% UINT8 u8CurrIDR_Min;
% UINT8 u8CurrIDR_Max;
% UINT8 u8IDR_MinPercent;
% UINT8 u8IDR_MaxPercent;
%
% }stVolCtrl;
% UINT32 SPU_VolumeControlGain()
% {
%
% /* Gain for neutral volume level */
% UINT32 u32BaselineGain = 0;
% UINT8 u8CurrIDR = 0;
% UINT8 u8StepGain = 0;
% UINT8 u8VolStep = 0;
% UINT32 u32VolGain = 0;
%
% gstVolCtrl.u8CurrIDR_Max = 80;
% gstVolCtrl.u8CurrIDR_Min = 20;
%
% gstVolCtrl.u8IDR_MaxPercent = 100;
% gstVolCtrl.u8IDR_MinPercent = 50;
%
%
% /* IDR calculate from Range */
% u8CurrIDR = gstVolCtrl.u8CurrIDR_Max - gstVolCtrl.u8CurrIDR_Min;
% /* Set Half of IDR as baseline Volume Gain */
% u32BaselineGain = u8CurrIDR >> 1;
%
% u8StepGain = (u32BaselineGain*gstVolCtrl.u8IDR_MaxPercent)/PERCENTAGE_VALUE;
% u8StepGain = u8StepGain /VOL_CTRL_DISC_STEPS_COUNT;
%
% if(gstVolCtrl.u8CurrVolumeLevel < VOLUME_STEP_BASELINE)
% {
% u8VolStep = VOLUME_STEP_BASELINE - gstVolCtrl.u8CurrVolumeLevel;
% u32VolGain = u8VolStep * u8StepGain;
% u32VolGain = u32BaselineGain - u32VolGain;
% }
% else
% {
% u8VolStep = gstVolCtrl.u8CurrVolumeLevel - VOLUME_STEP_BASELINE;
% u32VolGain = u8VolStep * u8StepGain;
% u32VolGain = u32BaselineGain + u32VolGain;
% }
% return u32VolGain;
% }
Thanks
Chinny
  3 Comments
Image Analyst
Image Analyst on 13 Dec 2018
Make it easy for someone to help you - at least give the code that's mostly translated so we only have to fix the little that's left, not ALL of it.
Jan
Jan on 13 Dec 2018
Your message is easier to read, if you do not include a blank line after each line of text or code.
erros like "Refernce to non-exitent" - Please post your code and the complete error message. Then it is much easier to fix the code.

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!