2013-06-21 37 views
0

当我启动javafx窗口和sphinx应用程序时,我得到一些错误,如果我先运行sphinx,然后启动窗口程序不记录任何命令,只有当我关闭窗口也如果我通常像通常一样启动狮身人面像记录窗口,但会阻挡窗口。JavaFX阻塞sphinx4应用程序

我的窗口:

public class Escolha extends Application{ 
private static final Image FOTOPROXY = new Image(Escolha.class.getResourceAsStream("/foto/proxy.png")); 
private static final Font Corleone = Font.loadFont(Escolha.class.getResourceAsStream("/fontes/corleone.ttf"), 20); 

public static void main(String[] args) { 
    launch(args); 

} 

@Override 
public void start(Stage primaryStage) throws Exception { 

    init(primaryStage); 
    primaryStage.show(); 

} 

public void init(final Stage primaryStage) { 
    //primaryStage.setScene(new Scene(addBorda())); 
    Group root = new Group(); 
    primaryStage.setScene(new Scene(root)); 


    HBox hboxImagem = new HBox(); 
    hboxImagem.setPadding(new Insets(5, 5, 5, 25)); 
    hboxImagem.setSpacing(10); 
    hboxImagem.setStyle("-fx-background-color: #b3ccff"); 

    ImageView imagem = new ImageView(FOTOPROXY);   
    imagem.setFitHeight(200); 
    imagem.setFitWidth(550); 

    hboxImagem.getChildren().add(imagem); 

    HBox hboxTexto = new HBox(); 

    hboxTexto.setPadding(new Insets(15, 5, 15, 15)); 
    hboxTexto.setSpacing(10); 
    hboxTexto.setTranslateY(210); 
    hboxTexto.setStyle("-fx-border-style: solid;" + "-fx-border-width: 4;" + 
      "-fx-border-color: #99b3ff"); 

    HBox hboxBotoes = new HBox(); 
    hboxBotoes.setPadding(new Insets(35, 1, 1, -20)); 
    hboxBotoes.setSpacing(10); 

    Text texto = new Text("Caso possua proxy é necessário configura-lo antes de executar a Olivia,\n" + 
      "você deseja configurar agora?");  
    texto.setFont(Corleone);  


    EventHandler<ActionEvent> vaiSim = new EventHandler<ActionEvent>() { 
     @Override public void handle(ActionEvent event) {  
      Configuracao.configurarProxy(); 

     } 

    }; 

    Button sim = new Button("Sim"); 
    sim.setStyle("-fx-base: #b3ccff"); 
    sim.setOnAction(vaiSim); 


    EventHandler<ActionEvent> vaiNao = new EventHandler<ActionEvent>() { 
     @Override public void handle(ActionEvent event) { 

      HelloWorld.RecDeVoz(); 


     } 

    }; 

    Button nao = new Button("Não"); 
    nao.setStyle("-fx-base: #b3ccff"); 
    nao.setOnAction(vaiNao); 


    hboxBotoes.getChildren().addAll(sim, nao); 

    hboxTexto.getChildren().addAll(texto, hboxBotoes); 

    root.getChildren().addAll(hboxImagem, hboxTexto); 




} 
+0

您正在使用哪种操作系统?如果是Linux,则可能是您的系统音频以这种方式配置。您可能想要配置对麦克风的并行访问。 –

+0

不,我正在使用Windows,但为什么我需要配置音频设置? –

回答

0

使用麦克风仅限于单个应用程序。上你的JavaFX是还访问了麦克风,如由如果你想在你的应用程序中使用Sphinx4行HelloWorld.RecDeVoz();

暗示,你就极有可能整合它:建立,狮身人面像罐子链接到应用程序,然后再启动承认。

如果您尝试使用文件来源而不是麦克风作为输入,请尝试更改sphinx配置以使用文件来源(来自录制的音频文件)进行离线识别。

+0

HelloWorld.RecDeVoz():我在调用sphinx类,狮身人面像已经在我的项目中。 –