Compare commits

..

No commits in common. "aca3a5af7805e8a79f09688bf394c14fcc099de8" and "65db9736992c156facf93da0057684cee22115a8" have entirely different histories.

3 changed files with 6 additions and 8 deletions

View File

@ -73,10 +73,10 @@ func (a *app) Init(ctx ui.Context) error {
); err != nil { ); err != nil {
log.Printf("failed to load samples; %v\n", err) log.Printf("failed to load samples; %v\n", err)
} }
if err := a.context.Audio.LoadSampleVolume(-.5, "menu_interaction.mp3"); err != nil { if err := a.context.Audio.LoadSampleVolume(-1, "menu_interaction.mp3"); err != nil {
log.Printf("failed to load samples; %v\n", err) log.Printf("failed to load samples; %v\n", err)
} }
if err := a.context.Audio.LoadSampleVolume(-1, if err := a.context.Audio.LoadSampleVolume(-2,
"monster_jump.mp3", "monster_jump.mp3",
"player_move.mp3", "player_move.mp3",
); err != nil { ); err != nil {

View File

@ -13,7 +13,6 @@ type appContext struct {
Settings *tins2021.Settings Settings *tins2021.Settings
Score *tins2021.ScoreState Score *tins2021.ScoreState
Virtual *VirtualControls
Debug bool Debug bool
StarTexture tins2021.AnimatedTexture StarTexture tins2021.AnimatedTexture
@ -193,7 +192,7 @@ func (app *appContext) switchToMenuMusic(ctx ui.Context) {
if app.MenuMusic != nil { if app.MenuMusic != nil {
return return
} }
app.MenuMusic, _ = app.Audio.PlayMusic("song_menu.mp3", func(m *Music) { m.AutoRepeat = true }) app.MenuMusic, _ = app.Audio.PlayMusic("song_menu.mp3", func(m *Music) {})
gameMusic := app.GameMusic gameMusic := app.GameMusic
app.GameMusic = nil app.GameMusic = nil
if gameMusic != nil { if gameMusic != nil {

View File

@ -80,12 +80,11 @@ func (p *AudioPlayer) PlaySample(name string) error {
if err != nil { if err != nil {
return err return err
} }
volume := p.SampleVolume + sample.Volume
speaker.Play(&effects.Volume{ speaker.Play(&effects.Volume{
Streamer: p.resample(sample.Stream(), sample.SampleRate), Streamer: p.resample(sample.Stream(), sample.SampleRate),
Base: 2, Base: 2,
Volume: volume, Volume: p.SampleVolume - sample.Volume,
Silent: volume <= minVolume, Silent: p.SampleVolume == minVolume,
}) })
return nil return nil
} }
@ -108,7 +107,7 @@ func (p *AudioPlayer) PlayMusic(name string, init func(*Music)) (*Music, error)
Streamer: p.resample(closer, format.SampleRate), Streamer: p.resample(closer, format.SampleRate),
Base: 2, Base: 2,
Volume: p.MusicVolume, Volume: p.MusicVolume,
Silent: p.MusicVolume <= minVolume, Silent: p.MusicVolume == minVolume,
}, },
} }
if init != nil { if init != nil {