Commit 36205a89 authored by martin hou's avatar martin hou

feat: adding support for opus coding

parent 0bc73cd3
...@@ -879,7 +879,8 @@ Jensen.prototype.getRecordingQuality = async function (seconds) ...@@ -879,7 +879,8 @@ Jensen.prototype.getRecordingQuality = async function (seconds)
Jensen.prototype.setRecordingQuality = async function (quality, seconds) Jensen.prototype.setRecordingQuality = async function (quality, seconds)
{ {
const q = quality == 'normal' ? 0x00 : 0x01; // 自hidock-p1@1.4.6起增加了opus支持,02才是普通音质,01还是高品质
const q = quality == 'normal' ? (this.model == 'hidock-p1' && this.versionNumber < 0x010406 ? 0x02 : 0x00) : 0x01;
return this.send(new Command(SET_RECORDING_QUALITY).body([0x00, 0x00, 0x00, q]), seconds); return this.send(new Command(SET_RECORDING_QUALITY).body([0x00, 0x00, 0x00, q]), seconds);
} }
...@@ -1004,6 +1005,10 @@ Jensen.prototype.listFiles = async function () { ...@@ -1004,6 +1005,10 @@ Jensen.prototype.listFiles = async function () {
{ {
duration = (flen - 44) / 16 / 2 / 2; duration = (flen - 44) / 16 / 2 / 2;
} }
else if (ver == 0x0a)
{
duration = (flen - 126) / 2077 * 1000;
}
// "2025Sep24-180808-Call01.hda" // "2025Sep24-180808-Call01.hda"
mode = fname.join('').replace(/^(\w{9})-(\d{6})-(.+?)\d+\.\w+$/gi, '$3').toUpperCase(); mode = fname.join('').replace(/^(\w{9})-(\d{6})-(.+?)\d+\.\w+$/gi, '$3').toUpperCase();
// console.log('mode:', fname.join(''), mode); // console.log('mode:', fname.join(''), mode);
...@@ -1914,7 +1919,7 @@ Jensen.registerHandler(GET_RECORDING_QUALITY, (msg) => { ...@@ -1914,7 +1919,7 @@ Jensen.registerHandler(GET_RECORDING_QUALITY, (msg) => {
for (let i = 0; i < 4 && i < msg.body.length; i++) { for (let i = 0; i < 4 && i < msg.body.length; i++) {
quality |= (msg.body[i] & 0xff) << ((3 - i) * 8); quality |= (msg.body[i] & 0xff) << ((3 - i) * 8);
} }
return { quality: quality == 0x00 ? 'normal' : 'high' }; return { quality: quality == 0x00 || quality == 0x02 ? 'normal' : 'high' };
}); });
Jensen.registerHandler(SET_RECORDING_QUALITY, commonMessageParser); Jensen.registerHandler(SET_RECORDING_QUALITY, commonMessageParser);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment