mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-10 08:13:55 +00:00
[1.44.18]
Change in format of *_dict files. 'Word-boundary' at the start of a rule from *_rules is not implied by a new rule type RULE_PRE_ATSTART. espeakedit: Improvements to Tools->Process Lexicon->Italian which makes the file dictsource/it_listx. lang=hu, fixes for ordinal numbers. Speed-up, add files sonic.cpp, sonic.h git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@255 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
+34
-15
@@ -286,6 +286,11 @@ void WcmdqStop()
|
||||
{//=============
|
||||
wcmdq_head = 0;
|
||||
wcmdq_tail = 0;
|
||||
if(sonicSpeedupStream != NULL)
|
||||
{
|
||||
sonicDestroyStream(sonicSpeedupStream);
|
||||
sonicSpeedupStream = NULL;
|
||||
}
|
||||
#ifdef USE_PORTAUDIO
|
||||
Pa_AbortStream(pa_stream);
|
||||
#endif
|
||||
@@ -446,6 +451,10 @@ static int WaveCallback(const void *inputBuffer, void *outputBuffer,
|
||||
fprintf(stderr, "espeak: out of memory\n");
|
||||
}
|
||||
outbuffer_size = ix;
|
||||
out_ptr = NULL;
|
||||
}
|
||||
if(out_ptr == NULL)
|
||||
{
|
||||
out_ptr = out_start = outbuffer;
|
||||
out_end = out_start + outbuffer_size;
|
||||
}
|
||||
@@ -1974,25 +1983,27 @@ int WavegenFill2(int fill_zeros)
|
||||
|
||||
|
||||
/* Speed up the audio samples with libsonic. */
|
||||
static int SpeedUp(short *outbuf, int length, int end_of_text)
|
||||
{//===========================================================
|
||||
if(sonicSpeedupStream != NULL && sonicGetSpeed(sonicSpeedupStream) != sonicSpeed)
|
||||
static int SpeedUp(short *outbuf, int length_in, int length_out, int end_of_text)
|
||||
{//==============================================================================
|
||||
if(length_in >0)
|
||||
{
|
||||
sonicDestroyStream(sonicSpeedupStream);
|
||||
sonicSpeedupStream = NULL;
|
||||
if(sonicSpeedupStream == NULL)
|
||||
{
|
||||
sonicSpeedupStream = sonicCreateStream(22050, 1);
|
||||
}
|
||||
if(sonicGetSpeed(sonicSpeedupStream) != sonicSpeed)
|
||||
{
|
||||
sonicSetSpeed(sonicSpeedupStream, sonicSpeed);
|
||||
}
|
||||
|
||||
sonicWriteShortToStream(sonicSpeedupStream, outbuf, length_in);
|
||||
}
|
||||
if(sonicSpeedupStream == NULL)
|
||||
{
|
||||
sonicSpeedupStream = sonicCreateStream(sonicSpeed, 22050);
|
||||
}
|
||||
|
||||
sonicWriteShortToStream(sonicSpeedupStream, outbuf, length);
|
||||
|
||||
if(end_of_text)
|
||||
{
|
||||
sonicFlushStream(sonicSpeedupStream);
|
||||
}
|
||||
return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length);
|
||||
return sonicReadShortFromStream(sonicSpeedupStream, outbuf, length_out);
|
||||
} // end of SpeedUp
|
||||
|
||||
|
||||
@@ -2001,15 +2012,23 @@ int WavegenFill(int fill_zeros)
|
||||
{//============================
|
||||
int finished;
|
||||
unsigned char *p_start;
|
||||
int length;
|
||||
int max_length;
|
||||
|
||||
p_start = out_ptr;
|
||||
|
||||
// fill_zeros is ignored. It is now done in the portaudio cakkback
|
||||
// fill_zeros is ignored. It is now done in the portaudio callback
|
||||
finished = WavegenFill2(0);
|
||||
|
||||
if(sonicSpeed > 1.0 && out_ptr > p_start)
|
||||
if(sonicSpeed > 1.0)
|
||||
{
|
||||
out_ptr = p_start + 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, finished);
|
||||
max_length = (out_end - p_start);
|
||||
length = 2*SpeedUp((short *)p_start, (out_ptr-p_start)/2, max_length/2, finished);
|
||||
out_ptr = p_start + length;
|
||||
|
||||
if(length >= max_length)
|
||||
finished = 0; // there may be more data to flush
|
||||
}
|
||||
return finished;
|
||||
} // end of WavegenFill
|
||||
|
||||
|
||||
Reference in New Issue
Block a user