Skip to content

Commit

Permalink
all_Automation_Git_Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
AmolKadam-Tekdi committed Jul 9, 2024
1 parent 2c7cfb7 commit 39cfc5c
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions allAutomation/src/main/java/Tests/AllTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import utils.baseutils.BrowserManager;
import utils.javautils.BaseUtils;

import javax.sound.sampled.*;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
Expand Down Expand Up @@ -294,14 +295,55 @@ public static void Login() throws Exception {



logStep("Speak text in Mike ");
AudioFormat format = new AudioFormat(44100.0f, 16, 2, true, false); // Adjust parameters as needed

// Create DataLine.Info for the alternative format
DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);

// Check if the alternative format is supported
if (!AudioSystem.isLineSupported(info)) {
System.out.println("Alternative format " + format + " is not supported.");
// Log other supported formats for debugging
System.out.println("Supported formats:");
for (Mixer.Info mixerInfo : AudioSystem.getMixerInfo()) {
System.out.println("Mixer: " + mixerInfo.getName());
try {
Mixer mixer = AudioSystem.getMixer(mixerInfo);
Line.Info[] lineInfos = mixer.getSourceLineInfo();
for (Line.Info lineInfo : lineInfos) {
if (lineInfo instanceof DataLine.Info) {
DataLine.Info dataLineInfo = (DataLine.Info) lineInfo;
AudioFormat[] formats = dataLineInfo.getFormats();
for (AudioFormat supportedFormat : formats) {
System.out.println(" " + supportedFormat);
}
}
}
} catch (Exception e) {
System.out.println(" Error retrieving formats: " + e.getMessage());
}
}
} else {
// Proceed with using the alternative format
System.out.println("Alternative format " + format + " is supported.");
try (SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info)) {
line.open(format);
line.start();
// Your audio processing code here
line.drain();
} catch (Exception e) {
e.printStackTrace();
}
}






System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");

logStep("Speak text in Mike again");
logStep("Speak text in Mike");
// Create a voice manager
VoiceManager voiceManager = VoiceManager.getInstance();

Expand Down

0 comments on commit 39cfc5c

Please sign in to comment.