Skip to content

Commit

Permalink
improve printing of TrackEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
Datseris committed Jun 19, 2019
1 parent 186b8b4 commit bbd11ea
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

# master

# v1.3.0
Improved the printing of `TrackEvent`s. They now state the amount of elements in them, as well as listing how many or of each type. E.g.:
```
julia> midi.tracks
5-element Array{MIDITrack,1}:
3-event MIDITrack: 0 MIDI, 3 Meta, 0 Sysex
5729-event MIDITrack: 5728 MIDI, 1 Meta, 0 Sysex
8467-event MIDITrack: 8466 MIDI, 1 Meta, 0 Sysex
21487-event MIDITrack: 21486 MIDI, 1 Meta, 0 Sysex
9773-event MIDITrack: 9772 MIDI, 1 Meta, 0 Sysex
```

# v1.2.0
Removed deprecations.

Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MIDI"
uuid = "f57c4921-e30c-5f49-b073-3f2f2ada663e"
repo = "https://github.com/JuliaMusic/MIDI.jl.git"
version = "1.2.1"
version = "1.3.0"

[deps]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Expand Down
9 changes: 9 additions & 0 deletions src/miditrack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ mutable struct MIDITrack
events::Vector{TrackEvent}
end
MIDITrack() = MIDITrack(TrackEvent[])
# Pretty print
function Base.show(io::IO, t::MIDITrack) where {N}
L = length(t.events)
M = count(x -> x isa MIDIEvent, t.events)
T = count(x -> x isa MetaEvent, t.events)
X = L - M - T
print(io, "$(L)-event MIDITrack: $M MIDI, $T Meta, $X Sysex")
end


function readtrack(f::IO)

Expand Down

2 comments on commit bbd11ea

@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/1464

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.3.0 -m "<description of version>" bbd11ea2486d229306d3802a541bf83b7243ddbd
git push origin v1.3.0

Please sign in to comment.