You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
741 B
24 lines
741 B
// Author: Gockner, Simon
|
|
// Created: 2021-04-09
|
|
// Copyright(c) 2021 SimonG. All Rights Reserved.
|
|
|
|
using Lib.Midi.Messages.Interfaces;
|
|
using NAudio.Midi;
|
|
|
|
namespace Lib.Midi.Messages.Factories
|
|
{
|
|
public class MidiMessageFactory : IMidiMessageFactory
|
|
{
|
|
public IMidiMessage Create(MidiEvent midiEvent)
|
|
{
|
|
if (midiEvent is PitchWheelChangeEvent pitchWheelChangeEvent)
|
|
return new PitchWheelChangeMessage(pitchWheelChangeEvent);
|
|
else if (midiEvent is NoteOnEvent noteOnEvent)
|
|
return new NoteOnMessage(noteOnEvent);
|
|
else if (midiEvent is NoteEvent noteEvent)
|
|
return new NoteMessage(noteEvent);
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |