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類,獅身人面像已經在我的項目中。 –