mirror of
https://github.com/Rafostar/clapper.git
synced 2025-08-31 16:31:58 +02:00
Use cubic scale for volume. Fixes #21
Volume sliders should usually adjust volume using cubic scale. This also changes max volume to 150% which should be louder than previous value anyway.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { Gio, GstPlayer, Gtk } = imports.gi;
|
||||
const { Gio, GstAudio, GstPlayer, Gtk } = imports.gi;
|
||||
const Debug = imports.clapper_src.debug;
|
||||
|
||||
var appName = 'Clapper';
|
||||
@@ -11,6 +11,8 @@ var settings = new Gio.Settings({
|
||||
schema_id: appId,
|
||||
});
|
||||
|
||||
var maxVolume = 1.5;
|
||||
|
||||
let { debug } = Debug;
|
||||
let inhibitCookie;
|
||||
|
||||
@@ -83,3 +85,21 @@ function getFormattedTime(time, showHours)
|
||||
let parsed = (hours) ? `${hours}:` : '';
|
||||
return parsed + `${minutes}:${seconds}`;
|
||||
}
|
||||
|
||||
function getCubicValue(linearVal)
|
||||
{
|
||||
return GstAudio.StreamVolume.convert_volume(
|
||||
GstAudio.StreamVolumeFormat.LINEAR,
|
||||
GstAudio.StreamVolumeFormat.CUBIC,
|
||||
linearVal
|
||||
);
|
||||
}
|
||||
|
||||
function getLinearValue(cubicVal)
|
||||
{
|
||||
return GstAudio.StreamVolume.convert_volume(
|
||||
GstAudio.StreamVolumeFormat.CUBIC,
|
||||
GstAudio.StreamVolumeFormat.LINEAR,
|
||||
cubicVal
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user