soundsc

7 visualizaciones (últimos 30 días)
Stephen
Stephen el 1 de Jun. de 2012
Comentada: EkoSusatio el 22 de Sept. de 2015
So, I noticed that you can't cntr + c out of the sound playback from soundsc. Is there a way to kill the horrible noises I'm making? Thanks
  3 comentarios
Kye Taylor
Kye Taylor el 1 de Jun. de 2012
Turn off your speakers :)
I'm also interested in how one might kill this process...
EkoSusatio
EkoSusatio el 22 de Sept. de 2015
Give clear all in command windows, the noises will stop

Iniciar sesión para comentar.

Respuesta aceptada

Daniel Shub
Daniel Shub el 1 de Jun. de 2012
The reason you cannot cancel the sound with crtl+c is that MATLAB plays the sound asynchronously. This means you can do other things while the sound is playing. If you want crtl+c to cancel the sound, you need to make SOUNDSC perform play blocking. If all you want is a way to stop the sound, then you need SOUNDSC to return a handle to the sound playing object. Both can be accomplished by deleting the PLAYSND mex file. This will force SOUNDSC to use an AUDIOPLAYER object. AUDIOPLAYER objects can be used to provide play blocking as well as provide a handle for stopping sound once playback has started.
If you also look at the source code for SOUNDSC you will see that it calls SOUND which calls PLAYSND. PLAYSND is either a mex (Windows) or an m file (Linux). The m file version uses AUDIOPLAYER, so it should be trivial to create your own playblocking version of SOUNDSC
  1 comentario
Stephen
Stephen el 2 de Jun. de 2012
thanks man

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by