JavaFX support for microphone audio capture

怎甘沉沦 提交于 2019-12-08 07:51:42

问题


I am evaluating JavaFX for a project at work, but it appears that the platform does not support capturing audio using a microphone. I was under the impression that with JavaFX, one had access to "all of Java". If you can record using a microphone and an applet, why can't the same be accomplished using JavaFX? Are there workarounds to this limitation?

Thanks.


回答1:


There's no limitation - you are right in saying that it has access to "all of Java". Assuming that there is a microphone / sound capture API for Java, then you can just "call down" to it from JavaFX code.

JavaFX is essentially a DSL for GUIs. If you already have a well-designed applet which fits your requirement, then there should be no reason why the "view" component of the applet cannot be replaced with JavaFX.




回答2:


You will need to use the JavaSound API from JavaFX.

Better yet create a set of Java class that captures the sound that you can call from FX.

Look at the AsyncTask inteface in JavaFX. Because JavaFX has no support for multithreading, you will need to write threaded code in Java. For example to simulate a RECORD and STOP button.

Hmmm I am assuming that you writing your code targeted for DESKTOP profile.



来源:https://stackoverflow.com/questions/2852309/javafx-support-for-microphone-audio-capture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!