diff --git a/festival-speech-tools-pulse.patch b/festival-speech-tools-pulse.patch new file mode 100644 index 0000000..49894b3 --- /dev/null +++ b/festival-speech-tools-pulse.patch @@ -0,0 +1,319 @@ +diff -up festival/lib/init.scm.pulse festival/lib/init.scm +--- festival/lib/init.scm.pulse 2009-09-29 02:05:53.156687751 -0400 ++++ festival/lib/init.scm 2009-09-29 02:14:18.911692694 -0400 +@@ -77,6 +77,9 @@ + ;;; Some default parameters + (Parameter.def 'Wavefiletype 'riff) + ++;;; default to pulseaudio ++(Parameter.def 'Audio_Method 'pulseaudio) ++ + ;;; Set default audio method + (cond + ((member 'nas *modules*) +diff -up festival/speech_tools/audio/audioP.h.pulse festival/speech_tools/audio/audioP.h +--- festival/speech_tools/audio/audioP.h.pulse 2004-07-15 19:03:04.000000000 -0400 ++++ festival/speech_tools/audio/audioP.h 2009-09-29 02:05:53.353695375 -0400 +@@ -40,6 +40,7 @@ + #define __AUDIOP_H__ + + int play_nas_wave(EST_Wave &inwave, EST_Option &al); ++int play_pulse_wave(EST_Wave &inwave, EST_Option &al); + int play_esd_wave(EST_Wave &inwave, EST_Option &al); + int play_sun16_wave(EST_Wave &inwave, EST_Option &al); + int play_voxware_wave(EST_Wave &inwave, EST_Option &al); +@@ -49,6 +50,7 @@ int play_irix_wave(EST_Wave &inwave, EST + int play_macosx_wave(EST_Wave &inwave, EST_Option &al); + + int record_nas_wave(EST_Wave &inwave, EST_Option &al); ++int record_pulse_wave(EST_Wave &inwave, EST_Option &al); + int record_esd_wave(EST_Wave &inwave, EST_Option &al); + int record_sun16_wave(EST_Wave &inwave, EST_Option &al); + int record_voxware_wave(EST_Wave &inwave, EST_Option &al); +diff -up festival/speech_tools/audio/gen_audio.cc.pulse festival/speech_tools/audio/gen_audio.cc +--- festival/speech_tools/audio/gen_audio.cc.pulse 2004-09-30 08:53:35.000000000 -0400 ++++ festival/speech_tools/audio/gen_audio.cc 2009-09-29 02:05:53.354687890 -0400 +@@ -89,6 +89,8 @@ int play_wave(EST_Wave &inwave, EST_Opti + { + if (nas_supported) + protocol = "netaudio"; // the default protocol ++ else if (pulse_supported) ++ protocol = "pulseaudio"; + else if (esd_supported) + protocol = "esdaudio"; + else if (sun16_supported) +@@ -111,6 +113,8 @@ int play_wave(EST_Wave &inwave, EST_Opti + + if (upcase(protocol) == "NETAUDIO") + return play_nas_wave(*toplay,al); ++ else if (upcase(protocol) == "PULSEAUDIO") ++ return play_pulse_wave(*toplay,al); + else if (upcase(protocol) == "ESDAUDIO") + return play_esd_wave(*toplay,al); + else if (upcase(protocol) == "SUNAUDIO") +@@ -246,6 +250,8 @@ EST_String options_supported_audio(void) + audios += " netaudio"; + else if (esd_supported) + audios += " esdaudio"; ++ if (pulse_supported) ++ audios += " pulseaudio"; + if (sun16_supported) + audios += " sun16audio"; + if (freebsd16_supported) +@@ -286,8 +292,10 @@ int record_wave(EST_Wave &wave, EST_Opti + { + if (nas_supported) + protocol = "netaudio"; // the default protocol ++ else if (pulse_supported) ++ protocol = "pulseaudio"; + else if (esd_supported) +- protocol = "esdaudio"; // the default protocol ++ protocol = "esdaudio"; + else if (sun16_supported) + protocol = "sun16audio"; + else if (freebsd16_supported) +@@ -306,6 +314,8 @@ int record_wave(EST_Wave &wave, EST_Opti + + if (upcase(protocol) == "NETAUDIO") + return record_nas_wave(wave,al); ++ else if (upcase(protocol) == "PULSEAUDIO") ++ return record_pulse_wave(wave,al); + else if (upcase(protocol) == "ESDAUDIO") + return record_esd_wave(wave,al); + else if (upcase(protocol) == "SUN16AUDIO") +diff -up festival/speech_tools/audio/Makefile.pulse festival/speech_tools/audio/Makefile +--- festival/speech_tools/audio/Makefile.pulse 2004-07-15 19:03:04.000000000 -0400 ++++ festival/speech_tools/audio/Makefile 2009-09-29 02:05:53.355692417 -0400 +@@ -44,7 +44,7 @@ LOCAL_DEFAULT_LIBRARY = estbase + H = audioP.h + CPPSRCS = gen_audio.cc nas.cc esd.cc sun16audio.cc voxware.cc \ + mplayer.cc win32audio.cc irixaudio.cc os2audio.cc \ +- macosxaudio.cc ++ macosxaudio.cc pulseaudio.cc + + SRCS = $(CPPSRCS) + OBJS = $(CPPSRCS:.cc=.o) +diff -up /dev/null festival/speech_tools/audio/pulseaudio.cc +--- /dev/null 2009-09-29 00:23:01.118964058 -0400 ++++ festival/speech_tools/audio/pulseaudio.cc 2009-09-29 02:05:53.357688202 -0400 +@@ -0,0 +1,134 @@ ++/*************************************************************************/ ++/* */ ++/* Centre for Speech Technology Research */ ++/* University of Edinburgh, UK */ ++/* Copyright (c) 1997,1998 */ ++/* Red Hat, Inc. */ ++/* Copyright (c) 2008 */ ++/* All Rights Reserved. */ ++/* */ ++/* Permission is hereby granted, free of charge, to use and distribute */ ++/* this software and its documentation without restriction, including */ ++/* without limitation the rights to use, copy, modify, merge, publish, */ ++/* distribute, sublicense, and/or sell copies of this work, and to */ ++/* permit persons to whom this work is furnished to do so, subject to */ ++/* the following conditions: */ ++/* 1. The code must retain the above copyright notice, this list of */ ++/* conditions and the following disclaimer. */ ++/* 2. Any modifications must be clearly marked as such. */ ++/* 3. Original authors' names are not deleted. */ ++/* 4. The authors' names are not used to endorse or promote products */ ++/* derived from this software without specific prior written */ ++/* permission. */ ++/* */ ++/* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ ++/* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ ++/* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ ++/* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ ++/* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ ++/* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ ++/* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ ++/* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ ++/* THIS SOFTWARE. */ ++/* */ ++/*************************************************************************/ ++/* Author : Michal Schmidt */ ++/* Date : November 2008 */ ++/*-----------------------------------------------------------------------*/ ++/* Optional support for PulseAudio */ ++/*=======================================================================*/ ++ ++#include "EST_Wave.h" ++#include "EST_Option.h" ++#include "audioP.h" ++ ++#ifdef SUPPORT_PULSE ++ ++#include ++#include ++ ++int pulse_supported = TRUE; ++const static char *err_prefix = "Pulseaudio: "; ++ ++static int transfer_pulse_wave(EST_Wave &inwave, EST_Option &al, int record) ++{ ++ short *waveform; ++ int num_samples; ++ int err, pa_ret; ++ int ret = -1; ++ pa_simple *s = NULL; ++ pa_sample_spec ss; ++ ++ ss.format = PA_SAMPLE_S16NE; ++ ss.channels = 1; ++ ss.rate = inwave.sample_rate(); ++ ++ waveform = inwave.values().memory(); ++ num_samples = inwave.num_samples(); ++ ++ s = pa_simple_new(NULL, // Use the default server. ++ "Festival", // Our application's name. ++ record ? PA_STREAM_RECORD : PA_STREAM_PLAYBACK, ++ NULL, // Use the default device. ++ record ? "Record" : "Speech", // Description of our stream. ++ &ss, // Our sample format. ++ NULL, // Use default channel map ++ NULL, // Use default buffering attributes. ++ &err); ++ ++ if (!s) { ++ cerr << err_prefix << pa_strerror(err) << endl; ++ goto finish; ++ } ++ ++ pa_ret = record ? ++ pa_simple_read (s, waveform, num_samples*sizeof(short), &err) : ++ pa_simple_write(s, waveform, num_samples*sizeof(short), &err); ++ ++ if (pa_ret < 0) { ++ cerr << err_prefix << pa_strerror(err) << endl; ++ goto finish; ++ } ++ ++ if (!record && pa_simple_drain(s, &err) < 0) { ++ cerr << err_prefix << pa_strerror(err) << endl; ++ goto finish; ++ } ++ ++ ret = 1; ++finish: ++ if (s) ++ pa_simple_free(s); ++ return ret; ++} ++ ++int play_pulse_wave(EST_Wave &inwave, EST_Option &al) ++{ ++ return transfer_pulse_wave(inwave, al, 0); ++} ++ ++int record_pulse_wave(EST_Wave &inwave, EST_Option &al) ++{ ++ return transfer_pulse_wave(inwave, al, 1); ++} ++ ++#else ++int pulse_supported = FALSE; ++ ++int play_pulse_wave(EST_Wave &inwave, EST_Option &al) ++{ ++ (void)inwave; ++ (void)al; ++ cerr << "Audio: pulse not compiled in this version" << endl; ++ return -1; ++} ++ ++int record_pulse_wave(EST_Wave &inwave, EST_Option &al) ++{ ++ (void)inwave; ++ (void)al; ++ cerr << "Audio: pulse not compiled in this version" << endl; ++ return -1; ++} ++ ++#endif +diff -up festival/speech_tools/config/config.in.pulse festival/speech_tools/config/config.in +--- festival/speech_tools/config/config.in.pulse 2009-09-29 02:05:53.045693311 -0400 ++++ festival/speech_tools/config/config.in 2009-09-29 02:05:53.358687421 -0400 +@@ -79,6 +79,9 @@ OPTIMISE_sigpr = 3 + ## NCD's network audio system, This is recommended. + # INCLUDE_MODULES += NAS_AUDIO + ++## PulseAudio sound server ++INCLUDE_MODULES += PULSE_AUDIO ++ + ## Elightenment Sound Demon, for KDE etc. + # INCLUDE_MODULES += ESD_AUDIO + +diff -up festival/speech_tools/config/modules/Makefile.pulse festival/speech_tools/config/modules/Makefile +--- festival/speech_tools/config/modules/Makefile.pulse 2004-07-15 19:03:05.000000000 -0400 ++++ festival/speech_tools/config/modules/Makefile 2009-09-29 02:05:53.359687618 -0400 +@@ -41,7 +41,8 @@ RULESETS = efence.mak dmalloc.mak debugg + psola_tm.mak editline.mak tcl.mak \ + freebsd16_audio.mak irix_audio.mak linux16_audio.mak \ + sun16_audio.mak win32_audio.mak macosx_audio.mak \ +- mplayer_audio.mak nas_audio.mak esd_audio.mak ++ mplayer_audio.mak nas_audio.mak esd_audio.mak \ ++ pulse_audio.mak + + FILES = Makefile descriptions $(RULESETS) + +diff -up /dev/null festival/speech_tools/config/modules/pulse_audio.mak +--- /dev/null 2009-09-29 00:23:01.118964058 -0400 ++++ festival/speech_tools/config/modules/pulse_audio.mak 2009-09-29 02:05:53.361688082 -0400 +@@ -0,0 +1,9 @@ ++## Definitions for PulseAudio ++ ++INCLUDE_PULSE_AUDIO=1 ++ ++MOD_DESC_PULSE_AUDIO=PulseAudio support ++ ++AUDIO_DEFINES += -DSUPPORT_PULSE ++AUDIO_INCLUDES += -I$(PULSE_INCLUDE) ++MODULE_LIBS += -lpulse-simple +diff -up festival/speech_tools/config/project.mak.pulse festival/speech_tools/config/project.mak +--- festival/speech_tools/config/project.mak.pulse 2009-09-29 02:05:53.104720729 -0400 ++++ festival/speech_tools/config/project.mak 2009-09-29 02:05:53.362687372 -0400 +@@ -60,7 +60,7 @@ MODULE_DIRECTORY = $(TOP) + # List of all known modules + + DISTRIBUTED_MODULES = \ +- NAS_AUDIO ESD_AUDIO NATIVE_AUDIO MPLAYER_AUDIO \ ++ NAS_AUDIO PULSE_AUDIO ESD_AUDIO NATIVE_AUDIO MPLAYER_AUDIO \ + EDITLINE \ + SIOD WAGON SCFG WFST OLS \ + JAVA JAVA_CPP JAVA_MEDIA \ +@@ -109,6 +109,7 @@ PROJECT_LIBRARY_VERSION_estbase = $(PROJ + PROJECT_LIBRARY_VERSION_eststring = 1.2 + PROJECT_LIBRARY_VERSION_estjava = $(PROJECT_VERSION).1 + ++PROJECT_LIBRARY_NEEDS_SYSLIBS_estbase=1 + PROJECT_LIBRARY_NEEDS_SYSLIBS_estjava=1 + + PROJECT_DEFAULT_LIBRARY = estools +diff -up festival/speech_tools/config/systems/default.mak.pulse festival/speech_tools/config/systems/default.mak +--- festival/speech_tools/config/systems/default.mak.pulse 2005-07-17 09:06:49.000000000 -0400 ++++ festival/speech_tools/config/systems/default.mak 2009-09-29 02:05:53.364688115 -0400 +@@ -61,6 +61,12 @@ NAS_INCLUDE = /usr/X11R6/include + NAS_LIB = /usr/X11R6/lib + + ########################################################################### ++## Where to find PulseAudio ++ ++PULSE_INCLUDE = /usr/include ++PULSE_LIB = /usr/lib ++ ++########################################################################### + ## Where to find Enlightenment Speech Demon + + ESD_INCLUDE = /usr/local/include +diff -up festival/speech_tools/include/EST_audio.h.pulse festival/speech_tools/include/EST_audio.h +--- festival/speech_tools/include/EST_audio.h.pulse 2004-07-15 19:03:05.000000000 -0400 ++++ festival/speech_tools/include/EST_audio.h 2009-09-29 02:05:53.365689290 -0400 +@@ -43,6 +43,7 @@ + #include "EST_Option.h" + + extern int nas_supported; ++extern int pulse_supported; + extern int esd_supported; + extern int sun16_supported; + extern int freebsd16_supported; diff --git a/festival.spec b/festival.spec index 4e22c3b..f224868 100644 --- a/festival.spec +++ b/festival.spec @@ -6,7 +6,7 @@ Name: festival Summary: Speech synthesis and text-to-speech system Version: %{festivalversion} -Release: 15%{?dist} +Release: 16%{?dist} URL: http://www.cstr.ed.ac.uk/projects/festival/ Group: Applications/Multimedia @@ -131,8 +131,8 @@ Patch92: festival-1.96-nitech-sltreferences.patch Patch93: gcc43.patch -# Work with pulseaudio (bug 467531) -Patch94: festival-use-pacat.patch +# Native pulseaudio support, https://bugzilla.redhat.com/show_bug.cgi?id=471047 +Patch94: festival-speech-tools-pulse.patch Patch95: gcc44.patch @@ -514,7 +514,7 @@ done %patch91 -p1 %patch92 -p1 %patch93 -p1 -b .gcc43 -%patch94 -p1 -b .use-pacat +%patch94 -p1 -b .pulse %patch95 -p1 -b .gcc44 # zero length @@ -875,6 +875,9 @@ fi %changelog +* Tue Sep 29 2009 Matthias Clasen - 1.96-16 +- Add native pulseaudio support (#471047) + * Thu Sep 10 2009 Bernie Innocenti - 1.96-15 - Disable esd support (resolves: rhbz#492982)