Skip to content

Commit

Permalink
[Docs] Fixed docs (invalid links + wrong images folder cleanup)
Browse files Browse the repository at this point in the history
  • Loading branch information
melanchall committed Jun 20, 2021
1 parent e37d94b commit ee62dfc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Docs/articles/playback/Custom-playback.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Let's see what each method needed for.

## TryPlayEvent

`TryPlayEvent` method called by playback each time an event should be played. Result value of the method tells playback whether the event was played or not. Default implementation of the method just sends a MIDI event to [output device](Melanchall.DryWetMidi.Devices.Playback.OutputDevice) and returns `true`.
`TryPlayEvent` method called by playback each time an event should be played. Result value of the method tells playback whether the event was played or not. Default implementation of the method just sends a MIDI event to [output device](xref:Melanchall.DryWetMidi.Devices.Playback.OutputDevice) and returns `true`.

So you can implement your own logic of playing a MIDI event. Please pay attention to the second parameter of the method - `metadata`. If input objects of playback implement [IMetadata](xref:Melanchall.DryWetMidi.Common.IMetadata) interface, metadata will be passed via that parameter. For example, you can subclass from `TimedEvent` and implement `IMetadata` on a new class, and then create your own playback on instances of that class.

Expand Down
2 changes: 1 addition & 1 deletion Docs/articles/playback/Data-tracking.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@ We have program `Q` active at the current time. But when we jump to a new time (
* pitch bend (see [PitchBendEvent](xref:Melanchall.DryWetMidi.Core.PitchBendEvent))
* control value (see [ControlChangeEvent](xref:Melanchall.DryWetMidi.Core.ControlChangeEvent))

We have discussed tracking program above. But tracking the remaining two parameters is absolutely the same. To track pitch bend value there is [TrackPitchValue](xref:Melanchall.DryWetMidi.Devices.Playback.TrackPitchValue) property. To track control value there is [TrackControlValue](Melanchall.DryWetMidi.Devices.Playback.TrackControlValue) property.
We have discussed tracking program above. But tracking the remaining two parameters is absolutely the same. To track pitch bend value there is [TrackPitchValue](xref:Melanchall.DryWetMidi.Devices.Playback.TrackPitchValue) property. To track control value there is [TrackControlValue](xref:Melanchall.DryWetMidi.Devices.Playback.TrackControlValue) property.

Of course all these parameters are tracked separately for each MIDI channel and in addition to this control value tracked separately for each control number.
28 changes: 25 additions & 3 deletions Resources/Utilities/InlineTextImages/InlineTextImages/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ static void Main(string[] args)
var symbolSize = int.Parse(args[1]);

const string imagesDirectoryName = "images";
const string generatedImagePrefix = "dwmgen_";

Console.WriteLine("Cleaning up images folders...");
Console.WriteLine("--------------------------------");

var htmlFiles = Directory.GetFiles(filesPath, "*.html", SearchOption.AllDirectories);
var directories = htmlFiles
Expand All @@ -50,13 +52,33 @@ static void Main(string[] args)
foreach (var directoryPath in directories)
{
var directoryInfo = new DirectoryInfo(Path.Combine(directoryPath, imagesDirectoryName));
Console.WriteLine($"{directoryInfo.FullName}...");

if (directoryInfo.Exists)
directoryInfo.Delete(true);
{
var generatedImagesFiles = directoryInfo.GetFiles($"{generatedImagePrefix}*.png", SearchOption.AllDirectories);

directoryInfo.Create();
foreach (var fileInfo in generatedImagesFiles)
{
Console.Write($"{fileInfo.FullName}...");

try
{
fileInfo.Delete();
Console.WriteLine("DELETED");
}
catch (Exception ex)
{
Console.WriteLine($"FAILED TO DELETE ({ex.Message})");
}
}
}
else
directoryInfo.Create();
}

Console.WriteLine("Processing files...");
Console.WriteLine("--------------------------------");

foreach (var filePath in htmlFiles)
{
Expand All @@ -75,7 +97,7 @@ static void Main(string[] args)
var imageText = m.Groups[1].Value;
var image = CreateImage(imageText, symbolSize);
var imageFileName = $"{Path.GetFileNameWithoutExtension(filePath)}-{m.Index}.png";
var imageFileName = $"{generatedImagePrefix}{Path.GetFileNameWithoutExtension(filePath)}-{m.Index}.png";
var path = Path.Combine(directoryInfo.FullName, imagesDirectoryName, imageFileName);
image.Save(path);
Expand Down

0 comments on commit ee62dfc

Please sign in to comment.