Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MRIBuilder.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michiel Cottaar
MRIBuilder.jl
Commits
99200dd2
Verified
Commit
99200dd2
authored
1 year ago
by
Michiel Cottaar
Browse files
Options
Downloads
Patches
Plain Diff
Implement parent sequence type
parent
4c98b55a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/all_sequences/all_sequences.jl
+3
-0
3 additions, 0 deletions
src/all_sequences/all_sequences.jl
src/all_sequences/base_sequences.jl
+50
-0
50 additions, 0 deletions
src/all_sequences/base_sequences.jl
with
53 additions
and
0 deletions
src/all_sequences/all_sequences.jl
0 → 100644
+
3
−
0
View file @
99200dd2
module
AllSequences
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/all_sequences/base_sequences.jl
0 → 100644
+
50
−
0
View file @
99200dd2
module
BaseSequences
import
...
ContainerBlocks
:
ContainerBlock
import
...
AllBuildingBlocks
:
BaseBuildingBlock
import
...
Variables
:
TR
,
duration
"""
Super-type of any sequence of non-overlapping building blocks that should be played after each other.
It contains `N` [`ContainerBlock`](@ref) objects (e.g., building blocks or other sequences).
Main interface:
- Acts as an iterable containing the blocks and sequences.
- Indiviual blocks/sequences can be obtained using indexing.
Sub-types need to implement:
- `Base.getindex`: returns the actual component for each integer index in 1:N.
"""
abstract type
BaseSequence
{
N
}
<:
ContainerBlock
end
Base
.
iterate
(
bs
::
BaseSequence
)
=
Base
.
iterate
(
bs
,
1
)
Base
.
iterate
(
bs
::
BaseSequence
{
N
},
index
::
Integer
)
where
{
N
}
=
index
>
N
?
nothing
:
(
bs
[
index
],
index
+
1
)
Base
.
length
(
::
BaseSequence
{
N
})
where
{
N
}
=
N
Base
.
eltype
(
::
Type
{
<:
BaseSequence
})
=
ContainerBlock
"""
nrepeat(sequence)
How often sequence should be repeated.
Set to 0 to repeat indefinetely (default value if not overriden for a particular sequence type).
"""
nrepeat
(
bs
::
BaseSequence
)
=
0
"""
TR(sequence)
On what timescale the sequence should repeat itself in ms (will have no effect if [`nrepeat`](@ref) is one).
By default this is set to the total duration of the sequence.
"""
TR
(
bs
::
BaseSequence
)
=
duration
(
bs
)
duration
(
bs
::
BaseSequence
{
0
})
=
0.
duration
(
bs
::
BaseSequence
)
=
sum
(
duration
.
(
bs
))
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment