Added possibility to flush clients audio buffer
This commit is contained in:
parent
cbad10f717
commit
6a796faffa
5 changed files with 26 additions and 4 deletions
|
@ -2621,6 +2621,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="buttons">
|
<div class="buttons">
|
||||||
<button class="btn btn-blue button-reset">{{tr "Reset" /}}</button>
|
<button class="btn btn-blue button-reset">{{tr "Reset" /}}</button>
|
||||||
|
{{if have_flush}}
|
||||||
|
<button class="btn btn-blue button-flush">{{tr "Flush buffer" /}}</button>
|
||||||
|
{{/if}}
|
||||||
<div class="spacer"></div>
|
<div class="spacer"></div>
|
||||||
<button class="btn btn-danger button-cancel">{{tr "Cancel" /}}</button>
|
<button class="btn btn-danger button-cancel">{{tr "Cancel" /}}</button>
|
||||||
<button class="btn btn-success button-close">{{tr "Close" /}}</button>
|
<button class="btn btn-success button-close">{{tr "Close" /}}</button>
|
||||||
|
|
|
@ -79,6 +79,9 @@ namespace connection {
|
||||||
|
|
||||||
reset_latency_settings();
|
reset_latency_settings();
|
||||||
latency_settings(settings?: LatencySettings) : LatencySettings;
|
latency_settings(settings?: LatencySettings) : LatencySettings;
|
||||||
|
|
||||||
|
support_flush() : boolean;
|
||||||
|
flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class AbstractVoiceConnection {
|
export abstract class AbstractVoiceConnection {
|
||||||
|
|
|
@ -633,7 +633,9 @@ class ClientEntry {
|
||||||
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
||||||
this._audio_handle.reset_latency_settings();
|
this._audio_handle.reset_latency_settings();
|
||||||
return this._audio_handle.latency_settings();
|
return this._audio_handle.latency_settings();
|
||||||
}, settings => this._audio_handle.latency_settings(settings));
|
}, settings => this._audio_handle.latency_settings(settings), this._audio_handle.support_flush ? () => {
|
||||||
|
this._audio_handle.flush();
|
||||||
|
} : undefined);
|
||||||
},
|
},
|
||||||
visible: this._audio_handle && this._audio_handle.support_latency_settings()
|
visible: this._audio_handle && this._audio_handle.support_latency_settings()
|
||||||
}, {
|
}, {
|
||||||
|
@ -1431,7 +1433,9 @@ class MusicClientEntry extends ClientEntry {
|
||||||
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
||||||
this._audio_handle.reset_latency_settings();
|
this._audio_handle.reset_latency_settings();
|
||||||
return this._audio_handle.latency_settings();
|
return this._audio_handle.latency_settings();
|
||||||
}, settings => this._audio_handle.latency_settings(settings));
|
}, settings => this._audio_handle.latency_settings(settings), this._audio_handle.support_flush ? () => {
|
||||||
|
this._audio_handle.flush();
|
||||||
|
} : undefined);
|
||||||
},
|
},
|
||||||
visible: this._audio_handle && this._audio_handle.support_latency_settings()
|
visible: this._audio_handle && this._audio_handle.support_latency_settings()
|
||||||
},
|
},
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
namespace Modals {
|
namespace Modals {
|
||||||
let modal: Modal;
|
let modal: Modal;
|
||||||
export function spawnChangeLatency(client: ClientEntry, current: connection.voice.LatencySettings, reset: () => connection.voice.LatencySettings, apply: (settings: connection.voice.LatencySettings) => any) {
|
export function spawnChangeLatency(client: ClientEntry, current: connection.voice.LatencySettings, reset: () => connection.voice.LatencySettings, apply: (settings: connection.voice.LatencySettings) => any, callback_flush?: () => any) {
|
||||||
if(modal) modal.close();
|
if(modal) modal.close();
|
||||||
|
|
||||||
const begin = Object.assign({}, current);
|
const begin = Object.assign({}, current);
|
||||||
|
@ -19,7 +19,9 @@ namespace Modals {
|
||||||
client_name: client.clientNickName(),
|
client_name: client.clientNickName(),
|
||||||
client_unique_id: client.properties.client_unique_identifier,
|
client_unique_id: client.properties.client_unique_identifier,
|
||||||
client_id: client.clientId()
|
client_id: client.clientId()
|
||||||
})
|
}),
|
||||||
|
|
||||||
|
have_flush: (typeof(callback_flush) === "function")
|
||||||
});
|
});
|
||||||
|
|
||||||
const update_value = () => {
|
const update_value = () => {
|
||||||
|
@ -96,6 +98,8 @@ namespace Modals {
|
||||||
slider_min.value(current.min_buffer);
|
slider_min.value(current.min_buffer);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tag.find(".button-flush").on('click', event => callback_flush());
|
||||||
|
|
||||||
return tag.children();
|
return tag.children();
|
||||||
},
|
},
|
||||||
footer: null,
|
footer: null,
|
||||||
|
|
|
@ -223,6 +223,14 @@ namespace audio {
|
||||||
support_latency_settings(): boolean {
|
support_latency_settings(): boolean {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
support_flush(): boolean {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
flush() {
|
||||||
|
throw "not supported";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue