Added possibility to flush clients audio buffer
parent
cbad10f717
commit
6a796faffa
|
@ -2621,6 +2621,9 @@
|
|||
</div>
|
||||
<div class="buttons">
|
||||
<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>
|
||||
<button class="btn btn-danger button-cancel">{{tr "Cancel" /}}</button>
|
||||
<button class="btn btn-success button-close">{{tr "Close" /}}</button>
|
||||
|
|
|
@ -79,6 +79,9 @@ namespace connection {
|
|||
|
||||
reset_latency_settings();
|
||||
latency_settings(settings?: LatencySettings) : LatencySettings;
|
||||
|
||||
support_flush() : boolean;
|
||||
flush();
|
||||
}
|
||||
|
||||
export abstract class AbstractVoiceConnection {
|
||||
|
|
|
@ -633,7 +633,9 @@ class ClientEntry {
|
|||
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
||||
this._audio_handle.reset_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()
|
||||
}, {
|
||||
|
@ -1431,7 +1433,9 @@ class MusicClientEntry extends ClientEntry {
|
|||
Modals.spawnChangeLatency(this, this._audio_handle.latency_settings(), () => {
|
||||
this._audio_handle.reset_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()
|
||||
},
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Modals {
|
||||
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();
|
||||
|
||||
const begin = Object.assign({}, current);
|
||||
|
@ -19,7 +19,9 @@ namespace Modals {
|
|||
client_name: client.clientNickName(),
|
||||
client_unique_id: client.properties.client_unique_identifier,
|
||||
client_id: client.clientId()
|
||||
})
|
||||
}),
|
||||
|
||||
have_flush: (typeof(callback_flush) === "function")
|
||||
});
|
||||
|
||||
const update_value = () => {
|
||||
|
@ -96,6 +98,8 @@ namespace Modals {
|
|||
slider_min.value(current.min_buffer);
|
||||
});
|
||||
|
||||
tag.find(".button-flush").on('click', event => callback_flush());
|
||||
|
||||
return tag.children();
|
||||
},
|
||||
footer: null,
|
||||
|
|
|
@ -223,6 +223,14 @@ namespace audio {
|
|||
support_latency_settings(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
support_flush(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
flush() {
|
||||
throw "not supported";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue