issue with audioplayer/sound functions
이전 댓글 표시
Hi all,
I am running an automated test using Matlab. I have two functions, collectData and Analysis and a main script than calls these functions in that order. collectData plays a bunch of wav files using sound (also tried audioplayer) function (non-blocking function call) sequentially, make some measurements while the audio is being played to collect raw data. Analysis function analyses this data to generate results. The issue is that, sometimes Analysis function is called when collectData has not finished its execution completely and then Analysis function complains because it does not have complete data. I am guessing that sound/audioplayer has something to do with this but not sure exactly what. Could someone help me out here?
Thanks in advance, Alok
채택된 답변
추가 답변 (1개)
Daniel Shub
2011년 8월 14일
If you use an audioplayer object p to play the sounds then you could add:
while p.isplaying
end
to the end of collectData or at the beginning of Analysis. If you want to add it to the beginning of Analysis you will need to pass the audioplayer object as an argument.
카테고리
도움말 센터 및 File Exchange에서 Use COM Objects in MATLAB에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!