0

I am using IVONA library to text-to-speech, everything works fine but I am facing one issue

on keyboard space key press I need to speak the written word before space, this is also working fine when user type slowly, but when user type word fast at that time ivona crash and gives me this error

libc: Fatal signal 11 (SIGSEGV) at 0x00000080 (code=1), thread 15441 (Thread-2170)
libc: Send stop signal to pid:15384 in void debuggerd_signal_handler(int, siginfo_t*, void*)

here is my ivona code

 public void readWord_Sentence(final String word) {
     new Thread() {
        @Override
        public void run() {
            try {
                int sampleRate = initStreamer(word, false);

                if (sampleRate == -1) return;

                int numSamples = sampleRate / 10;

                if (mStreamer != null) {
                    JIvonaWave w;
                    while ((w = mStreamer.synth(numSamples)) != null) {
                        if (mTrack == null) {
                            mTrack = createAudioTrack(sampleRate);
                        }
                        short[] samples = w.getSamples();
                        mTrack.write(samples, 0, samples.length);
                        mTrack.play();
                    }
                }
            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                stopWord_Sentence();
            }// end finally
        }
    }.start();

}


/**
 * Force stop word or sentences
 */
 public synchronized void stopWord_Sentence() {
    if (mStreamer != null) {
        try {
            synchronized (mStreamer) {
                mStreamer.stop();
                mStreamer = null;
            }
        } catch (SystemException e) {
            e.printStackTrace();
        } catch (InternalException e) {
            e.printStackTrace();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
    if (mTrack != null) {
        try {
            mTrack.flush();
            mTrack.stop();
            mTrack.release();
            mTrack = null;
        } catch (IllegalStateException e) {
            e.printStackTrace();
        } catch (RuntimeException e) {
            e.printStackTrace();
        }
    }
}

I've tried to comment all code, and got the error is occurring on this line mStreamer.synth(numSamples)

I am using .so files for ivona and the error is in libtts_engine.so file

EDIT

this code is inside the keyboard space click method

 Thread thread = new Thread() {
            @Override
            public void run() {
                super.run();

                if (!readingWordOrSentence.trim().equals("")) {
                    executor.execute(() -> keyboardTextReader.readWord_Sentence(readingWordOrSentence.trim()));
                }
            }
        };
        thread.setPriority(Thread.MAX_PRIORITY);
        thread.start();

and above code is inside readWord_Sentence() to read word.

Priyanka
  • 3,369
  • 1
  • 10
  • 33

0 Answers0