-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #232 from stringsync/cursor
Create playback cursor
- Loading branch information
Showing
55 changed files
with
105,335 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# playback | ||
|
||
## Intent | ||
|
||
The intent of this module is to provide data structures that are useful for playback. | ||
|
||
### Goals | ||
|
||
- **DO** House the logic for constructing valid playback sequences. | ||
- **DO** Provide data structures to discretely navigate a rendering. | ||
- **DO** Expose tools to convert between ticks and time. | ||
|
||
### Non-goals | ||
|
||
- **DO NOT** Contain cursor-specific implementations. | ||
- **DO NOT** Provide the machinery to interpolate between playback steps. | ||
- **DO NOT** Commit a sequence to a prescribed bpm. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Conversions to milliseconds | ||
const ms = (v: number) => v; | ||
const sec = (v: number) => ms(v * 1000); | ||
const min = (v: number) => sec(v * 60); | ||
|
||
export class Duration { | ||
static zero() { | ||
return new Duration(0); | ||
} | ||
|
||
static ms(v: number) { | ||
return new Duration(ms(v)); | ||
} | ||
|
||
static sec(v: number) { | ||
return new Duration(sec(v)); | ||
} | ||
|
||
static minutes(v: number) { | ||
return new Duration(min(v)); | ||
} | ||
|
||
private readonly _ms: number; | ||
|
||
private constructor(ms: number) { | ||
this._ms = ms; | ||
} | ||
|
||
eq(duration: Duration) { | ||
return this.ms === duration.ms; | ||
} | ||
|
||
plus(duration: Duration) { | ||
return Duration.ms(duration.ms + this.ms); | ||
} | ||
|
||
get ms() { | ||
return this._ms; | ||
} | ||
|
||
get sec() { | ||
return this.ms / 1000; | ||
} | ||
|
||
get minutes() { | ||
return this.sec / 60; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './sequence'; |
Oops, something went wrong.