mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-21 09:09:01 +00:00
Make default volume match actual Winamp's volume upon install.
This commit is contained in:
parent
7b7d4e2a88
commit
253f29218a
2 changed files with 12 additions and 1 deletions
|
|
@ -21,6 +21,13 @@ import { next as nextTrack } from "./actionCreators";
|
|||
import { getCurrentTrackId } from "./selectors";
|
||||
|
||||
export default media => store => {
|
||||
const { media: { volume, balance } } = store.getState();
|
||||
|
||||
// Ensure the default state is the canonical value.
|
||||
media.setVolume(volume);
|
||||
media.setBalance(balance);
|
||||
// TODO: Ensure other values like bands and preamp are in sync
|
||||
|
||||
media.addEventListener("timeupdate", () => {
|
||||
store.dispatch({
|
||||
type: UPDATE_TIME_ELAPSED,
|
||||
|
|
@ -57,6 +64,7 @@ export default media => store => {
|
|||
});
|
||||
|
||||
return next => action => {
|
||||
// TODO: Consider doing this after the action, and using the state as the source of truth.
|
||||
switch (action.type) {
|
||||
case PLAY:
|
||||
media.play();
|
||||
|
|
|
|||
|
|
@ -204,7 +204,10 @@ const media = (state, action) => {
|
|||
length: null, // Consider renaming to "duration"
|
||||
kbps: null,
|
||||
khz: null,
|
||||
volume: 50,
|
||||
// The winamp ini file declares the default volume as "200".
|
||||
// The UI seems to show a default volume near 78, which would
|
||||
// math with the default value being 200 out of 255.
|
||||
volume: Math.round(200 / 255 * 100),
|
||||
balance: 0,
|
||||
channels: null,
|
||||
shuffle: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue