Skip to content

Commit

Permalink
Fix misuse and misunderstanding of startPercent
Browse files Browse the repository at this point in the history
  • Loading branch information
cbossut committed Oct 31, 2020
1 parent 027bf1a commit 7363fd7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 7 additions & 0 deletions scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ let scheduler = {
model.updateVolume()

if (model.soundName) {
// WARNING in model, startPercent is of whole sound, here it’s of content
model.startPercent = (model.startPercent - model.loopPercents[0]) / (model.loopPercents[1] - model.loopPercents[0])

model.players = []
model.freePlayer = function(startTime) {
setTimeout(
Expand All @@ -119,6 +122,7 @@ let scheduler = {
if (model.collar) {
// WARNING collarOffset : ignore collar startPercent because it’s broken now (see todolist)
model.startPercent = 0

model.nextBead = 0
model.duration = model.collar.duration
model.beadsDurs = model.collar.beads.map(v => v.length)
Expand All @@ -132,6 +136,9 @@ let scheduler = {
}

if (model.mobile) {
// WARNING mobileOffset : ignore mobile startPercent because it’s broken now (see todolist)
model.startPercent = 0

model.duration = model.mobile.duration
model.rate = parentRate * model.duration / model.length
model.subWheels = model.mobile.gears.map(v => this.prepare(t, v, model.gainNode, model.rate))
Expand Down
11 changes: 8 additions & 3 deletions src/Data/Wheel.elm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type alias Wheeled a =

type alias Wheel =
{ name : String
, startPercent : Float -- Percent of whole sound, not just looped part
, startPercent : Float --TODO Makes no sense, if specific to sound, should be in sound -- Percent of whole sound, not just looped part
, volume : Float
, content : WheelContent
, viewContent : Bool
Expand Down Expand Up @@ -85,7 +85,7 @@ default =

fromContent : Conteet -> Wheel
fromContent c =
{ default | content = C c }
(update (ChangeStart 0) { wheel = { default | content = C c } }).wheel


type Mod
Expand Down Expand Up @@ -231,7 +231,12 @@ view w pos lengthTmp style mayWheelInter mayHandleInter uid =
getLoopPercents { wheel = w }

tickPercent =
(w.startPercent - loopStart) / (loopEnd - loopStart)
case w.content of
C (Content.S _) ->
(w.startPercent - loopStart) / (loopEnd - loopStart)

_ ->
0

( hoverAttrs, dragAttrs ) =
Maybe.withDefault ( [], [] ) <|
Expand Down

0 comments on commit 7363fd7

Please sign in to comment.