FINAL commit before submission. More audio tweaks.
This commit is contained in:
parent
25a3047a10
commit
c8136b01f4
40
audio.lua
40
audio.lua
|
@ -14,28 +14,48 @@ local function StartDrones()
|
||||||
decaytime = 20}
|
decaytime = 20}
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
drones.wail = love.audio.newSource("sounds/drone3.flac", "stream")
|
||||||
drones.fuck = love.audio.newSource("sounds/noiseloop.flac", "static" )
|
drones.fuck = love.audio.newSource("sounds/noiseloop.flac", "static" )
|
||||||
|
drones.subs = love.audio.newSource("sounds/27Hz.flac", "static" )
|
||||||
drones.bass = love.audio.newSource("sounds/drone.flac", "stream")
|
drones.bass = love.audio.newSource("sounds/drone.flac", "stream")
|
||||||
drones.alto = love.audio.newSource("sounds/drone.flac", "stream")
|
drones.alto = love.audio.newSource("sounds/drone.flac", "stream")
|
||||||
|
|
||||||
|
drones.subs:setLooping( true )
|
||||||
|
drones.subs:setVolume( 0 )
|
||||||
|
drones.subs:setPitch( 2.0 )
|
||||||
|
--drones.subs:setEffect( "droneReverb", true )
|
||||||
|
drones.subs:stop()
|
||||||
|
|
||||||
|
drones.bass:setLooping( true )
|
||||||
drones.bass:setVolume( 0 )
|
drones.bass:setVolume( 0 )
|
||||||
drones.bass:setPitch( 0.25 )
|
drones.bass:setPitch( 0.25 )
|
||||||
drones.bass:setEffect( "droneReverb", true )
|
drones.bass:setEffect( "droneReverb", true )
|
||||||
drones.bass:stop()
|
drones.bass:stop()
|
||||||
|
|
||||||
|
drones.alto:setLooping( true )
|
||||||
drones.alto:setVolume( 0 )
|
drones.alto:setVolume( 0 )
|
||||||
drones.alto:setPitch( 2 )
|
drones.alto:setPitch( 2 )
|
||||||
drones.alto:setEffect( "droneReverb", true )
|
drones.alto:setEffect( "droneReverb", true )
|
||||||
drones.alto:stop()
|
drones.alto:stop()
|
||||||
|
|
||||||
|
drones.fuck:setLooping( true )
|
||||||
drones.fuck:setVolume( 0 )
|
drones.fuck:setVolume( 0 )
|
||||||
drones.fuck:setPitch( 0.125 )
|
drones.fuck:setPitch( 1.0 )
|
||||||
drones.fuck:setEffect( "droneReverb", true )
|
drones.fuck:setEffect( "droneReverb", true )
|
||||||
drones.fuck:stop()
|
drones.fuck:stop()
|
||||||
|
|
||||||
|
drones.wail:setLooping( true )
|
||||||
|
drones.wail:setVolume( 0 )
|
||||||
|
drones.wail:setPitch( 1.0 )
|
||||||
|
drones.wail:setEffect( "droneReverb", true )
|
||||||
|
drones.wail:stop()
|
||||||
|
|
||||||
love.audio.play( drones.bass )
|
love.audio.play( drones.bass )
|
||||||
love.audio.play( drones.alto )
|
love.audio.play( drones.alto )
|
||||||
love.audio.play( drones.fuck )
|
love.audio.play( drones.fuck )
|
||||||
|
love.audio.play( drones.subs )
|
||||||
|
love.audio.play( drones.wail )
|
||||||
end
|
end
|
||||||
|
|
||||||
love.audio.setEffect( "passChimeReverb", {
|
love.audio.setEffect( "passChimeReverb", {
|
||||||
|
@ -115,7 +135,7 @@ local function OnImpact( impact, score, pass, level )
|
||||||
-- Chimes
|
-- Chimes
|
||||||
local chime = pass and GetNextPassChime() or GetNextFailChime()
|
local chime = pass and GetNextPassChime() or GetNextFailChime()
|
||||||
chime:setPitch( GetPitch( th ) )
|
chime:setPitch( GetPitch( th ) )
|
||||||
chime:setPosition( r * math.cos( th ), r * math.sin( th ) )
|
chime:setPosition( 2.0 * r * math.cos( th ), 2.0 * r * math.sin( th ) )
|
||||||
chime:setVolume( 0.1 + 0.9 * level / 120.0 )
|
chime:setVolume( 0.1 + 0.9 * level / 120.0 )
|
||||||
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.5 or 0.9))
|
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.5 or 0.9))
|
||||||
chime:setFilter{
|
chime:setFilter{
|
||||||
|
@ -129,7 +149,7 @@ local function OnImpact( impact, score, pass, level )
|
||||||
local wineChime = GetNextWineChime()
|
local wineChime = GetNextWineChime()
|
||||||
wineChime:setPitch( GetPitch( th ) )
|
wineChime:setPitch( GetPitch( th ) )
|
||||||
wineChime:setPosition( love.math.random(), love.math.random() )
|
wineChime:setPosition( love.math.random(), love.math.random() )
|
||||||
wineChime:setVolume( impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
|
wineChime:setVolume( 0.2 * impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
|
||||||
|
|
||||||
love.audio.stop( wineChime )
|
love.audio.stop( wineChime )
|
||||||
love.audio.play( wineChime )
|
love.audio.play( wineChime )
|
||||||
|
@ -157,12 +177,13 @@ end
|
||||||
--if an impact took place at this instant.
|
--if an impact took place at this instant.
|
||||||
local function Update( score, level )
|
local function Update( score, level )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if level > 2 then
|
if level > 2 then
|
||||||
level = level / 120.0
|
level = level / 120.0
|
||||||
drones.bass:setVolume( 0.5 * math.sqrt( score ) * level )
|
drones.bass:setVolume( 0.7 * (0.2 + math.pow( score, 0.25 )) * level )
|
||||||
drones.alto:setVolume( 0.3 * score * level * level)
|
drones.alto:setVolume( 0.3 * (0.3 + math.pow( score, 0.25 )) * level * level)
|
||||||
|
drones.fuck:setVolume( 4.0 * math.max( 0, level - 0.75 ))
|
||||||
|
drones.subs:setVolume( 0.5 * math.max( 0, level - 0.5 ))
|
||||||
|
drones.wail:setVolume( 2.0 * math.max( 0, level - 0.666 ))
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -171,6 +192,11 @@ local function Reset( )
|
||||||
for i = 1, N do
|
for i = 1, N do
|
||||||
love.audio.stop( passChimes[i] )
|
love.audio.stop( passChimes[i] )
|
||||||
love.audio.stop( failChimes[i] )
|
love.audio.stop( failChimes[i] )
|
||||||
|
love.audio.stop( wineChimes[i] )
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, drone in pairs(drones) do
|
||||||
|
love.audio.stop( drone )
|
||||||
end
|
end
|
||||||
StartDrones()
|
StartDrones()
|
||||||
end
|
end
|
||||||
|
|
2
conf.lua
2
conf.lua
|
@ -1,4 +1,6 @@
|
||||||
function love.conf( t )
|
function love.conf( t )
|
||||||
|
t.version = "11.4"
|
||||||
|
|
||||||
t.modules.joystick = false
|
t.modules.joystick = false
|
||||||
t.modules.physics = false
|
t.modules.physics = false
|
||||||
t.modules.touch = false
|
t.modules.touch = false
|
||||||
|
|
24
main.lua
24
main.lua
|
@ -24,6 +24,8 @@ state = {
|
||||||
state.startTime = love.timer.getTime()
|
state.startTime = love.timer.getTime()
|
||||||
state.currentBeat = 1
|
state.currentBeat = 1
|
||||||
state.timeToSimulate = 0.0
|
state.timeToSimulate = 0.0
|
||||||
|
state.longestStreak = 0
|
||||||
|
state.currentStreak = 0
|
||||||
end,
|
end,
|
||||||
|
|
||||||
finishTime = 0.0,
|
finishTime = 0.0,
|
||||||
|
@ -32,6 +34,8 @@ state = {
|
||||||
lastBeatScore = 0.0,
|
lastBeatScore = 0.0,
|
||||||
currentBeat = 1,
|
currentBeat = 1,
|
||||||
startTime = 0.0,
|
startTime = 0.0,
|
||||||
|
longestStreak = 0,
|
||||||
|
currentStreak = 0,
|
||||||
|
|
||||||
beat = {
|
beat = {
|
||||||
t = nil,
|
t = nil,
|
||||||
|
@ -61,11 +65,19 @@ OnImpact = function( impact )
|
||||||
if score > 1.0 then
|
if score > 1.0 then
|
||||||
|
|
||||||
pass = true
|
pass = true
|
||||||
|
|
||||||
|
state.currentStreak = state.currentStreak + 1
|
||||||
|
if state.currentStreak > state.longestStreak then
|
||||||
|
state.longestStreak = state.currentStreak
|
||||||
|
end
|
||||||
|
|
||||||
state.currentBeat = state.currentBeat + 1
|
state.currentBeat = state.currentBeat + 1
|
||||||
if state.currentBeat >= 119 then
|
if state.currentBeat >= 119 then
|
||||||
return OnVictory()
|
return OnVictory()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
else
|
||||||
|
state.currentStreak = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,6 +104,7 @@ local function NewGame()
|
||||||
marble.Reset()
|
marble.Reset()
|
||||||
wave.Reset()
|
wave.Reset()
|
||||||
text.Reset()
|
text.Reset()
|
||||||
|
audio.Reset()
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.load()
|
function love.load()
|
||||||
|
@ -144,8 +157,9 @@ ExtrapolateBeatScore = function( )
|
||||||
if not beat.mu then return 2.0 end
|
if not beat.mu then return 2.0 end
|
||||||
if beat.mu < 0.001 then return 2.0 end
|
if beat.mu < 0.001 then return 2.0 end
|
||||||
|
|
||||||
t = 1.1 * math.sin( 0.5 * math.pi * ( t - beat.t ) / beat.mu )
|
local pow = 1 / math.max( beat.mu, 0.2 )
|
||||||
return t * t * t * t
|
t = 1.05 * math.sin( 0.5 * math.pi * ( t - beat.t ) / beat.mu )
|
||||||
|
return math.pow( t * t, pow )
|
||||||
end
|
end
|
||||||
_ExtrapolateBeatScore = ExtrapolateBeatScore
|
_ExtrapolateBeatScore = ExtrapolateBeatScore
|
||||||
|
|
||||||
|
@ -167,8 +181,9 @@ BeatScore = function( t )
|
||||||
return 2.0
|
return 2.0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local pow = 1 / math.max( beat.mu, 0.1 )
|
||||||
local score = 1.1 * math.sin( 0.5 * math.pi * dt / beat.mu )
|
local score = 1.1 * math.sin( 0.5 * math.pi * dt / beat.mu )
|
||||||
score = score * score * score * score
|
score = math.pow( score * score, pow )
|
||||||
|
|
||||||
--General case: update average beat length.
|
--General case: update average beat length.
|
||||||
|
|
||||||
|
@ -236,7 +251,7 @@ OnVictory = function()
|
||||||
|
|
||||||
love.graphics.setColor( 1, 1, 1, 1 )
|
love.graphics.setColor( 1, 1, 1, 1 )
|
||||||
love.graphics.printf(
|
love.graphics.printf(
|
||||||
"time:\n"..string.format( "%.3f", totalTime ):gsub( "%.", "," ),
|
string.format( "time:\t%.3f\nstreak:\t%d", totalTime, state.longestStreak ):gsub( "%.", "," ),
|
||||||
0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(),
|
0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(),
|
||||||
love.graphics.getWidth(),
|
love.graphics.getWidth(),
|
||||||
"center"
|
"center"
|
||||||
|
@ -300,7 +315,6 @@ _Update = Update
|
||||||
|
|
||||||
function love.keypressed( key, code, isRepeat )
|
function love.keypressed( key, code, isRepeat )
|
||||||
if key == "escape" then return love.event.quit() end
|
if key == "escape" then return love.event.quit() end
|
||||||
if key == "return" then return OnVictory() end
|
|
||||||
if key == "space" then return NewGame() end
|
if key == "space" then return NewGame() end
|
||||||
return marble.OnKey()
|
return marble.OnKey()
|
||||||
end
|
end
|
||||||
|
|
|
@ -31,7 +31,7 @@ function marble.OnImpact( impact, level )
|
||||||
--Adjust current trajectory according to collision.
|
--Adjust current trajectory according to collision.
|
||||||
if not impact.dt then return end
|
if not impact.dt then return end
|
||||||
|
|
||||||
INERTIA = 0.05 - 0.04 * ( level / 120.0 )
|
INERTIA = 0.03 - 0.02 * math.sqrt( level / 120.0 )
|
||||||
MAXSPEED = 2.0 + 4.0 * ( level / 120.0 )
|
MAXSPEED = 2.0 + 4.0 * ( level / 120.0 )
|
||||||
|
|
||||||
local x, y = impact.r * math.cos( impact.th ), impact.r * math.sin( impact.th )
|
local x, y = impact.r * math.cos( impact.th ), impact.r * math.sin( impact.th )
|
||||||
|
|
Binary file not shown.
Binary file not shown.
8
text.lua
8
text.lua
|
@ -60,11 +60,17 @@ local function Draw( beat )
|
||||||
|
|
||||||
if beat == 1 then
|
if beat == 1 then
|
||||||
love.graphics.setColor(0.0, 0.0, 0.0, 1.0)
|
love.graphics.setColor(0.0, 0.0, 0.0, 1.0)
|
||||||
love.graphics.printf( "wasd.space",
|
love.graphics.printf( "your.own.drum",
|
||||||
0, 0,
|
0, 0,
|
||||||
love.graphics.getWidth(),
|
love.graphics.getWidth(),
|
||||||
"center"
|
"center"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
love.graphics.printf( "wasd.space",
|
||||||
|
0, 0.87 * love.graphics.getHeight(),
|
||||||
|
love.graphics.getWidth(),
|
||||||
|
"center"
|
||||||
|
)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
6
wave.lua
6
wave.lua
|
@ -47,7 +47,7 @@ local shader = love.graphics.newShader([[
|
||||||
p.y = -p.y;
|
p.y = -p.y;
|
||||||
|
|
||||||
float r = r( atan(p.y, p.x) ) - length( p );
|
float r = r( atan(p.y, p.x) ) - length( p );
|
||||||
float q = float( r < 0.05) * clamp( 1.0 - score, 0.0, 1.0 ) ;
|
float q = float( r < 0.05 ) * clamp( 0.5 - score, 0.0, 1.0 ) ;
|
||||||
|
|
||||||
return vec4( q + (1.0 + clamp( score, 0.0, 1.0 ) * r * r * 0.2) * color.xyz, float(r > 0.0) ) ;
|
return vec4( q + (1.0 + clamp( score, 0.0, 1.0 ) * r * r * 0.2) * color.xyz, float(r > 0.0) ) ;
|
||||||
}
|
}
|
||||||
|
@ -150,9 +150,9 @@ end
|
||||||
--Apply bandlimited impulse to wave, adjust free parameters according to game state.
|
--Apply bandlimited impulse to wave, adjust free parameters according to game state.
|
||||||
local function OnImpact( impact, level )
|
local function OnImpact( impact, level )
|
||||||
|
|
||||||
IMPULSESIZE = 10.0 * math.sqrt( ( level - 2.0) / 120.0 )
|
IMPULSESIZE = 10.0 * ( level - 2.0) / 120.0
|
||||||
SOUNDSPEED = 25 - 10 * level / 120
|
SOUNDSPEED = 25 - 10 * level / 120
|
||||||
DAMPING = 0.02 * ( 1.0 - 0.4 * level / 120 )
|
DAMPING = 0.01 * ( 1.0 - 0.4 * level / 120 )
|
||||||
|
|
||||||
|
|
||||||
--Apply bandlimited impulse.
|
--Apply bandlimited impulse.
|
||||||
|
|
Loading…
Reference in New Issue