package com.tencent.mm.plugin.collect.model.voice;

import android.os.Bundle;
import android.os.Message;
import com.tencent.matrix.trace.core.AppMethodBeat;
import com.tencent.mm.sdk.platformtools.ab;
import com.tencent.ytcommon.BuildConfig;

class b$a implements Runnable {
    final /* synthetic */ b kDo;

    private b$a(b bVar) {
        this.kDo = bVar;
    }

    /* synthetic */ b$a(b bVar, byte b) {
        this(bVar);
    }

    public final void run() {
        AppMethodBeat.i(41026);
        try {
            this.kDo.mText = this.kDo.mText.replaceAll("[^0-9a-zA-Z一-龥.?!,;:。？！，、；：@%&/]+", BuildConfig.FLAVOR);
            ab.d("MicroMsg.OfflineVoice.InnerSynthesizer", "mText = %s  mVolume = %s mSpeed = %s", new Object[]{this.kDo.mText, Float.valueOf(this.kDo.mVolume), Float.valueOf(this.kDo.JN)});
            int readmoney = this.kDo.kDk.readmoney(this.kDo.mText.getBytes("UTF-8"), this.kDo.kDn, this.kDo.kDm, this.kDo.mVolume, this.kDo.JN);
            if (readmoney != -1) {
                byte[] bArr = new byte[readmoney];
                System.arraycopy(this.kDo.kDn, 0, bArr, 0, readmoney);
                if (!this.kDo.kDl) {
                    Message obtainMessage = this.kDo.mHandler.obtainMessage(0);
                    Bundle bundle = new Bundle();
                    bundle.putByteArray("data", bArr);
                    obtainMessage.setData(bundle);
                    this.kDo.mHandler.sendMessage(obtainMessage);
                }
                AppMethodBeat.o(41026);
                return;
            }
            this.kDo.mHandler.sendMessage(this.kDo.mHandler.obtainMessage(-1));
            AppMethodBeat.o(41026);
        } catch (Exception e) {
            ab.i("MicroMsg.OfflineVoice.InnerSynthesizer", "SynthesizerRunnable Exception:%s %s", new Object[]{e.getClass().getSimpleName(), e.getMessage()});
            this.kDo.mHandler.sendMessage(this.kDo.mHandler.obtainMessage(-1));
            AppMethodBeat.o(41026);
        }
    }
}
