fix audio output if the audio device can't do 16000 Hz, by activating

resampling.
This commit is contained in:
espie 2005-04-04 15:35:45 +00:00
parent fd00e0ce84
commit 58a588c7bf
2 changed files with 38 additions and 8 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.5 2004/11/21 14:16:03 espie Exp $
# $OpenBSD: Makefile,v 1.6 2005/04/04 15:35:45 espie Exp $
COMMENT= "general multi-lingual speech synthesis system"
V= 1.95
DISTNAME= festival-${V}-beta
PKGNAME= ${DISTNAME:S/-beta/beta/}
PKGNAME= ${DISTNAME:S/-beta/beta/}p0
CATEGORIES= audio
MASTER_SITES= http://www.cstr.ed.ac.uk/download/festival/${V}/ \
http://festvox.org/packed/festival/${V}/ \

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-speech_tools_audio_voxware_cc,v 1.2 2004/08/06 03:36:24 jolan Exp $
--- speech_tools/audio/voxware.cc.orig Fri Apr 30 11:56:49 2004
+++ speech_tools/audio/voxware.cc Wed Aug 4 20:05:58 2004
@@ -61,11 +61,12 @@
$OpenBSD: patch-speech_tools_audio_voxware_cc,v 1.3 2005/04/04 15:35:45 espie Exp $
--- speech_tools/audio/voxware.cc.orig Fri Apr 30 18:56:49 2004
+++ speech_tools/audio/voxware.cc Mon Apr 4 16:42:40 2005
@@ -61,11 +61,13 @@
#include "EST_error.h"
#ifdef SUPPORT_FREEBSD16
@ -12,10 +12,28 @@ $OpenBSD: patch-speech_tools_audio_voxware_cc,v 1.2 2004/08/06 03:36:24 jolan Ex
int linux16_supported = FALSE;
static char *aud_sys_name = "FreeBSD";
+static int stereo_only = 0;
+static int resample = 0;
#endif
#ifdef SUPPORT_LINUX16
@@ -157,7 +158,7 @@ int play_voxware_wave(EST_Wave &inwave,
@@ -116,11 +118,15 @@ static int sb_set_sample_rate(int sbdevi
int fmt;
int sfmts;
int stereo=0;
+ int ssamp_rate=0;
int sstereo;
int channels=1;
ioctl(sbdevice,SNDCTL_DSP_RESET,0);
- ioctl(sbdevice,SNDCTL_DSP_SPEED,&samp_rate);
+ ssamp_rate = samp_rate;
+ ioctl(sbdevice,SNDCTL_DSP_SPEED,&ssamp_rate);
+ if (samp_rate != ssamp_rate)
+ resample = ssamp_rate;
sstereo = stereo;
ioctl(sbdevice,SNDCTL_DSP_STEREO,&sstereo);
/* Some devices don't do mono even when you ask them nicely */
@@ -157,7 +163,7 @@ int play_voxware_wave(EST_Wave &inwave,
if (al.present("-audiodevice"))
audiodevice = al.val("-audiodevice");
else
@ -24,7 +42,19 @@ $OpenBSD: patch-speech_tools_audio_voxware_cc,v 1.2 2004/08/06 03:36:24 jolan Ex
if ((audio = open(audiodevice,O_WRONLY)) == -1)
{
@@ -284,7 +285,7 @@ int record_voxware_wave(EST_Wave &inwave
@@ -172,6 +178,11 @@ int play_voxware_wave(EST_Wave &inwave,
sample_rate = inwave.sample_rate();
actual_fmt = sb_set_sample_rate(audio,sample_rate);
+ if (resample) {
+ inwave.resample(resample);
+ sample_rate = inwave.sample_rate();
+ num_samples = inwave.num_samples();
+ }
if (stereo_only)
{
@@ -284,7 +295,7 @@ int record_voxware_wave(EST_Wave &inwave
if (al.present("-audiodevice"))
audiodevice = al.val("-audiodevice");
else