Fixed an device error
This commit is contained in:
parent
1c9fb28cce
commit
35b8082a97
@ -292,10 +292,10 @@ export namespace _audio.recorder {
|
|||||||
if(_device === this._current_device)
|
if(_device === this._current_device)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const device = _device as NativeDevice; /* TODO: test for? */
|
|
||||||
this._current_device = _device;
|
this._current_device = _device;
|
||||||
try {
|
try {
|
||||||
await new Promise(resolve => this.handle.set_device(this._current_device.unique_id, resolve));
|
await new Promise(resolve => this.handle.set_device(this._current_device ? this._current_device.unique_id : undefined, resolve));
|
||||||
|
if(this._current_state !== audio.recorder.InputState.PAUSED && this._current_device)
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
this.handle.start(flag => {
|
this.handle.start(flag => {
|
||||||
if(typeof flag === "boolean" && flag)
|
if(typeof flag === "boolean" && flag)
|
||||||
@ -383,6 +383,7 @@ export namespace _audio.recorder {
|
|||||||
|
|
||||||
this._current_state = audio.recorder.InputState.DRY;
|
this._current_state = audio.recorder.InputState.DRY;
|
||||||
try {
|
try {
|
||||||
|
if(this._current_device)
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
this.handle.start(flag => {
|
this.handle.start(flag => {
|
||||||
if(flag)
|
if(flag)
|
||||||
@ -446,7 +447,7 @@ export namespace _audio.recorder {
|
|||||||
this._filter.set_attack_smooth(.75);
|
this._filter.set_attack_smooth(.75);
|
||||||
this._filter.set_release_smooth(.75);
|
this._filter.set_release_smooth(.75);
|
||||||
|
|
||||||
await new Promise(resolve => this._recorder.set_device(this._device.unique_id, resolve));
|
await new Promise(resolve => this._recorder.set_device(this._device ? this._device.unique_id : undefined, resolve));
|
||||||
await new Promise((resolve, reject) => {
|
await new Promise((resolve, reject) => {
|
||||||
this._recorder.start(flag => {
|
this._recorder.start(flag => {
|
||||||
if(typeof flag === "boolean" && flag)
|
if(typeof flag === "boolean" && flag)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user