Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
misc minor fixes, plus updated build with latest emscripten that fixe…
…s various things
  • Loading branch information
kripken committed Nov 3, 2011
1 parent 04be015 commit d69ec50
Show file tree
Hide file tree
Showing 8 changed files with 75,579 additions and 90,206 deletions.
160,767 changes: 70,573 additions & 90,194 deletions speak.full.js

Large diffs are not rendered by default.

4,967 changes: 4,964 additions & 3 deletions speak.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion src/Makefile
Expand Up @@ -26,8 +26,9 @@ LN_SF = /bin/ln -sf
MKDIR = mkdir -p

#AUDIO = portaudio
AUDIO = pulseaudio
#AUDIO = pulseaudio
#AUDIO = sada
AUDIO = none

ifeq ($(AUDIO),pulseaudio)
WAVE=wave_pulse.cpp
Expand Down
34 changes: 30 additions & 4 deletions src/emscripten.sh
@@ -1,21 +1,47 @@
echo "make"
RANLIB=/home/alon/Dev/emscripten/tools/emmaken.py AR=/home/alon/Dev/emscripten/tools/emmaken.py CXX=/home/alon/Dev/emscripten/tools/emmaken.py CC=/home/alon/Dev/emscripten/tools/emmaken.py make
make distclean
make clean
rm libespeak.*
rm speak speak.bc speak.o
RANLIB=/home/alon/Dev/emscripten/tools/emmaken.py AR=/home/alon/Dev/emscripten/tools/emmaken.py CXX=/home/alon/Dev/emscripten/tools/emmaken.py CC=/home/alon/Dev/emscripten/tools/emmaken.py CXXFLAGS="-DNEED_WCHAR_FUNCTIONS" make
echo "dis"
~/Dev/llvm-2.9/cbuild/bin/llvm-dis -show-annotations speak -o=speak.ll
~/Dev/llvm/cbuild/bin/llvm-dis -show-annotations speak.bc -o=speak.ll
#echo "autodebug"
#mv speak.ll speak.orig.ll
#python ~/Dev/emscripten/tools/autodebugger.py speak.orig.ll speak.ll
#mv speak.bc speak.orig.bc
#~/Dev/llvm/cbuild/bin/llvm-as speak.ll -o=speak.bc
echo "emscripten"
python /home/alon/Dev/emscripten/emscripten.py -O -s USE_TYPED_ARRAYS=2 -s ASSERTIONS=0 -s OPTIMIZE=1 -s RELOOP=1 speak.ll > espeak.raw.js
python /home/alon/Dev/emscripten/emscripten.py -O -s SKIP_STACK_IN_SMALL=1 -s SAFE_HEAP=0 -s USE_TYPED_ARRAYS=2 -s ASSERTIONS=0 -s OPTIMIZE=1 -s RELOOP=1 speak.ll > espeak.raw.js
echo "bundling"
cat pre.js > ../speak.full.js
for filey in phontab phonindex phondata intonations en_dict # fr_dict # Needed for French
for filey in config phontab phonindex phondata intonations en_dict # fr_dict # Needed for French
do
python ~/Dev/emscripten/tools/file2json.py ../espeak-data/$filey $filey >> ../speak.full.js
done
python ~/Dev/emscripten/tools/file2json.py ../espeak-data/voices/en/en-us en_us >> ../speak.full.js
#python ~/Dev/emscripten/tools/file2json.py ../espeak-data/voices/fr fr >> ../speak.full.js # Needed for French
cat espeak.raw.js >> ../speak.full.js
cat post.js >> ../speak.full.js


#~/Dev/mozilla-central/js/src/js -m speak.full.js -w wav.wav --path="/home/alon/Dev/espeak-1.45.04-source" "hello world"
#~/Dev/v8/d8 header.js speak.full.js footer.js
#gnome-sound-recorder wav.wav
#java -jar /home/alon/Dev/closure-compiler-read-only/build/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --variable_map_output_file speak.vars --js speak.full.js --js_output_file speak.js



# Test:
#
# ./speak-native --path=/home/alon/Dev/speak.js -v 'en/en-us' -w wav.wav "4 test"
# OR
# ~/Dev/llvm/cbuild/bin/lli speak.bc -v 'en/en-us' -w wav.wav --path="/home/alon/Dev/speak.js" "4 test"
#
# gnome-sound-recorder wav.wav
#
# # --path="/home/alon/Dev/speak.js" ?
# ~/Dev/mozilla-central/js/src/fast/js -m -n speak.full.js > wav.new.js
# python ~/Dev/emscripten/tools/make_file.py wav.new.js wav
# gnome-sound-recorder wav.new.js.wav

3 changes: 1 addition & 2 deletions src/post.js
@@ -1,6 +1,6 @@

FS.createPath('/', 'espeak/espeak-data', true, false);
[['phontab', phontab], ['phonindex', phonindex], ['phondata', phondata], ['intonations', intonations], ['en_dict', en_dict] /*, ['fr_dict', fr_dict] */].forEach(function(pair) { // commented-out code here is needed for French
[['config', config], ['phontab', phontab], ['phonindex', phonindex], ['phondata', phondata], ['intonations', intonations], ['en_dict', en_dict] /*, ['fr_dict', fr_dict] */].forEach(function(pair) { // commented-out code here is needed for French
var id = pair[0];
var data = pair[1];
FS.createDataFile('/espeak/espeak-data', id, data, true, false);
Expand Down Expand Up @@ -30,7 +30,6 @@
];

run();
Module.arguments.pop();

var wav = FS.root.contents['wav.wav'].contents;

Expand Down
4 changes: 3 additions & 1 deletion src/pre.js
Expand Up @@ -3,7 +3,9 @@ var speak = (function() {

// eSpeak and other code here are under the GNU GPL.

var print = console.log;
if (!this['print']) {
print = console.log;
}

var Module = {
noInitialRun: true
Expand Down
5 changes: 5 additions & 0 deletions src/speech.h
Expand Up @@ -20,6 +20,11 @@
#ifndef SPEECH_H
#define SPEECH_H

// XXX Emscripten
#define _STRUCT_TIMESPEC
#undef __need_timeval
// XXX end Emscripten

#include <sys/types.h>

// conditional compilation options
Expand Down
2 changes: 1 addition & 1 deletion src/voices.cpp
Expand Up @@ -720,7 +720,7 @@ voice_t *LoadVoice(const char *vname, int control)

case V_GENDER:
{
int age;
int age = 0; // XXX Emscripten fix for native code (uninitialized value)
char vgender[80];
sscanf(p,"%s %d",vgender,&age);
voice_selected.gender = LookupMnem(genders,vgender);
Expand Down

0 comments on commit d69ec50

Please sign in to comment.