Skip to content

Commit

Permalink
Merge pull request #69 from hiroxpepe/develop
Browse files Browse the repository at this point in the history
refactor: #13 keeping codes clean.
  • Loading branch information
hiroxpepe authored Mar 5, 2022
2 parents 002820e + 0cb5cb5 commit ce60a77
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
6 changes: 3 additions & 3 deletions MidiPlayer.Droid/MainActivity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,9 @@ static void logMemoryInro() {
var maxMemory = Java.Lang.Runtime.GetRuntime().MaxMemory();
var freeMemory = Java.Lang.Runtime.GetRuntime().FreeMemory();
var totalMemory = Java.Lang.Runtime.GetRuntime().TotalMemory();
Log.Info($"maxMemory: {maxMemory.ToMegabytes()}MB");
Log.Info($"freeMemory: {freeMemory.ToMegabytes()}MB");
Log.Info($"totalMemory: {totalMemory.ToMegabytes()}MB");
Log.Debug($"maxMemory: {maxMemory.ToMegabytes()}MB");
Log.Debug($"freeMemory: {freeMemory.ToMegabytes()}MB");
Log.Debug($"totalMemory: {totalMemory.ToMegabytes()}MB");
// TODO: Mono runtime.
}
}
Expand Down
2 changes: 1 addition & 1 deletion MidiPlayer.FluidSynth/MidiPlayer.FluidSynth.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<DefineConstants>RUNTIME_LINUX</DefineConstants>
<DefineConstants>RUNTIME_WINDOWS</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion MidiPlayer.FluidSynth/Synth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static Synth() {
var value = fluid_midi_event_get_value(evt);
var program = fluid_midi_event_get_program(evt);
if (type != 128 && type != 144) { // not note on or note off
Log.Info($"_type: {type} _channel: {channel} _control: {control} _value: {value} _program: {program}");
Log.Debug($"_type: {type} _channel: {channel} _control: {control} _value: {value} _program: {program}");
}
Task.Run(() => {
if (type == 144) { // NOTE_ON = 144
Expand Down
16 changes: 8 additions & 8 deletions MidiPlayer/Conf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public static void Load() {
using var stream = new StreamReader(ConfEnv.ConfPath);
_json = loadJson(stream.ReadToEnd().ToMemoryStream());
Log.Info("Conf loaded.");
Log.Info("Conf soundFontDir: " + _json.App.Synth.SoundFontDir);
Log.Info("Conf soundFontName: " + _json.App.Synth.SoundFontName);
Log.Info("Conf midiFileDir: " + _json.App.Synth.MidiFileDir);
Log.Info("Conf midiFileName: " + _json.App.Synth.MidiFileName);
Log.Debug("Conf soundFontDir: " + _json.App.Synth.SoundFontDir);
Log.Debug("Conf soundFontName: " + _json.App.Synth.SoundFontName);
Log.Debug("Conf midiFileDir: " + _json.App.Synth.MidiFileDir);
Log.Debug("Conf midiFileName: " + _json.App.Synth.MidiFileName);
} else {
Synth synth = new Synth();
synth.SoundFontDir = "undefined";
Expand All @@ -70,10 +70,10 @@ public static void Save() {
using var stream = new FileStream(ConfEnv.ConfPath, FileMode.Create, FileAccess.Write);
saveJson(stream);
Log.Info("Conf saved.");
Log.Info("Conf soundFontDir: " + _json.App.Synth.SoundFontDir);
Log.Info("Conf soundFontName: " + _json.App.Synth.SoundFontName);
Log.Info("Conf midiFileDir: " + _json.App.Synth.MidiFileDir);
Log.Info("Conf midiFileName: " + _json.App.Synth.MidiFileName);
Log.Debug("Conf soundFontDir: " + _json.App.Synth.SoundFontDir);
Log.Debug("Conf soundFontName: " + _json.App.Synth.SoundFontName);
Log.Debug("Conf midiFileDir: " + _json.App.Synth.MidiFileDir);
Log.Debug("Conf midiFileName: " + _json.App.Synth.MidiFileName);
}

///////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 5 additions & 1 deletion MidiPlayer/Log.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,17 @@ public static void Info(string target) {
}

public static void Debug(string target) {
#if DEBUG
LogEventInfo eventInfo = new LogEventInfo(LogLevel.Debug, _logger.Name, target);
_logger.Log(typeof(Log), eventInfo);
#endif
}

public static void Trace(string target) {
#if DEBUG
LogEventInfo eventInfo = new LogEventInfo(LogLevel.Trace, _logger.Name, target);
_logger.Log(typeof(Log), eventInfo);
#endif
}
}
}
}

0 comments on commit ce60a77

Please sign in to comment.