File tree 1 file changed +3
-3
lines changed
1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 1
1
<?php
2
2
3
- const BLUEZ_TO_PA_FACTOR = 512 ;
3
+ const BLUEZ_TO_PA_FACTOR = 65535 / 127 ;
4
4
5
5
require_once __DIR__ .'/../vendor/autoload.php ' ;
6
6
$ ffi = require_once __DIR__ .'/../load.php ' ;
15
15
FFI ::addr ($ err ));
16
16
$ ffi ->dbus_connection_flush ($ conn );
17
17
if ($ ffi ->dbus_error_is_set (FFI ::addr ($ err ))) {
18
- fprintf (stderr , "Match Error (%s) \n" , $ err ->message );
18
+ fprintf (STDERR , "Match Error (%s) \n" , $ err ->message );
19
19
exit (1 );
20
20
}
21
21
70
70
}
71
71
72
72
$ addr = preg_replace ('@^.*/dev_(.*?)(/.*)$@ ' , '$1 ' , $ message ->path );
73
- $ paVolume = BLUEZ_TO_PA_FACTOR * (int ) $ volume ;
73
+ $ paVolume = ( int ) ( BLUEZ_TO_PA_FACTOR * (int ) $ volume) ;
74
74
echo "Set volume to " .round ($ paVolume / 65535 * 100 ).'% ' .PHP_EOL ;
75
75
exec ("pactl set-source-volume bluez_source. {$ addr }.a2dp_source {$ paVolume }" );
76
76
}
You can’t perform that action at this time.
0 commit comments