return null; if (!ais.getFormat().matches(targetFormat)) {
return null; if (!ais.getFormat().matches(targetFormat)) {
private static final void checkFormat(AudioFormat af) { if (!af.matches(SC_AUDIO_FORMAT)) { throw new IllegalArgumentException( "Unsupported audio format.\nReceived: " + af.toString() + "\nExpected: " + SC_AUDIO_FORMAT); } } }
public static void main(String[] args) throws IOException, UnsupportedAudioFileException { int openingThreshold = PlayerPrefs.OPENING_THRESHOLD_DEFAULT; int closingThreshold = PlayerPrefs.CLOSING_THRESHOLD_DEFAULT; if (args.length >= 1) { openingThreshold = Integer.parseInt(args[0]); } if (args.length >= 2) { closingThreshold = Integer.parseInt(args[1]); } RadioStreamProvider.RadioStream broadcast = RadioStreamProvider.getStream(); AudioFormat format; InputStream stream; if (broadcast.getFormat().matches(FORMAT)) { format = broadcast.getFormat(); stream = broadcast.getStream(); } else { format = FORMAT; stream = new JSSRCResampler(broadcast.getFormat(), FORMAT, broadcast.getStream()); } MutingPipe pipe = new MutingPipe(format, openingThreshold, closingThreshold); AnalyserFuse fuse = new AnalyserFuse(new int[] {openingThreshold, closingThreshold}); pipe.addListener(fuse); new Thread(fuse).start(); pipe.copyStream(stream, System.out); }
+ " used instead to synthesize sentence"); if (mLastFormat != null && !tts.getAudioOutputFormat().matches(mLastFormat)) flush(section, pcmOutput);
public void init(AudioFormat fmt) throws LineUnavailableException { if (mixerChanged || !line.getFormat().matches(fmt)) { mixerChanged = false; line.drain();
public void playAudio(AudioOutput audioToPlay, AudioManager.OutputBehavior behavior) { if (!audioToPlay.getFormat().matches(getOutputFormat())) throw new IllegalArgumentException("AudioToPlay has the wrong AudioFormat.");
|| mLastTTS.getAudioOutputFormat() == null || newSynth.getAudioOutputFormat() == null || !mLastTTS .getAudioOutputFormat().matches(newSynth.getAudioOutputFormat())))
if (toAudioFormat(inFormat).matches(toAudioFormat(outFormat))) { System.arraycopy(inData, in.offset, outData, 0, in.length); } else {
if (toAudioFormat(inFormat).matches(toAudioFormat(outFormat))) { arraycopy(inData, in.offset, outData, 0, in.length); } else {
return null; if (!ais.getFormat().matches(targetFormat)) {