Skip to content
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

Remove NAudio midi importer #1174

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 0 additions & 80 deletions OpenUtau.Core/Format/Midi.cs

This file was deleted.

1 change: 0 additions & 1 deletion OpenUtau.Core/OpenUtau.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<PackageReference Include="K4os.Hash.xxHash" Version="1.0.8" />
<PackageReference Include="Melanchall.DryWetMidi" Version="7.0.2" />
<PackageReference Include="NAudio.Core" Version="2.2.1" />
<PackageReference Include="NAudio.Midi" Version="2.2.1" />
<PackageReference Include="NAudio.Vorbis" Version="1.5.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLayer.NAudioSupport" Version="1.4.0" />
Expand Down
4 changes: 2 additions & 2 deletions OpenUtau/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ public void ImportAudio(string file) {
DocManager.Inst.EndUndoGroup();
}

public void ImportMidi(string file, bool UseDrywetmidi = true) {
public void ImportMidi(string file) {
if (file == null) {
return;
}
var project = DocManager.Inst.Project;
var parts = UseDrywetmidi ? Core.Format.MidiWriter.Load(file, project) : Core.Format.Midi.Load(file, project);
var parts = Core.Format.MidiWriter.Load(file, project);
DocManager.Inst.StartUndoGroup();
foreach (var part in parts) {
var track = new UTrack(project);
Expand Down
4 changes: 1 addition & 3 deletions OpenUtau/Views/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@
<MenuItem Header="-" Height="1"/>
<MenuItem Header="{DynamicResource menu.file.importtracks}" Click="OnMenuImportTracks"/>
<MenuItem Header="{DynamicResource menu.file.importaudio}" Click="OnMenuImportAudio"/>
<MenuItem Header="{DynamicResource menu.file.importmidi}">
<MenuItem Header="{DynamicResource menu.file.importmidi.naudio}" Click="OnMenuImportMidiNaudio"/>
<MenuItem Header="{DynamicResource menu.file.importmidi.drywetmidi}" Click="OnMenuImportMidiDrywetmidi"/>
<MenuItem Header="{DynamicResource menu.file.importmidi}" Click="OnMenuImportMidi">
</MenuItem>
<MenuItem Header="-" Height="1"/>
<MenuItem Header="{DynamicResource menu.file.exportaudio}">
Expand Down
12 changes: 2 additions & 10 deletions OpenUtau/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,28 +370,20 @@ async void OnMenuImportAudio(object sender, RoutedEventArgs args) {
}
}

async void OnMenuImportMidi(bool UseDrywetmidi = false) {
async void OnMenuImportMidi(object sender, RoutedEventArgs args) {
var file = await FilePicker.OpenFileAboutProject(
this, "menu.file.importmidi", FilePicker.MIDI);
if (file == null) {
return;
}
try {
viewModel.ImportMidi(file, UseDrywetmidi);
viewModel.ImportMidi(file);
} catch (Exception e) {
Log.Error(e, "Failed to import midi");
_ = await MessageBox.ShowError(this, new MessageCustomizableException("Failed to import midi", "<translate:errors.failed.importmidi>", e));
}
}

void OnMenuImportMidiNaudio(object sender, RoutedEventArgs args) {
OnMenuImportMidi(false);
}

void OnMenuImportMidiDrywetmidi(object sender, RoutedEventArgs args) {
OnMenuImportMidi(true);
}

async void OnMenuExportMixdown(object sender, RoutedEventArgs args) {
var project = DocManager.Inst.Project;
var file = await FilePicker.SaveFileAboutProject(
Expand Down
Loading