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
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
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
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 Exchange 中查找有关 MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!