Problem with AddAudioInputChannel: "Index exceeds the number of array elements (0)."

1 view (last 30 days)
clear;
daqreset;
dev = daq.getDevices
session_snd = daq.createSession('directsound')
sndID = dev(3).ID
ch_snd = addAudioInputChannel(session_snd, sndID, 1)
I am trying to use a sound interface using the daq tool box. I wrote the following code for a preliminary test, but encountered the error in the title. I cannot find out what this message means. Could anyone help me to solve this problem?
  1 Comment
Walter Roberson
Walter Roberson on 9 Mar 2020
Your code pulls out sndID from device 3, but we do not know that device 3 is the same as the directsound device.
We also do not know that any directsound devices were found or that there are any channels available if they are.
The error hints that the driver for directsound was found but no devices with it.

Sign in to comment.

Answers (0)

Categories

Find more on Simultaneous and Synchronized Operations 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!