调用语音排队合成后,无法完整朗读,还没有朗读完整就到了下一个,下一个也是,该怎么办?
Ta的回复 :您好,按照您提供的方式朗读可以了 1.但是有一个新的问题:我跳转了一个界面初始化socket,然后返回回来之后就不能朗读了。 2.speak2(); 和 NettHelper.SendMsg(str);两个方法都执行了,但只要存在NettHelper.SendMsg(str);就不会朗读? void speak2(String str) { if (active) { speak(str); try { NettyHelper.sendMsg(str); } catch (Exception e) { e.printStackTrace(); } } } public static void sendMsg(String msg) throws Exception { if(context == null) { Log.d("context:", "context为空!内容:" + msg); } else { JSONObject json = new JSONObject(); json.put("StepMark", "rfid"); json.put("data", msg); ByteBuf resp = Unpooled.copiedBuffer((json.toString() + PLANT_PORT_SPLIT).getBytes("UTF-8")); context.writeAndFlush(resp); Log.d("context:", "发送成功!内容:" + json.toString()); } } public static ByteBuf copiedBuffer(byte[] array) { return array.length == 0?EMPTY_BUFFER:wrappedBuffer((byte[])array.clone()); } public static ByteBuf wrappedBuffer(byte[] array) { return (ByteBuf)(array.length == 0?EMPTY_BUFFER:new UnpooledHeapByteBuf(ALLOC, array, array.length)); } protected UnpooledHeapByteBuf(ByteBufAllocator alloc, byte[] initialArray, int maxCapacity) { this(alloc, initialArray, 0, initialArray.length, maxCapacity); } private UnpooledHeapByteBuf(ByteBufAllocator alloc, byte[] initialArray, int readerIndex, int writerIndex, int maxCapacity) { super(maxCapacity); if(alloc == null) { throw new NullPointerException("alloc"); } else if(initialArray == null) { throw new NullPointerException("initialArray"); } else if(initialArray.length > maxCapacity) { throw new IllegalArgumentException(String.format("initialCapacity(%d) > maxCapacity(%d)", new Object[]{Integer.valueOf(initialArray.length), Integer.valueOf(maxCapacity)})); } else { this.alloc = alloc; this.setArray(initialArray); this.setIndex(readerIndex, writerIndex); } } ChannelHandlerContext read();