From 734f75e228b246141484b2165d31f2b8e50755a5 Mon Sep 17 00:00:00 2001 From: Bdale Garbee Date: Mon, 2 Oct 2017 10:36:04 -0600 Subject: [PATCH] patch from Keith to improve pulse audio support --- debian/changelog | 10 +++++ debian/patches/pulse-audio-compat.diff | 58 ++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 69 insertions(+) create mode 100644 debian/patches/pulse-audio-compat.diff diff --git a/debian/changelog b/debian/changelog index 8f7db10..e3457de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +freetts (1.2.2-4) unstable; urgency=low + + [ Keith Packard ] + * make upstream-relevant patch so freetts works with PulseAudio + + [ Bdale Garbee ] + * update package to current standards, fix lintian warnings, etc + + -- Bdale Garbee Mon, 02 Oct 2017 10:35:25 -0600 + freetts (1.2.2-3) unstable; urgency=low * make git-buildpackage point to the right "upstream" branch diff --git a/debian/patches/pulse-audio-compat.diff b/debian/patches/pulse-audio-compat.diff new file mode 100644 index 0000000..5e86d55 --- /dev/null +++ b/debian/patches/pulse-audio-compat.diff @@ -0,0 +1,58 @@ +Index: freetts-1.2.2/com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.java +=================================================================== +--- freetts-1.2.2.orig/com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.java ++++ freetts-1.2.2/com/sun/speech/freetts/audio/JavaStreamingAudioPlayer.java +@@ -7,6 +7,8 @@ + */ + package com.sun.speech.freetts.audio; + ++import java.util.concurrent.Semaphore; ++ + import javax.sound.sampled.AudioFormat; + import javax.sound.sampled.AudioSystem; + import javax.sound.sampled.DataLine; +@@ -94,7 +96,7 @@ public class JavaStreamingAudioPlayer im + private long openFailDelayMs; + private long totalOpenFailDelayMs; + +- private Object openLock = new Object(); ++ private Semaphore openLock; + private Object lineLock = new Object(); + + +@@ -193,16 +195,14 @@ public class JavaStreamingAudioPlayer im + try { + line = (SourceDataLine) AudioSystem.getLine(info); + line.addLineListener(new JavaStreamLineListener()); +- +- synchronized (openLock) { +- line.open(format, AUDIO_BUFFER_SIZE); +- try { +- openLock.wait(); +- } catch (InterruptedException ie) { +- ie.printStackTrace(); +- } +- opened = true; +- } ++ openLock = new Semaphore(0); ++ line.open(format, AUDIO_BUFFER_SIZE); ++ try { ++ openLock.acquire(); ++ opened = true; ++ } catch (InterruptedException ie) { ++ ie.printStackTrace(); ++ } + } catch (LineUnavailableException lue) { + System.err.println("LINE UNAVAILABLE: " + + "Format is " + currentFormat); +@@ -644,9 +644,7 @@ public class JavaStreamingAudioPlayer im + */ + public void update(LineEvent event) { + if (event.getType().equals(LineEvent.Type.OPEN)) { +- synchronized (openLock) { +- openLock.notifyAll(); +- } ++ openLock.release(); + } + } + } diff --git a/debian/patches/series b/debian/patches/series index f3fd9f9..4128797 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ license.terms-missing.diff debian-build-target.diff +pulse-audio-compat.diff -- 2.30.2