[1.39.22]

*_list files, allow words in all-capitals which imply $allcaps attribute.
Voices: Look for voices also in espeak-data/voices/test.
lang=eo: Adjust syllable lengths.  Use break between word (word_gap=1).
wave.cpp: Fixes to copyBuffer(), wave_write().


git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@201 d46cf337-b52f-0410-862d-fd96e6ae7743
This commit is contained in:
jonsd
2008-11-10 21:31:12 +00:00
parent 75970b147a
commit 084cd2c17d
16 changed files with 299 additions and 174 deletions
+1 -1
View File
@@ -602,7 +602,7 @@ int Compile::LoadSpect(const char *path, int control)
float total;
float pkheight;
int marker1_set=0;
int frame_vowelbreak;
int frame_vowelbreak=NULL;
SpectFrame *fr;
wxString path_sep = _T("/");
+32 -5
View File
@@ -186,6 +186,7 @@ int compile_line(char *linebuf, char *dict_line, int *hash)
int len_phonetic;
int text_not_phonemes; // this word specifies replacement text, not phonemes
unsigned int wc;
int all_upper_case;
char *mnemptr;
char *comment;
@@ -430,11 +431,34 @@ static char nullstring[] = {0};
word[ix] = 0;
}
else
if((word[0] & 0x80)==0) // 7 bit ascii only
if(word[0] != '_')
{
// If first letter is uppercase, convert to lower case. (Only if it's 7bit ascii)
// ??? need to consider utf8 here
word[0] = tolower(word[0]);
// convert to lower case, and note if the word is all-capitals
int c2;
all_upper_case = 1;
p = word;
for(p=word;;)
{
// this assumes that the lower case char is the same length as the upper case char
// OK, except for Turkish "I", but use towlower() rather than towlower2()
ix = utf8_in(&c2,p,0);
if(c2 == 0)
break;
if(iswupper(c2))
{
utf8_out(towlower(c2),p);
}
else
{
all_upper_case = 0;
}
p += ix;
}
if(all_upper_case)
{
flag_codes[n_flag_codes++] = BITNUM_FLAG_ALLCAPS;
}
}
len_word = strlen(word);
@@ -793,9 +817,12 @@ void copy_rule_string(char *string, int &state)
}
break;
case '$': // obsolete, replaced by S
fprintf(f_log,"%5d: $ now not allowed, use S for suffix",linenum);
error_count++;
break;
case 'P':
sxflags |= SUFX_P; // Prefix, now drop through to Suffix
case '$': // obsolete, replaced by S
case 'S':
output[ix++] = RULE_ENDING;
value = 0;
+37 -31
View File
@@ -1768,6 +1768,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
int distance_left;
int lg_pts;
int n_bytes;
int add_points;
MatchRecord match;
static MatchRecord best;
@@ -1885,6 +1886,8 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
continue;
}
add_points = 0;
switch(match_type)
{
case 0:
@@ -1894,7 +1897,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
if((letter == rb) || ((letter==(unsigned char)REPLACED_E) && (rb=='e')))
{
match.points += 21;
add_points = 21;
consumed++;
}
else
@@ -1920,7 +1923,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
lg_pts = 20;
if(letter_group==2)
lg_pts = 19; // fewer points for C, general consonant
match.points += (lg_pts-distance_right);
add_points = (lg_pts-distance_right);
post_ptr += letter_xbytes;
}
else
@@ -1931,7 +1934,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
letter_group = *rule++ - 'A';
if((n_bytes = IsLetterGroup(post_ptr-1,letter_group,0)) >0)
{
match.points += (20-distance_right);
add_points = (20-distance_right);
post_ptr += (n_bytes-1);
}
else
@@ -1941,7 +1944,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_NOTVOWEL:
if(!IsLetter(letter_w,0))
{
match.points += (20-distance_right);
add_points = (20-distance_right);
post_ptr += letter_xbytes;
}
else
@@ -1951,14 +1954,14 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_DIGIT:
if(IsDigit(letter_w))
{
match.points += (20-distance_right);
add_points = (20-distance_right);
post_ptr += letter_xbytes;
}
else
if(langopts.tone_numbers)
{
// also match if there is no digit
match.points += (20-distance_right);
add_points = (20-distance_right);
post_ptr--;
}
else
@@ -1968,7 +1971,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_NONALPHA:
if(!iswalpha(letter_w))
{
match.points += (21-distance_right);
add_points = (21-distance_right);
post_ptr += letter_xbytes;
}
else
@@ -1977,14 +1980,14 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_DOUBLE:
if(letter == last_letter)
match.points += (21-distance_right);
add_points = (21-distance_right);
else
failed = 1;
break;
case RULE_ALT1:
if(dict_flags & FLAG_ALT_TRANS)
match.points++;
add_points = 1;
else
failed = 1;
break;
@@ -1992,7 +1995,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case '-':
if((letter == '-') || ((letter == ' ') && (word_flags & FLAG_HYPHEN_AFTER)))
{
match.points += (22-distance_right); // one point more than match against space
add_points = (22-distance_right); // one point more than match against space
}
else
failed = 1;
@@ -2021,7 +2024,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
p += utf8_in(&letter_w,p,0);
}
if(syllable_count <= 0)
match.points+= (19-distance_right);
add_points = (19-distance_right);
else
failed = 1;
}
@@ -2040,12 +2043,12 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
p += utf8_in(&letter_w,p,0);
}
if(!failed)
match.points += (19-distance_right);
add_points = (19-distance_right);
}
break;
case RULE_INC_SCORE:
match.points += 20; // force an increase in points
add_points = 20; // force an increase in points
break;
case RULE_DEL_FWD:
@@ -2070,16 +2073,16 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
if(word_flags & FLAG_SUFFIX_REMOVED)
failed = 1; // a suffix has been removed
else
match.points++;
add_points = 1;
break;
default:
if(letter == rb)
{
if(letter == RULE_SPACE)
match.points += (21-distance_right);
add_points = (21-distance_right);
else
match.points += (21-distance_right);
add_points = (21-distance_right);
}
else
failed = 1;
@@ -2108,7 +2111,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
lg_pts = 20;
if(letter_group==2)
lg_pts = 19; // fewer points for C, general consonant
match.points += (lg_pts-distance_left);
add_points = (lg_pts-distance_left);
pre_ptr -= letter_xbytes;
}
else
@@ -2119,7 +2122,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
letter_group = *rule++ - 'A';
if((n_bytes = IsLetterGroup(pre_ptr-letter_xbytes,letter_group,1)) >0)
{
match.points += (20-distance_right);
add_points = (20-distance_right);
pre_ptr -= (n_bytes-1);
}
else
@@ -2129,7 +2132,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_NOTVOWEL:
if(!IsLetter(letter_w,0))
{
match.points += (20-distance_left);
add_points = (20-distance_left);
pre_ptr -= letter_xbytes;
}
else
@@ -2138,7 +2141,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_DOUBLE:
if(letter == last_letter)
match.points += (21-distance_left);
add_points = (21-distance_left);
else
failed = 1;
break;
@@ -2146,7 +2149,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_DIGIT:
if(IsDigit(letter_w))
{
match.points += (21-distance_left);
add_points = (21-distance_left);
pre_ptr -= letter_xbytes;
}
else
@@ -2156,7 +2159,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case RULE_NONALPHA:
if(!iswalpha(letter_w))
{
match.points += (21-distance_right);
add_points = (21-distance_right);
pre_ptr -= letter_xbytes;
}
else
@@ -2172,14 +2175,14 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
syllable_count++; /* number of syllables to match */
}
if(syllable_count <= word_vowel_count)
match.points+= (19-distance_left);
add_points = (19-distance_left);
else
failed = 1;
break;
case RULE_STRESSED:
if(word_stressed_count > 0)
match.points += 19;
add_points = 19;
else
failed = 1;
break;
@@ -2197,20 +2200,20 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
p -= utf8_in(&letter_w,p,1);
}
if(!failed)
match.points += 3;
add_points = 3;
}
break;
case RULE_IFVERB:
if(expect_verb)
match.points += 1;
add_points = 1;
else
failed = 1;
break;
case RULE_CAPITAL:
if(word_flags & FLAG_FIRST_UPPER)
match.points += 1;
add_points = 1;
else
failed = 1;
break;
@@ -2221,7 +2224,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
{
if(*p == '.')
{
match.points +=50;
add_points = 50;
break;
}
}
@@ -2232,7 +2235,7 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
case '-':
if((letter == '-') || ((letter == ' ') && (word_flags & FLAG_HYPHEN)))
{
match.points += (22-distance_right); // one point more than match against space
add_points = (22-distance_right); // one point more than match against space
}
else
failed = 1;
@@ -2242,9 +2245,9 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
if(letter == rb)
{
if(letter == RULE_SPACE)
match.points += 4;
add_points = 4;
else
match.points += (21-distance_left);
add_points = (21-distance_left);
}
else
failed = 1;
@@ -2252,6 +2255,9 @@ void Translator::MatchRule(char *word[], const char *group, char *rule, MatchRec
}
break;
}
if(failed == 0)
match.points += add_points;
}
if(failed == 2)
+8
View File
@@ -487,6 +487,14 @@ void Translator::CalcLengths()
}
// calc length modifier
if(next->ph->code == phonPAUSE_VSHORT)
{
// ignore very short pause
next = next2;
next2 = next3;
next3 = &phoneme_list[ix+4];
}
if(more_syllables==0)
{
len = langopts.length_mods0[next2->ph->length_mod *10+ next->ph->length_mod];
+1 -1
View File
@@ -35,7 +35,7 @@
#include "translate.h"
#include "wave.h"
const char *version_string = "1.39.18 06.Nov.08";
const char *version_string = "1.39.22 10.Nov.08";
const int version_phdata = 0x013900;
int option_device_number = -1;
+13 -4
View File
@@ -49,6 +49,7 @@
#define OFFSET_DEVANAGARI 0x900
#define OFFSET_BENGALI 0x980
#define OFFSET_TAMIL 0xb80
#define OFFSET_KANNADA 0xc80
#define OFFSET_MALAYALAM 0xd00
#define OFFSET_KOREAN 0x1100
@@ -274,7 +275,7 @@ Translator *SelectTranslator(const char *name)
case L('e','o'):
{
static const short stress_lengths_eo[8] = {145, 180, 200, 190, 0, 0, 300, 320};
static const short stress_lengths_eo[8] = {145, 145, 200, 170, 0, 0, 320, 340};
static const unsigned char stress_amps_eo[] = {16,14, 20,20, 20,24, 24,22 };
static const wchar_t eo_char_apostrophe[2] = {'l',0};
@@ -284,10 +285,10 @@ Translator *SelectTranslator(const char *name)
tr->charset_a0 = charsets[3]; // ISO-8859-3
tr->char_plus_apostrophe = eo_char_apostrophe;
tr->langopts.vowel_pause = 1;
tr->langopts.word_gap = 1;
tr->langopts.stress_rule = 2;
tr->langopts.stress_flags = 0x6 | 0x10;
tr->langopts.unstressed_wd1 = 1;
tr->langopts.unstressed_wd1 = 3;
tr->langopts.unstressed_wd2 = 2;
tr->langopts.numbers = 0x1409 + NUM_ROMAN;
@@ -434,17 +435,19 @@ SetLengthMods(tr,3); // all equal
case L('h','y'): // Armenian
{
static const short stress_lengths_hy[8] = {250, 200, 250, 250, 0, 0, 250, 250};
static const char hy_vowels[] = {0x31, 0x35, 0x37, 0x38, 0x3b, 0x48, 0x55, 0};
static const char hy_consonants[] = {0x32,0x33,0x34,0x36,0x39,0x3a,0x3c,0x3d,0x3e,0x3f,
0x40,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50,0x51,0x52,0x53,0x54,0x56,0};
tr = new Translator();
SetupTranslator(tr,stress_lengths_hy,NULL);
tr->langopts.stress_rule = 3; // default stress on final syllable
tr->letter_bits_offset = OFFSET_ARMENIAN;
memset(tr->letter_bits,0,sizeof(tr->letter_bits));
SetLetterBits(tr,LETTERGP_A,hy_vowels);
SetLetterBits(tr,LETTERGP_C,hy_consonants);
tr->langopts.max_initial_consonants = 4;
tr->langopts.max_initial_consonants = 6;
}
break;
@@ -783,6 +786,7 @@ SetLengthMods(tr,3); // all equal
case L('t','a'): // Tamil
case L('m','l'): // Malayalam
case L('k','n'): // Kannada
{
static const short stress_lengths_ta[8] = {200, 200, 210, 210, 0, 0, 230, 230};
static const unsigned char stress_amps_ta[8] = {18,18, 18,18, 20,20, 22,22 };
@@ -799,6 +803,11 @@ SetLengthMods(tr,3); // all equal
{
tr->letter_bits_offset = OFFSET_MALAYALAM;
}
else
if(name2 == L('k','n'))
{
tr->letter_bits_offset = OFFSET_KANNADA;
}
tr->langopts.param[LOPT_WORD_MERGE] = 1; // don't break vowels betwen words
SetIndicLetters(tr); // call this after setting OFFSET_
}
+1
View File
@@ -75,6 +75,7 @@
#define FLAG_VERB_EXT 0x100 /* extend the 'verb follows' */
#define FLAG_CAPITAL 0x200 /* pronunciation if initial letter is upper case */
#define FLAG_ALLCAPS 0x400 // only if the word is all capitals
#define BITNUM_FLAG_ALLCAPS 0x2a
#define FLAG_ACCENT 0x800 // character name is base-character name + accent name
#define FLAG_HYPHENATED 0x1000 // multiple-words, but needs hyphen between parts 1 and 2
#define BITNUM_FLAG_HYPHENATED 0x2c
+6
View File
@@ -547,6 +547,12 @@ voice_t *LoadVoice(const char *vname, int control)
langname[1] = voicename[1];
langname[2] = 0;
sprintf(buf,"%s%s%c%s",path_voices,langname,PATHSEP,voicename);
if(GetFileLength(buf) <= 0)
{
// look in "test" sub-directory
sprintf(buf,"%stest%c%s",path_voices,PATHSEP,voicename);
}
}
}
+144 -115
View File
@@ -652,29 +652,40 @@ void* wave_open(const char* the_api)
//>
//<copyBuffer
static size_t copyBuffer(char* dest, char* src, size_t theSizeInBytes)
{
size_t bytes_written=0;
if(out_channels==1)
{
SHOW("copyBuffer > memcpy %x (%d bytes)\n", (int)myWrite, theSizeInBytes);
memcpy(dest, src, theSizeInBytes);
bytes_written = theSizeInBytes;
}
else
{
SHOW("copyBuffer > memcpy %x (%d bytes)\n", (int)myWrite, 2*theSizeInBytes);
unsigned int i;
uint16_t* a_dest = (uint16_t*)dest;
uint16_t* a_src = (uint16_t*)src;
for(i=0; i<theSizeInBytes/2; i++)
{
a_dest[2*i] = a_src[i];
a_dest[2*i + 1] = a_src[i];
}
bytes_written = 2*theSizeInBytes;
}
return bytes_written;
static size_t copyBuffer(char* dest, char* src, const size_t theSizeInBytes)
{
size_t bytes_written = 0;
unsigned int i = 0;
uint16_t* a_dest = NULL;
uint16_t* a_src = NULL;
if ((src != NULL) && dest != NULL)
{
// copy for one channel (mono)?
if(out_channels==1)
{
SHOW("copyBuffer > 1 channel > memcpy %x (%d bytes)\n", (int)myWrite, theSizeInBytes);
memcpy(dest, src, theSizeInBytes);
bytes_written = theSizeInBytes;
}
else // copy for 2 channels (stereo)
{
SHOW("copyBuffer > 2 channels > memcpy %x (%d bytes)\n", (int)myWrite, theSizeInBytes);
i = 0;
a_dest = (uint16_t* )dest;
a_src = (uint16_t* )src;
for(i=0; i<theSizeInBytes/2; i++)
{
a_dest[2*i] = a_src[i];
a_dest[2*i+1] = a_src[i];
}
bytes_written = 2*theSizeInBytes;
} // end if(out_channels==1)
} // end if ((src != NULL) && dest != NULL)
return bytes_written;
}
//>
@@ -682,107 +693,125 @@ static size_t copyBuffer(char* dest, char* src, size_t theSizeInBytes)
size_t wave_write(void* theHandler, char* theMono16BitsWaveBuffer, size_t theSize)
{
ENTER("wave_write");
size_t bytes_written = 0;
size_t bytes_to_write = (out_channels==1) ? theSize : theSize*2;
my_stream_could_start = 0;
if(pa_stream == NULL)
{
SHOW_TIME("wave_write > wave_open_sound\n");
if (0 != wave_open_sound())
ENTER("wave_write");
size_t bytes_written = 0;
// space in ringbuffer for the sample needed: 1x mono channel but 2x for 1 stereo channel
size_t bytes_to_write = (out_channels==1) ? theSize : theSize*2;
my_stream_could_start = 0;
if(pa_stream == NULL)
{
SHOW_TIME("wave_write > wave_open_sound fails!");
return 0;
SHOW_TIME("wave_write > wave_open_sound\n");
if (0 != wave_open_sound())
{
SHOW_TIME("wave_write > wave_open_sound fails!");
return 0;
}
my_stream_could_start=1;
}
my_stream_could_start=1;
}
else if (!wave_is_busy(NULL))
{
my_stream_could_start = 1;
}
assert(BUFFER_LENGTH >= bytes_to_write);
if (myWrite >= myBuffer + BUFFER_LENGTH)
{
myWrite = myBuffer;
}
size_t aTotalFreeMem=0;
char* aRead = myRead;
SHOW("wave_write > aRead=%x, myWrite=%x\n", (int)aRead, (int)myWrite);
while (1)
{
if (my_callback_is_output_enabled
&& (0==my_callback_is_output_enabled()))
else if (!wave_is_busy(NULL))
{
SHOW_TIME("wave_write > my_callback_is_output_enabled: no!");
return 0;
my_stream_could_start = 1;
}
aRead = myRead;
if (myWrite >= aRead)
assert(BUFFER_LENGTH >= bytes_to_write);
if (myWrite >= myBuffer + BUFFER_LENGTH)
{
aTotalFreeMem = aRead + BUFFER_LENGTH - myWrite;
}
else
myWrite = myBuffer;
} // end if (myWrite >= myBuffer + BUFFER_LENGTH)
size_t aTotalFreeMem=0;
char* aRead = myRead;
SHOW("wave_write > aRead=%x, myWrite=%x\n", (int)aRead, (int)myWrite);
while (1)
{
aTotalFreeMem = aRead - myWrite;
}
if (aTotalFreeMem>1)
if (my_callback_is_output_enabled && (0==my_callback_is_output_enabled()))
{
SHOW_TIME("wave_write > my_callback_is_output_enabled: no!");
return 0;
}
aRead = myRead;
// write pointer is before read pointer?
if (myWrite >= aRead)
{
aTotalFreeMem = aRead + BUFFER_LENGTH - myWrite;
}
else // read pointer is before write pointer!
{
aTotalFreeMem = aRead - myWrite;
} // end if (myWrite >= aRead)
if (aTotalFreeMem>1)
{
// -1 because myWrite must be different of aRead
// otherwise buffer would be considered as empty
aTotalFreeMem -= 1;
} // end if (aTotalFreeMem>1)
if (aTotalFreeMem >= bytes_to_write)
{
break;
} // end if (aTotalFreeMem >= bytes_to_write)
//SHOW_TIME("wave_write > wait");
SHOW("wave_write > wait: aTotalFreeMem=%d\n", aTotalFreeMem);
SHOW("wave_write > aRead=%x, myWrite=%x\n", (int)aRead, (int)myWrite);
usleep(10000);
} // end while (1)
aRead = myRead;
// write pointer is ahead the read pointer?
if (myWrite >= aRead)
{
// -1 because myWrite must be different of aRead
// otherwise buffer would be considered as empty
aTotalFreeMem -= 1;
}
if (aTotalFreeMem >= bytes_to_write)
SHOW_TIME("wave_write > myWrite >= aRead");
// determine remaining free memory to the end of the ringbuffer
size_t aFreeMem = myBuffer + BUFFER_LENGTH - myWrite;
// is enough linear space available (regardless 1 or 2 channels)?
if (aFreeMem >= bytes_to_write)
{
// copy direct - no wrap around at end of ringbuffer needed
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer, theSize);
}
else // not enough linear space available
{
// 2 channels (stereo)?
if (out_channels == 2)
{
// copy with wrap around at the end of ringbuffer
const size_t bytes_written = copyBuffer(myWrite, theMono16BitsWaveBuffer, aFreeMem/2);
myWrite = myBuffer;
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer+aFreeMem/2, theSize - aFreeMem/2);
}
else // 1 channel (mono)
{
// copy with wrap around at the end of ringbuffer
const size_t bytes_written = copyBuffer(myWrite, theMono16BitsWaveBuffer, aFreeMem);
myWrite = myBuffer;
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer+aFreeMem, theSize - aFreeMem);
} // end if (out_channels == 2)
} // end if (aFreeMem >= bytes_to_write)
} // if (myWrite >= aRead)
else // read pointer is ahead the write pointer
{
break;
}
// SHOW_TIME("wave_write > wait");
SHOW("wave_write > wait: aTotalFreeMem=%d\n", aTotalFreeMem);
SHOW("wave_write > aRead=%x, myWrite=%x\n", (int)aRead, (int)myWrite);
usleep(10000);
}
aRead = myRead;
if (myWrite >= aRead)
{
SHOW_TIME("wave_write > myWrite > aRead");
size_t aFreeMem = myBuffer + BUFFER_LENGTH - myWrite;
if (aFreeMem >= bytes_to_write)
SHOW_TIME("wave_write > myWrite <= aRead");
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer, theSize);
} // end if (myWrite >= aRead)
bytes_written = bytes_to_write;
myWritePosition += theSize/sizeof(uint16_t); // add number of samples
if (my_stream_could_start && (get_used_mem() >= out_channels * sizeof(uint16_t) * FRAMES_PER_BUFFER))
{
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer, theSize);
}
else
{
int bytes_written = copyBuffer(myWrite, theMono16BitsWaveBuffer, aFreeMem);
myWrite = myBuffer;
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer+aFreeMem, bytes_to_write-bytes_written);
}
}
else
{
SHOW_TIME("wave_write > myWrite <= aRead");
myWrite += copyBuffer(myWrite, theMono16BitsWaveBuffer, theSize);
}
bytes_written = theSize;
myWritePosition += theSize/sizeof(uint16_t); // add number of samples
if (my_stream_could_start && (get_used_mem() >= out_channels * sizeof(uint16_t) * FRAMES_PER_BUFFER))
{
start_stream();
}
SHOW_TIME("wave_write > LEAVE");
return bytes_written;
start_stream();
} // end if (my_stream_could_start && (get_used_mem() >= out_channels * sizeof(uint16_t) * FRAMES_PER_BUFFER))
SHOW_TIME("wave_write > LEAVE");
return bytes_written;
}
//>