Skip to content

Commit

Permalink
add short constructor for note
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Feb 17, 2020
1 parent 8828ef7 commit 27f3798
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/note.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ Mutable data structure describing a music note. A bundle of many notes results
in the [`Notes`](@ref) struct, which is the output of the [`getnotes`](@ref)
function.
If the `channel` of the note is `0` (default) it is not printed with `show`.
If the `channel` of the note is `0` (default), it is not shown.
You can also create a `Note` with the following keyword constructor:
```julia
Note(pitch, position; velocity = 100, duration = 960, channel = 0)
```
## Fields:
* `pitch::UInt8` : Pitch, starting from C-1 = 0, adding one per semitone.
Expand Down Expand Up @@ -37,6 +42,9 @@ mutable struct Note <: AbstractNote
new(pitch, velocity, position, duration, channel)
end
end
Note(pitch, position; velocity = 100, duration = 960, channel = 0) =
Note(pitch, velocity, position, duration, channel)

@inline Note(n::Note) = n

import Base.==
Expand Down

2 comments on commit 27f3798

@Datseris
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/9654

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if Julia TagBot is installed, or can be done manually through the github interface, or via:

git tag -a v1.7.1 -m "<description of version>" 27f3798a845e7e3d3ffe1ef476914e9a29379d02
git push origin v1.7.1

Please sign in to comment.