adpcm-addon2
Version:
ADPCM编码解码插件
26 lines (20 loc) • 753 B
JavaScript
const dgram = require('dgram')
const adpcm = require('bindings')('adpcm.node');
this._server = dgram.createSocket('udp4')
this._server.on('error', (err) => {
console.log('出错了。。。。。。。。。。。。。。。')
console.log(err)
})
this._server.on('message', (msg, rinfo) => {
const a = Buffer.copyBytesFrom(msg, 23)
const input = Array.from(a)
const output = []
adpcm.decode(input, output, { valprev: 0, index: 0 })
const abc = new Int16Array(output)
console.log(abc)
throw new Error("ljalsdfjlasjdf")
})
this._server.on('listening', () => {
console.log('开始监听。。。。。。。。。。。。。。。。。')
})
this._server.bind(10000, "192.168.1.104")