How can I detect audio device changes?

조회 수: 8(최근 30일)
Mattias Arlbrant
Mattias Arlbrant 2021년 3월 17일
댓글: Mattias Arlbrant 2021년 3월 22일
I would like to detect changes to the list of connected audio devices WITHOUT restarting matlab.
This does NOT work (= does NOT show devices connected/disconnected after matlab was started):
deviceReader = audioDeviceReader;
devices = getAudioDevices(deviceReader)
It seems like the only way to detect if, for example a soundcard is connected, is to restart matlab. I am using a GUI made in appDesigner and also deployed version of it, and restarting takes a incredibly long time. This makes it extremely frustrating to work with the audio application I made, since I frequently need to switch audio devices.
Have I missed something? Is there a way to "rescan" the connected audio devices?

채택된 답변

Brian Hemmat
Brian Hemmat 2021년 3월 19일
Hi Mattias,
Starting in R2020b, you can use audiodevreset to refresh the list of audio devices MATLAB can interact with:
  댓글 수: 1
Mattias Arlbrant
Mattias Arlbrant 2021년 3월 22일
Thank you! Exactly what I was looking for!

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

추가 답변(0개)




Community Treasure Hunt

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

Start Hunting!

Translated by