필터 지우기
필터 지우기

How can i set block parameters from m-file?

조회 수: 1 (최근 30일)
Sergio
Sergio 2013년 10월 31일
댓글: Sergio 2013년 11월 12일
Hi,
I´m using simulink dsp toolbox in order to record and reproduce audio and i need to let the user of my future program, to be able to select the Device to record/reproduce from a GUI.
Therefore it has to be handled from an m-file.
I tried the following without success:
My intention here was to see were the value was stored in order to change it later.
- ParameterValue = get_param('Model/Subsystem/From Audio Device','DialogParameters')
- ParameterValue = get_param('Model/Subsystem/From Audio Device','ObjectParameters')
Both commands result in a structure with multiple parameters but i could not find where the value of the currently selected sound card is.
I need to be able to set "From Audio Device" and "To Audio Device" Device name according to the available sound cards installed. Ideas?
Thanks in advance!
PD: I need to use simulink blocks, so no dsp.audiorecorder, or DAQ to stream audio.

채택된 답변

Puneet Rana
Puneet Rana 2013년 11월 12일
Hello Sergio,
'DeviceName' is the property of the 'To Audio Device' and 'From Audio Device' that contains the currently selected audio device in that block. You can access it using:
>> get_param('Model/From Audio Device', 'DeviceName')
ans =
Default
>> get_param('Model/To Audio Device', 'DeviceName')
ans =
Default
and similarly set the property using set_param.
Another tip: Since you mentioned that you will be using a GUI where the user can select an audio device from a list, it may be a good idea to populate that list using 'dspAudioDeviceInfo' function. This function returns a list of all audio devices on the current computer, it would be the same as the drop-down list in 'From Audio Device' or 'To Audio Device' blocks.
  댓글 수: 1
Sergio
Sergio 2013년 11월 12일
Thank you very much Punnet, just what i was looking for! Great work!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by