-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Options page and time to next note indicator added #55
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8a4f8b5
Options page and time to next note
ceakarsu c11e1e2
revert manifest
ceakarsu a6db6f8
revert
ceakarsu f7da8f9
add de
ceakarsu d3f4a93
Add note counts to instrument selection page
ceakarsu ce334a7
merge with origin
ceakarsu 07f20e4
tabs and spaces fix
ceakarsu 8cb200f
Fixes
ceakarsu b11faf6
Resources
ceakarsu bc5e922
merge upstream master
ceakarsu 481c53e
Merge with master
ceakarsu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
58 changes: 58 additions & 0 deletions
58
ProjectCoimbra.UWP/Project.Coimbra.Midi/Models/InstrumentInfo.cs
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,58 @@ | ||
// Licensed under the MIT License. | ||
|
||
namespace Coimbra.Midi.Models | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text.RegularExpressions; | ||
using Melanchall.DryWetMidi.Common; | ||
using Melanchall.DryWetMidi.Standards; | ||
|
||
/// <summary> | ||
/// A class representing an instrument. | ||
/// </summary> | ||
public class InstrumentInfo | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="InstrumentInfo"/> class. | ||
/// </summary> | ||
/// <param name="channel">Channel of the instrument</param> | ||
/// <param name="programNumbers">Program numbers of the instrument</param> | ||
/// <param name="noteCount">Note count of the instrument</param> | ||
public InstrumentInfo(FourBitNumber channel, ICollection<SevenBitNumber> programNumbers, int noteCount) | ||
{ | ||
Channel = channel; | ||
ProgramNumbers = programNumbers; | ||
NoteCount = noteCount; | ||
} | ||
|
||
/// <summary> | ||
/// A string that contains the name and the note count of the instrument | ||
/// </summary> | ||
public string NameAndNoteCount => string.Format(CultureInfo.CurrentUICulture, "{0} - {1} notes", string.Join( | ||
", ", | ||
ProgramNumbers.Select(d => | ||
RegularExpression.Replace( | ||
Enum.GetName(typeof(GeneralMidi2Program), (int)d) ?? throw new InvalidOperationException(), | ||
" $1"))), string.Format(CultureInfo.CurrentUICulture, "{0:#,0}", NoteCount)); | ||
|
||
/// <summary> | ||
/// Channel of the instrument | ||
/// </summary> | ||
public FourBitNumber Channel { get; set; } | ||
|
||
/// <summary> | ||
/// Program number of the instrument | ||
/// </summary> | ||
public ICollection<SevenBitNumber> ProgramNumbers { get; set; } | ||
|
||
/// <summary> | ||
/// Note count of the instrument | ||
/// </summary> | ||
public int NoteCount { get; set; } | ||
|
||
private static readonly Regex RegularExpression = new Regex("(\\B([A-Z]|[0-9]))", RegexOptions.Compiled); | ||
} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to use
TryAdd
here although I'm not sure it's available for the version of .NET we're using.