Continue tweaking sound

This commit is contained in:
2021-09-12 20:33:33 +01:00
parent 51a85bd1ec
commit 72657294d1
89 changed files with 373 additions and 517 deletions
Binary file not shown.
-26
View File
@@ -1,26 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="reload_data" version="1.3.0" audacityversion="2.2.1" sel0="1.0000000000" sel1="1.0000000000" vpos="80" h="0.0000000000" zoom="619.9769053118" rate="44100.0" snapto="on" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Audio Track" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="0" rate="44100" gain="1.0" pan="0.0" colorindex="0"/>
<wavetrack name="Audio Track" channel="0" linked="1" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="44100">
<waveblock start="0">
<simpleblockfile filename="e0002ad8.au" len="44100" min="-0.626438" max="0.756957" rms="0.050527"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="1" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="44100">
<waveblock start="0">
<simpleblockfile filename="e0002124.au" len="44100" min="-0.626438" max="0.756957" rms="0.050527"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
-25
View File
@@ -1,25 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="tap_data" version="1.3.0" audacityversion="2.2.1" sel0="0.0000000000" sel1="0.2786394558" vpos="0" h="0.0000000000" zoom="86.1328125000" rate="44100.0" snapto="off" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="Audio Track" channel="0" linked="1" mute="0" solo="0" height="161" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12288">
<waveblock start="0">
<simpleblockfile filename="e000077f.au" len="12288" min="-10.632122" max="11.905688" rms="0.574985"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="1" linked="0" mute="0" solo="0" height="139" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="12288">
<waveblock start="0">
<simpleblockfile filename="e0000254.au" len="12288" min="-11.171772" max="11.837081" rms="0.58168"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
-73
View File
@@ -1,73 +0,0 @@
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE project PUBLIC "-//audacityproject-1.3.0//DTD//EN" "http://audacity.sourceforge.net/xml/audacityproject-1.3.0.dtd" >
<project xmlns="http://audacity.sourceforge.net/xml/" projname="twoStep_data" version="1.3.0" audacityversion="2.2.1" sel0="0.0000000000" sel1="0.7800000000" vpos="0" h="0.2878780178" zoom="1639.5833333333" rate="44100.0" snapto="on" selectionformat="hh:mm:ss + milliseconds" frequencyformat="Hz" bandwidthformat="octaves">
<tags/>
<wavetrack name="twoStep" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.15000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="13892">
<waveblock start="0">
<simpleblockfile filename="e00004be.au" len="13892" min="-0.124176" max="0.095367" rms="0.007066"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.61501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="7276">
<waveblock start="0">
<simpleblockfile filename="e00007db.au" len="7276" min="-0.186249" max="0.163513" rms="0.017523"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
<wavetrack name="Audio Track" channel="2" linked="0" mute="0" solo="0" height="150" minimized="0" isSelected="1" rate="44100" gain="1.0" pan="0.0" colorindex="0">
<waveclip offset="0.56501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.00000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.05000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.51501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.10000000" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
<waveclip offset="0.46501134" colorindex="0">
<sequence maxsamples="262144" sampleformat="262159" numsamples="2205">
<waveblock start="0">
<silentblockfile len="2205"/>
</waveblock>
</sequence>
<envelope numpoints="0"/>
</waveclip>
</wavetrack>
</project>
+2 -2
View File
@@ -198,7 +198,7 @@ youDropItem w = case yourItem w of
NoItem -> w
_ -> rmSelectedInvItem (_yourID w)
. copyItemToFloor (you w) (_crInvSel cr)
$ soundFrom (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
$ soundStart (CrSound (_crID cr)) (_crPos cr) whiteNoiseFadeOutS Nothing
w
where
cr = you w
@@ -233,7 +233,7 @@ pickUpItem
pickUpItem cid flit w = case maybeInvSlot of
Nothing -> w
Just i -> w
& soundFrom (CrSound cid) (_flItPos flit) pickUpS Nothing
& soundStart (CrSound cid) (_flItPos flit) pickUpS Nothing
& updateItLocation i
& floorItems %~ IM.delete (_flItID flit)
& creatures . ix cid . crInv . ix i %~ addItem it
+2 -2
View File
@@ -58,7 +58,7 @@ followImpulse cr w imp = case imp of
(hitCr cid'
, crMvBy (10 *.* normalizeV (posFromID cid' -.- cpos)) $ cr & crMeleeCooldown .~ 20) -- randomise cooldown?
RandomTurn a -> (id, creatureTurn (rr a) cr)
MakeSound sid -> ( soundOnceOrigin sid (CrSound (_crID cr)) (_crPos cr) , cr )
MakeSound sid -> ( soundStart (CrSound (_crID cr)) (_crPos cr) sid Nothing , cr )
DropItem -> undefined
ChangeStrategy strat -> (id, cr & crActionPlan . crStrategy .~ strat)
AddGoal gl -> (id, cr & crActionPlan . crGoal %~ (gl :) )
@@ -84,5 +84,5 @@ followImpulse cr w imp = case imp of
posFromID cid' = _crPos $ _creatures w IM.! cid'
rr a = fst $ randomR (-a,a) $ _randGen w
hitCr i = over (creatures . ix i . crState . crDamage) (addDam i)
. soundFrom (CrSound cid) cpos hitS Nothing
. soundStart (CrSound cid) cpos hitS Nothing
addDam i dams = Blunt 100 cpos (posFromID i) (posFromID i) : dams
+3 -3
View File
@@ -91,9 +91,9 @@ awakeLevelPerception cr = case _crAwakeLevel $ _crPerception cr of
newSounds :: World -> [(Point2,Float)]
newSounds = mapMaybe f . M.elems . _playingSounds
where
f s | _soundStatus s == JustStartedPlaying
= Just (_soundPos s, _soundVolume s)
| otherwise = Nothing
f s = case _soundStatus s of
JustStartedPlaying -> Just (_soundPos s, _soundVolume s)
_ -> Nothing
rememberSounds :: Creature -> Reader World Creature
rememberSounds cr = do
+3 -3
View File
@@ -52,7 +52,7 @@ stateUpdate u cr w = case u (updateMovement cr) w of
| otherwise = Nothing
deathEff
| cr ^.crHP > 0 = id
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr))
| otherwise = stopSoundFrom (CrWeaponSound (_crID cr) 0)
. over decorations addCorpse
. dropByState cr
addCorpse = IM.insertNewKey
@@ -137,11 +137,11 @@ invSideEff cr w = weaponReloadSounds cr $ IM.foldrWithKey f w (_crInv cr)
weaponReloadSounds :: Creature -> World -> World
weaponReloadSounds cr w = case _crInv cr IM.!? _crInvSel cr of
Just Weapon{_wpReloadType = PassiveReload stype,_wpReloadTime=rt,_wpReloadState=rs}
| rt == rs -> soundFrom (CrReloadSound 0) (_crPos cr) stype Nothing w
| rt == rs -> soundContinue (CrReloadSound 0) (_crPos cr) stype Nothing w
| otherwise -> w
Just Weapon{_wpReloadState = 0} -> w
Just Weapon{_wpReloadState = 1} -> stopSoundFrom (CrReloadSound cid) w
Just Weapon{} -> soundFrom (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
Just Weapon{} -> soundContinue (CrReloadSound cid) (_crPos cr) reloadS (Just 1) w
_ -> w
where
cid = _crID cr
+1 -1
View File
@@ -4,7 +4,7 @@ data SoundOrigin = InventorySound
| BackgroundSound
| OnceSound
| CrSound Int
| CrWeaponSound Int
| CrWeaponSound Int Int
| WallSound Int
| CrReloadSound Int
| Flamer
+1 -1
View File
@@ -215,7 +215,7 @@ defaultButton = Button
, _btEvent = \b w ->
set (buttons . ix (_btID b) . btPict) (onLayer WlLayer $ color red $ polygon $ rectNSEW (-4) (-5) 10 (-10))
. set (buttons . ix (_btID b) . btState) BtNoLabel
. soundFrom (LeverSound 0) (_btPos b) click1S Nothing $ w
. soundStart (LeverSound 0) (_btPos b) click1S Nothing $ w
, _btID = 0
, _btText = "Button"
, _btState = BtOff
+1 -1
View File
@@ -47,7 +47,7 @@ initialWorld = defaultWorld
, _mousePos = V2 0 0
, _testString = testStringInit
, _yourID = 0
, _worldEvents = soundFrom BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing
, _worldEvents = soundStart BackgroundSound (V2 0 0) foamSprayFadeOutS Nothing
. foldr ((.) . makeStartCloudAt) id [V3 x y 5 | x <- [-5,-3..5] , y <- [-5,-3..5]]
, _pressPlates = IM.empty
, _buttons = IM.empty
+1 -1
View File
@@ -32,7 +32,7 @@ heal25 :: Int -> World -> Maybe World
heal25 = heal 25
heal :: Int -> Int -> World -> Maybe World
heal hp n w | _crHP (_creatures w IM.! n) >= 10000 = Nothing
| otherwise = Just $ soundFrom (CrSound $ _crID cr) (_crPos cr) healS Nothing w
| otherwise = Just $ soundStart (CrSound $ _crID cr) (_crPos cr) healS Nothing w
& creatures . ix n . crHP %~ min 10000 . (+ hp)
where
cr = _creatures w IM.! n
+10 -10
View File
@@ -66,7 +66,7 @@ pistol = defaultGun
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI tap3S
, withSoundStart tap3S
, useAmmo 1
, randSpreadDir
, withMuzFlareI
@@ -296,7 +296,7 @@ hvAutoGun = defaultAutoGun
, _itUseModifiers =
[ ammoCheckI
, rateIncABI 24 7 (torqueBeforeAtLeast 0.1 0.1) (torqueAfterI 0.2)
, withSoundI bangEchoS
, withSoundStart bangEchoS
, withThinSmokeI
, withMuzFlareI
]
@@ -323,7 +323,7 @@ ltAutoGun = defaultAutoGun
, _itUseModifiers =
[ ammoCheckI
, useTimeCheckI
, withSoundI tap1S
, withSoundStart tap1S
, useAmmo 1
, withRandomDirI 0.1
, torqueAfterI 0.2
@@ -429,7 +429,7 @@ spreadGun = defaultGun
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI shotgunS
, withSoundStart shotgunS
, useAmmo 1
, withRecoilI 100
, withMuzFlareI
@@ -461,7 +461,7 @@ multGun = defaultGun
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI shotgunS
, withSoundStart shotgunS
, useAmmo 1
, withRecoilI 200
, withMuzFlareI
@@ -507,7 +507,7 @@ longGun = defaultGun
[ ammoCheckI
, hammerCheckI
, useTimeCheckI
, withSoundI bangEchoS
, withSoundStart bangEchoS
, useAmmo 1
, withThickSmokeI
, torqueAfterI 0.05
@@ -752,10 +752,10 @@ moveRemoteBomb itid time pID w
$ set (projectiles .ix pID.pjUpdate) (\_ -> moveRemoteBomb itid (f time) pID)
w
| time < 2 = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing $ halfV updatedWorld
Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing $ halfV updatedWorld
_ -> halfV updatedWorld
| otherwise = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld
where
updatedWorld
@@ -875,7 +875,7 @@ fireRemoteLauncher :: Creature -> World -> World
fireRemoteLauncher cr w = setLocation
$ resetFire
$ resetName
$ soundFrom (CrWeaponSound cid) pos tap4S Nothing
$ soundStart (CrWeaponSound cid 0) pos tap4S Nothing
$ over projectiles addRemRocket w
where
i = IM.newKey $ _projectiles w
@@ -923,7 +923,7 @@ moveRemoteShell cid itid pj w
( ( pjVel %~ ( (accel +.+) . (frict *.*) ) )
. ( pjDir .~ newdir )
)
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& smokeGen
& makeFlameletTimed oldPos 20 (0.5 *.* rotateV (pi+sparkD) accel) Nothing 3 10
| time > -200 = case thingHit of
+1 -1
View File
@@ -29,7 +29,7 @@ bezierGun = defaultGun
, _itUse = \_ -> useTargetPos $ \p -> shootBezier $ fromJust p -- <- the start point
, _itUseModifiers =
[ useTimeCheckI
, withSoundI tap2S
, withSoundStart tap2S
, useAmmo 1
, withMuzFlareI
. withRecoilI 40
+1 -1
View File
@@ -32,7 +32,7 @@ moveGrenade 0 _ pID w = over projectiles (IM.delete pID)
pj = _projectiles w IM.! pID
explosion = _pjPayload pj
moveGrenade time dir pID w = case hitWl of
Just (p,_) -> soundFrom (Tap 0) p tapQuietS Nothing updatedWorld
Just (p,_) -> soundStart (Tap 0) p tapQuietS Nothing updatedWorld
_ -> updatedWorld
where
updatedWorld = updateV $ set (projectiles . ix pID . pjPos) finalPos
+2 -2
View File
@@ -43,7 +43,7 @@ launcher = defaultGun
, _itUseModifiers =
[ ammoCheckI
, useTimeCheckI
, withSoundI tap4S
, withSoundStart tap4S
, useAmmo 1
]
, _wpSpread = 0.02
@@ -107,7 +107,7 @@ doThrust :: Projectile -> World -> World
doThrust pj w = w
& randGen .~ g
& projectiles . ix i . pjVel %~ (\v -> accel +.+ frict *.* v)
& soundFrom (ShellSound i) newPos missileLaunchS (Just 1)
& soundContinue (ShellSound i) newPos missileLaunchS (Just 1)
& makeFlameletTimed (oldPos -.- vel) 0 (vel +.+ rotateV (pi+sparkD) accel) Nothing 3 10
& smokeGen
where
+18 -6
View File
@@ -12,7 +12,8 @@ module Dodge.Item.Weapon.TriggerType
, torqueBefore
, torqueBeforeAtLeast
, torqueAfterI
, withSoundI
, withSoundStart
, withSoundContinue
, withSoundForI
, withThickSmokeI
, withThinSmokeI
@@ -128,7 +129,7 @@ withWarmUpI soundID f item cr w
| _wpReloadState item /= 0 = w
| curWarmUp < maxWarmUp = w
& pointerToItem . wpCurWarmUp +~ 2
& soundFrom (CrWeaponSound cid) (_crPos cr) soundID (Just 2)
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
| otherwise = w
& pointerToItem . wpCurWarmUp .~ maxWarmUp
& f item cr
@@ -140,11 +141,22 @@ withWarmUpI soundID f item cr w
maxWarmUp = _wpMaxWarmUp item
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSoundI
withSoundStart
:: SoundID -- ^ Sound id
-> ChainEffect
withSoundI soundid f item cr
= soundFrom (CrWeaponSound cid) (_crPos cr) soundid Nothing
withSoundStart soundid f item cr
= soundMultiFrom [CrWeaponSound cid 0,CrWeaponSound cid 1,CrWeaponSound cid 2] (_crPos cr) soundid Nothing
-- = soundStart (CrWeaponSound cid 0) (_crPos cr) soundid Nothing
. f item cr
where
cid = _crID cr
{- | Adds a sound to a creature based world effect.
The sound is emitted from the creature's position. -}
withSoundContinue
:: SoundID -- ^ Sound id
-> ChainEffect
withSoundContinue soundid f item cr
= soundContinue (CrWeaponSound cid 0) (_crPos cr) soundid Nothing
. f item cr
where
cid = _crID cr
@@ -156,7 +168,7 @@ withSoundForI
-> Int -- ^ Frames to play
-> ChainEffect
withSoundForI soundid playTime f item cr
= soundFrom (CrWeaponSound (_crID cr)) (_crPos cr) soundid (Just playTime)
= soundContinue (CrWeaponSound (_crID cr) 0) (_crPos cr) soundid (Just playTime)
. f item cr
afterRecoil
+1 -1
View File
@@ -70,7 +70,7 @@ addSoundToDoor i pld hwd (x:ys) = f x : ys
where
g dm w
| dist wp pld > 2 && dist wp hwd > 2
= soundFrom (WallSound i) wp slideDoorS (Just 1) $ dm w
= soundContinue (WallSound i) wp slideDoorS (Just 1) $ dm w
| otherwise = dm w
where
wp = fst $ _wlLine (_walls w IM.! i)
+38 -30
View File
@@ -6,8 +6,8 @@ This module allows us to talk to the "Sound" module.
-}
module Dodge.SoundLogic (
-- * Manipulation of individual sounds
soundOnceOrigin
, soundFrom
soundStart
, soundContinue
, soundFromGeneral
, soundMultiFrom
, stopSoundFrom
@@ -22,7 +22,6 @@ import Dodge.Data.SoundOrigin
import Sound.Data
import Geometry.Data
import Geometry.Vector
import Dodge.SoundLogic.Synonyms
import Dodge.SoundLogic.LoadSound
import Control.Lens
@@ -41,41 +40,20 @@ pauseSound w = w
resumeSound :: World -> World
resumeSound w = w
{-| Play a sound once, with a given origin.
For each origin only one sound will play at a time.
-}
soundOnceOrigin
:: SoundID -- ^ ID of the sound to be played
-> SoundOrigin -- ^ The \"creator\" of the sound
-> Point2 -- ^ The position of the sound in the world
-> World
-> World
soundOnceOrigin sType so p w = w & sounds %~ M.insertWith (\ _ x -> x) so theSound
where
theSound = Sound
{ _soundChunkID = sType
, _soundTime = Nothing
, _soundStatus = ToStart
, _soundChannel = Nothing
, _soundAngDist = Just (a,0)
, _soundPos = p
, _soundVolume = soundToVol sType
}
a = soundAngle p w
soundFrom
:: SoundOrigin -- ^ \"Creator\" of sound
soundWithStatus
:: SoundStatus
-> SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w
soundWithStatus status so pos sType mtime w = over sounds (M.insertWith f so sound) w
where
sound = Sound
{ _soundChunkID = sType
, _soundTime = mtime
, _soundStatus = ToStart
, _soundStatus = status
, _soundChannel = Nothing
, _soundAngDist = Just (a,0)
, _soundPos = pos
@@ -84,6 +62,23 @@ soundFrom so pos sType mtime w = over sounds (M.insertWith f so sound) w
f _ s = s {_soundTime = mtime }
a = soundAngle pos w
soundStart
:: SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundStart = soundWithStatus ToStart
soundContinue
:: SoundOrigin -- ^ \"Creator\" of sound
-> Point2 -- ^ Position of sound
-> SoundID -- ^ ID of sound to be played
-> Maybe Int -- ^ Frames to play sound for, Nothing for until finished
-> World
-> World
soundContinue = soundWithStatus ToContinueStart
soundFromGeneral
:: SoundOrigin -- ^ \"Creator\" of sound
-> (World -> Point2) -- ^ Position of sound
@@ -130,8 +125,21 @@ soundMultiFrom
-> World
-> World
soundMultiFrom [] _ _ _ w = w
soundMultiFrom [so] pos sType mtime w
= over sounds (M.insert so sound) w
where
sound = Sound
{ _soundChunkID = sType
, _soundTime = mtime
, _soundStatus = ToStart
, _soundChannel = Nothing
, _soundAngDist = Just (a,0)
, _soundPos = pos
, _soundVolume = soundToVol sType
}
a = soundAngle pos w
soundMultiFrom (so:sos) pos sType mtime w
| so `M.member` _sounds w = soundMultiFrom sos pos sType mtime w
| so `M.member` _playingSounds w = soundMultiFrom sos pos sType mtime w
| otherwise = over sounds (M.insert so sound) w
where
sound = Sound
+281 -281
View File
@@ -16,303 +16,303 @@ loadSounds = do
soundToVol :: SoundID -> Float
soundToVol v = case _getSoundID v of
0 -> 20
1 -> 80
2 -> 40
3 -> 30
4 -> 30
5 -> 100
6 -> 50
7 -> 20
8 -> 200
9 -> 100
10 -> 50
11 -> 80
12 -> 30
13 -> 80
14 -> 120
15 -> 50
16 -> 30
17 -> 100
18 -> 80
19 -> 50
20 -> 100
21 -> 120
22 -> 20
23 -> 20
24 -> 80
25 -> 30
26 -> 80
27 -> 80
28 -> 80
29 -> 50
30 -> 30
31 -> 40
32 -> 50
33 -> 50
34 -> 80
35 -> 80
36 -> 60
37 -> 40
38 -> 150
39 -> 40
40 -> 50
41 -> 40
42 -> 30
43 -> 80
44 -> 80
45 -> 20
46 -> 80
47 -> 50
48 -> 50
49 -> 30
50 -> 100
51 -> 50
52 -> 150
53 -> 100
54 -> 80
55 -> 30
56 -> 100
57 -> 100
0 -> 5000
1 -> 8000
2 -> 8000
3 -> 5000
4 -> 3000
5 -> 3000
6 -> 4000
7 -> 5000
8 -> 10000
9 -> 8000
10 -> 8000
11 -> 8000
12 -> 8000
13 -> 10000
14 -> 3000
15 -> 4000
16 -> 5000
17 -> 5000
18 -> 20000
19 -> 4000
20 -> 10000
21 -> 8000
22 -> 4000
23 -> 2000
24 -> 6000
25 -> 500
26 -> 5000
27 -> 8000
28 -> 8000
29 -> 8000
30 -> 5000
31 -> 8000
32 -> 4000
33 -> 3000
34 -> 8000
35 -> 2000
36 -> 10000
37 -> 5000
38 -> 2000
39 -> 3000
40 -> 12000
41 -> 5000
42 -> 10000
43 -> 12000
44 -> 2000
45 -> 3000
46 -> 8000
47 -> 5000
48 -> 2000
49 -> 3000
50 -> 10000
51 -> 10000
52 -> 3000
53 -> 15000
54 -> 10000
55 -> 3000
56 -> 15000
57 -> 8000
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
0 -> "BLIH"
1 -> "CRNK"
2 -> "BRAP"
3 -> "TIP"
4 -> "THUD"
5 -> "BRAP"
6 -> "CRTINK"
7 -> "SHUHP"
8 -> "BOOM"
9 -> "WHSSH"
10 -> "KRTNKL"
11 -> "CRUMPLE"
12 -> "TAP"
13 -> "CRUNK"
14 -> "BRDBRDBRD"
15 -> "WRR"
16 -> "DRR"
17 -> "TATATA"
18 -> "TAK"
19 -> "TRINKL"
20 -> "SCREE"
21 -> "BRPBRPBRP"
22 -> "PHF"
23 -> "FHP"
24 -> "CRSNK"
25 -> "BWAAH"
26 -> "RINGGG"
27 -> "ZMM"
0 -> "HNH"
1 -> "CRNKL"
2 -> "ZMM"
3 -> "KRTNKL"
4 -> "DWAAH"
5 -> "BWAH"
6 -> "TIPTOP"
7 -> "TINKLE"
8 -> "TATATA"
9 -> "CRSK"
10 -> "CRNK"
11 -> "TAKH"
12 -> "CRUNK"
13 -> "SCREE"
14 -> "TNKTNKTNK"
15 -> "TIPTAP"
16 -> "WRR"
17 -> "HSS"
18 -> "BOOM"
19 -> "CLNK"
20 -> "BRAP"
21 -> "CRSNK"
22 -> "TAPP"
23 -> "BLIH"
24 -> "TAPTIP"
25 -> "CLICK"
26 -> "FWUMP"
27 -> "RINGGG"
28 -> "BRAP"
29 -> "HNH"
30 -> "CHPCHPCHP"
31 -> "SMACK"
32 -> "HSSS"
33 -> "HSS"
34 -> "CRSK"
35 -> "CRASH"
36 -> "TAPTIP"
37 -> "TIPTOP"
38 -> "BANG"
39 -> "TIPTAP"
40 -> "THUD"
41 -> "TAPP"
42 -> "DWAAH"
43 -> "TAKH"
44 -> "BEP"
45 -> "SWSH"
46 -> "CRNKL"
47 -> "CHNKCHNKCHUNK"
48 -> "TINKLE"
49 -> "TNKTNKTNK"
50 -> "BRAHCHCH"
51 -> "CLICK"
52 -> "BANGG"
53 -> "WRRR"
54 -> "CRISH"
55 -> "BWAH"
56 -> "CRAKLE"
57 -> "ZHM"
29 -> "CRUMPLE"
30 -> "TRINKL"
31 -> "TAK"
32 -> "SMACK"
33 -> "DRR"
34 -> "CRASH"
35 -> "SWSH"
36 -> "CRAKLE"
37 -> "CRTINK"
38 -> "FHP"
39 -> "CHPCHPCHP"
40 -> "BRPBRPBRP"
41 -> "CHNKCHNKCHUNK"
42 -> "WRRR"
43 -> "BRDBRDBRD"
44 -> "PHF"
45 -> "BWAAH"
46 -> "BEP"
47 -> "HSSS"
48 -> "SHUHP"
49 -> "THUD"
50 -> "WHSSH"
51 -> "BRAHCHCH"
52 -> "TIP"
53 -> "BANGG"
54 -> "ZHM"
55 -> "TAP"
56 -> "BANG"
57 -> "CRISH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
[ "heal.BLIH.20.wav"
, "glassShat3.CRNK.80.wav"
, "tapQuiet.BRAP.40.wav"
, "foot1.TIP.30.wav"
, "hit.THUD.30.wav"
, "autoGun.BRAP.100.wav"
, "smallGlass3.CRTINK.50.wav"
, "pickUp.SHUHP.20.wav"
, "explosion.BOOM.200.wav"
, "missileLaunch.WHSSH.100.wav"
, "smallGlass2.KRTNKL.50.wav"
, "impact3.CRUMPLE.80.wav"
, "foot2.TAP.30.wav"
, "impact2.CRUNK.80.wav"
, "mini1.BRDBRDBRD.120.wav"
, "fire.WRR.50.wav"
, "slideDoor.DRR.30.wav"
, "autoB.TATATA.100.wav"
, "tap1.TAK.80.wav"
, "smallGlass1.TRINKL.50.wav"
, "tone440sawtooth.SCREE.100.wav"
, "mini.BRPBRPBRP.120.wav"
, "whiteNoiseFadeOut.PHF.20.wav"
, "whiteNoiseFadeIn.FHP.20.wav"
, "glassShat1.CRSNK.80.wav"
, "sineRaisePitchTwoSec.BWAAH.30.wav"
, "tinitus.RINGGG.80.wav"
, "buzz.ZMM.80.wav"
, "tap3.BRAP.80.wav"
, "grunt.HNH.50.wav"
, "reload1.CHPCHPCHP.30.wav"
, "hit1.SMACK.40.wav"
, "foamSprayLoop.HSSS.50.wav"
, "foamSprayFadeOut.HSS.50.wav"
, "glassShat4.CRSK.80.wav"
, "impact1.CRASH.80.wav"
, "twoStep1.TAPTIP.60.wav"
, "twoStepSlow.TIPTOP.40.wav"
, "bang.BANG.150.wav"
, "twoStep.TIPTAP.40.wav"
, "tap4.THUD.50.wav"
, "foot3.TAPP.40.wav"
, "skwareFadeTwoSec.DWAAH.30.wav"
, "tap2.TAKH.80.wav"
, "tone440.BEP.80.wav"
, "knife.SWSH.20.wav"
, "glassShat2.CRNKL.80.wav"
, "crankSlow.CHNKCHNKCHUNK.50.wav"
, "smallGlass4.TINKLE.50.wav"
, "reload.TNKTNKTNK.30.wav"
, "shotgun.BRAHCHCH.100.wav"
, "click1.CLICK.50.wav"
, "bangEcho.BANGG.150.wav"
, "fireLoud.WRRR.100.wav"
, "impact4.CRISH.80.wav"
, "sineRaisePitchOneSec.BWAH.30.wav"
, "elecCrackle.CRAKLE.100.wav"
, "tele.ZHM.100.wav"
[ "grunt.HNH.5000.wav"
, "glassShat2.CRNKL.8000.wav"
, "buzz.ZMM.8000.wav"
, "smallGlass2.KRTNKL.5000.wav"
, "skwareFadeTwoSec.DWAAH.3000.wav"
, "sineRaisePitchOneSec.BWAH.3000.wav"
, "twoStepSlow.TIPTOP.4000.wav"
, "smallGlass4.TINKLE.5000.wav"
, "autoB.TATATA.10000.wav"
, "glassShat4.CRSK.8000.wav"
, "glassShat3.CRNK.8000.wav"
, "tap2.TAKH.8000.wav"
, "impact2.CRUNK.8000.wav"
, "tone440sawtooth.SCREE.10000.wav"
, "reload.TNKTNKTNK.3000.wav"
, "twoStep.TIPTAP.4000.wav"
, "fire.WRR.5000.wav"
, "foamSprayFadeOut.HSS.5000.wav"
, "explosion.BOOM.20000.wav"
, "tapQuiet.CLNK.4000.wav"
, "autoGun.BRAP.10000.wav"
, "glassShat1.CRSNK.8000.wav"
, "foot3.TAPP.4000.wav"
, "heal.BLIH.2000.wav"
, "twoStep1.TAPTIP.6000.wav"
, "click1.CLICK.500.wav"
, "tap4.FWUMP.5000.wav"
, "tinitus.RINGGG.8000.wav"
, "tap3.BRAP.8000.wav"
, "impact3.CRUMPLE.8000.wav"
, "smallGlass1.TRINKL.5000.wav"
, "tap1.TAK.8000.wav"
, "hit1.SMACK.4000.wav"
, "slideDoor.DRR.3000.wav"
, "impact1.CRASH.8000.wav"
, "knife.SWSH.2000.wav"
, "elecCrackle.CRAKLE.10000.wav"
, "smallGlass3.CRTINK.5000.wav"
, "whiteNoiseFadeIn.FHP.2000.wav"
, "reload1.CHPCHPCHP.3000.wav"
, "mini.BRPBRPBRP.12000.wav"
, "crankSlow.CHNKCHNKCHUNK.5000.wav"
, "fireLoud.WRRR.10000.wav"
, "mini1.BRDBRDBRD.12000.wav"
, "whiteNoiseFadeOut.PHF.2000.wav"
, "sineRaisePitchTwoSec.BWAAH.3000.wav"
, "tone440.BEP.8000.wav"
, "foamSprayLoop.HSSS.5000.wav"
, "pickUp.SHUHP.2000.wav"
, "hit.THUD.3000.wav"
, "missileLaunch.WHSSH.10000.wav"
, "shotgun.BRAHCHCH.10000.wav"
, "foot1.TIP.3000.wav"
, "bangEcho.BANGG.15000.wav"
, "tele.ZHM.10000.wav"
, "foot2.TAP.3000.wav"
, "bang.BANG.15000.wav"
, "impact4.CRISH.8000.wav"
]
healS :: SoundID
healS = SoundID 0
glassShat3S :: SoundID
glassShat3S = SoundID 1
tapQuietS :: SoundID
tapQuietS = SoundID 2
foot1S :: SoundID
foot1S = SoundID 3
hitS :: SoundID
hitS = SoundID 4
autoGunS :: SoundID
autoGunS = SoundID 5
smallGlass3S :: SoundID
smallGlass3S = SoundID 6
pickUpS :: SoundID
pickUpS = SoundID 7
explosionS :: SoundID
explosionS = SoundID 8
missileLaunchS :: SoundID
missileLaunchS = SoundID 9
smallGlass2S :: SoundID
smallGlass2S = SoundID 10
impact3S :: SoundID
impact3S = SoundID 11
foot2S :: SoundID
foot2S = SoundID 12
impact2S :: SoundID
impact2S = SoundID 13
mini1S :: SoundID
mini1S = SoundID 14
fireS :: SoundID
fireS = SoundID 15
slideDoorS :: SoundID
slideDoorS = SoundID 16
autoBS :: SoundID
autoBS = SoundID 17
tap1S :: SoundID
tap1S = SoundID 18
smallGlass1S :: SoundID
smallGlass1S = SoundID 19
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 20
miniS :: SoundID
miniS = SoundID 21
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 22
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 23
glassShat1S :: SoundID
glassShat1S = SoundID 24
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 25
tinitusS :: SoundID
tinitusS = SoundID 26
gruntS :: SoundID
gruntS = SoundID 0
glassShat2S :: SoundID
glassShat2S = SoundID 1
buzzS :: SoundID
buzzS = SoundID 27
buzzS = SoundID 2
smallGlass2S :: SoundID
smallGlass2S = SoundID 3
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 4
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 5
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 6
smallGlass4S :: SoundID
smallGlass4S = SoundID 7
autoBS :: SoundID
autoBS = SoundID 8
glassShat4S :: SoundID
glassShat4S = SoundID 9
glassShat3S :: SoundID
glassShat3S = SoundID 10
tap2S :: SoundID
tap2S = SoundID 11
impact2S :: SoundID
impact2S = SoundID 12
tone440sawtoothS :: SoundID
tone440sawtoothS = SoundID 13
reloadS :: SoundID
reloadS = SoundID 14
twoStepS :: SoundID
twoStepS = SoundID 15
fireS :: SoundID
fireS = SoundID 16
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 17
explosionS :: SoundID
explosionS = SoundID 18
tapQuietS :: SoundID
tapQuietS = SoundID 19
autoGunS :: SoundID
autoGunS = SoundID 20
glassShat1S :: SoundID
glassShat1S = SoundID 21
foot3S :: SoundID
foot3S = SoundID 22
healS :: SoundID
healS = SoundID 23
twoStep1S :: SoundID
twoStep1S = SoundID 24
click1S :: SoundID
click1S = SoundID 25
tap4S :: SoundID
tap4S = SoundID 26
tinitusS :: SoundID
tinitusS = SoundID 27
tap3S :: SoundID
tap3S = SoundID 28
gruntS :: SoundID
gruntS = SoundID 29
reload1S :: SoundID
reload1S = SoundID 30
impact3S :: SoundID
impact3S = SoundID 29
smallGlass1S :: SoundID
smallGlass1S = SoundID 30
tap1S :: SoundID
tap1S = SoundID 31
hit1S :: SoundID
hit1S = SoundID 31
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 32
foamSprayFadeOutS :: SoundID
foamSprayFadeOutS = SoundID 33
glassShat4S :: SoundID
glassShat4S = SoundID 34
hit1S = SoundID 32
slideDoorS :: SoundID
slideDoorS = SoundID 33
impact1S :: SoundID
impact1S = SoundID 35
twoStep1S :: SoundID
twoStep1S = SoundID 36
twoStepSlowS :: SoundID
twoStepSlowS = SoundID 37
bangS :: SoundID
bangS = SoundID 38
twoStepS :: SoundID
twoStepS = SoundID 39
tap4S :: SoundID
tap4S = SoundID 40
foot3S :: SoundID
foot3S = SoundID 41
skwareFadeTwoSecS :: SoundID
skwareFadeTwoSecS = SoundID 42
tap2S :: SoundID
tap2S = SoundID 43
tone440S :: SoundID
tone440S = SoundID 44
impact1S = SoundID 34
knifeS :: SoundID
knifeS = SoundID 45
glassShat2S :: SoundID
glassShat2S = SoundID 46
crankSlowS :: SoundID
crankSlowS = SoundID 47
smallGlass4S :: SoundID
smallGlass4S = SoundID 48
reloadS :: SoundID
reloadS = SoundID 49
shotgunS :: SoundID
shotgunS = SoundID 50
click1S :: SoundID
click1S = SoundID 51
bangEchoS :: SoundID
bangEchoS = SoundID 52
fireLoudS :: SoundID
fireLoudS = SoundID 53
impact4S :: SoundID
impact4S = SoundID 54
sineRaisePitchOneSecS :: SoundID
sineRaisePitchOneSecS = SoundID 55
knifeS = SoundID 35
elecCrackleS :: SoundID
elecCrackleS = SoundID 56
elecCrackleS = SoundID 36
smallGlass3S :: SoundID
smallGlass3S = SoundID 37
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 38
reload1S :: SoundID
reload1S = SoundID 39
miniS :: SoundID
miniS = SoundID 40
crankSlowS :: SoundID
crankSlowS = SoundID 41
fireLoudS :: SoundID
fireLoudS = SoundID 42
mini1S :: SoundID
mini1S = SoundID 43
whiteNoiseFadeOutS :: SoundID
whiteNoiseFadeOutS = SoundID 44
sineRaisePitchTwoSecS :: SoundID
sineRaisePitchTwoSecS = SoundID 45
tone440S :: SoundID
tone440S = SoundID 46
foamSprayLoopS :: SoundID
foamSprayLoopS = SoundID 47
pickUpS :: SoundID
pickUpS = SoundID 48
hitS :: SoundID
hitS = SoundID 49
missileLaunchS :: SoundID
missileLaunchS = SoundID 50
shotgunS :: SoundID
shotgunS = SoundID 51
foot1S :: SoundID
foot1S = SoundID 52
bangEchoS :: SoundID
bangEchoS = SoundID 53
teleS :: SoundID
teleS = SoundID 57
teleS = SoundID 54
foot2S :: SoundID
foot2S = SoundID 55
bangS :: SoundID
bangS = SoundID 56
impact4S :: SoundID
impact4S = SoundID 57
loadMusic :: IO (IM.IntMap Mix.Music)
loadMusic = do
-42
View File
@@ -1,42 +0,0 @@
module Dodge.SoundLogic.Synonyms
where
clickSound , reloadSound , pickUpSound , putDownSound , fireSound , grenadeBang , tapQuiet , twoStepSound , healSound , doorSound , twoStepSlowSound , knifeSound , buzzSound , hitSound , autoGunSound , shotgunSound , teleSound , longGunSound , launcherSound , smokeTrailSound , foot1Sound , foot2Sound , drawWeaponSound , holsterWeaponSound :: Int
clickSound = 1
reloadSound = 2
pickUpSound = 4
putDownSound = 5
fireSound = 6
grenadeBang = 7
tapQuiet = 8
twoStepSound = 9
healSound = 10
doorSound = 11
twoStepSlowSound = 12
knifeSound = 13
buzzSound = 14
hitSound = 15
autoGunSound = 16
shotgunSound = 17
teleSound = 18
longGunSound = 19
launcherSound = 20
smokeTrailSound = 21
foot1Sound = 22
foot2Sound = 23
foamSpray :: Int
foamSpray = 41
foamSprayFadeOutSound :: Int
foamSprayFadeOutSound = 42
sineRaisePitchOneSecSound :: Int
sineRaisePitchOneSecSound = 43
sineRaisePitchTwoSecSound :: Int
sineRaisePitchTwoSecSound = 44
skwareFadeTwoSecSound :: Int
skwareFadeTwoSecSound = 45
drawWeaponSound = 4
holsterWeaponSound = 5
soundVolID :: Int -> Float
soundVolID _ = 10000
+3 -3
View File
@@ -7,17 +7,17 @@ import Dodge.SoundLogic.LoadSound
import Geometry.Data
import Dodge.RandomHelp
import System.Random
--import System.Random
import Control.Lens
import Control.Monad.State.Lazy
mkSoundBreakGlass :: Point2 -> World -> World
mkSoundBreakGlass p w = soundOnceOrigin soundid (GlassBreakSound 0) p $ set randGen g w
mkSoundBreakGlass p w = soundStart (GlassBreakSound 0) p soundid Nothing $ set randGen g w
where
(soundid,g) = _randGen w & runState (takeOne [glassShat1S,glassShat2S,glassShat3S,glassShat4S])
mkSoundSplinterGlass :: Point2 -> World -> World
mkSoundSplinterGlass p w = soundOnceOrigin soundid (GlassBreakSound 1) p $ set randGen g w
mkSoundSplinterGlass p w = soundStart (GlassBreakSound 1) p soundid Nothing $ set randGen g w
where
(soundid,g) = _randGen w & runState (takeOne [smallGlass1S,smallGlass2S,smallGlass3S,smallGlass4S])
+1 -1
View File
@@ -99,7 +99,7 @@ moveFlame rotd w pt
_ -> (glare $ doSound damcrs , mvPt)
where
time = _btTimer' pt
doSound = soundFrom Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
doSound = soundContinue Flame (V2 x y) fireS (Just 2) -- . over worldEvents ((.) $ flameGlareAt ep)
glare
| time `mod` 5 == 0
= tempLightSources %~ (theTLS :)
+2 -1
View File
@@ -55,7 +55,7 @@ playSoundAndUpdate sData oldSounds newSounds
mergeSound :: Sound -> Sound -> Sound
mergeSound oldS newS
| _soundChunkID newS == _soundChunkID oldS
| _soundChunkID newS == _soundChunkID oldS && _soundStatus newS == ToContinueStart
= newS & soundChannel .~ _soundChannel oldS
& soundStatus .~ _soundStatus oldS
| otherwise = newS & soundChannel .~ _soundChannel oldS
@@ -74,6 +74,7 @@ updateSound sd s =
initialisePlaying :: IM.IntMap Mix.Chunk -> Sound -> MaybeT IO Sound
initialisePlaying sd s = case _soundStatus s of
ToStart -> tryPlay sd s
ToContinueStart -> tryPlay sd s
JustStartedPlaying -> return $ s & soundStatus .~ Playing
_ -> return s
+1
View File
@@ -13,6 +13,7 @@ data SoundStatus
= JustStartedPlaying
| Playing
| ToStart
| ToContinueStart
deriving (Eq,Ord,Show)
newtype SoundID = SoundID { _getSoundID :: Int }