converting this c code to matlab

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 件のコメント

Adam
Adam 2018 年 12 月 13 日
If its 'urgent' you could pay a consultant to do it, or Mathworks. Just asking for urgent ready-done code without putting in effort yourself doesn't go down very well though.
Image Analyst
Image Analyst 2018 年 12 月 13 日
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 2018 年 12 月 13 日
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.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Signal Processing Toolbox についてさらに検索

質問済み:

2018 年 12 月 13 日

コメント済み:

Jan
2018 年 12 月 13 日

Community Treasure Hunt

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

Start Hunting!

Translated by