private static object FormatNoteNumber(SevenBitNumber noteNumber, MidiFileCsvConversionSettings settings)
        {
            if (settings.CsvLayout == MidiFileCsvLayout.MidiCsv)
            {
                return(noteNumber);
            }

            return(NoteCsvConversionUtilities.FormatNoteNumber(noteNumber, settings.NoteNumberFormat));
        }
Exemplo n.º 2
0
 public static void ConvertToCsv(IEnumerable <Note> notes, Stream stream, TempoMap tempoMap, NoteCsvConversionSettings settings)
 {
     using (var csvWriter = new CsvWriter(stream, settings.CsvDelimiter))
     {
         foreach (var note in notes.Where(n => n != null))
         {
             csvWriter.WriteRecord(new object[]
             {
                 note.TimeAs(settings.TimeType, tempoMap),
                 note.Channel,
                 NoteCsvConversionUtilities.FormatNoteNumber(note.NoteNumber, settings.NoteNumberFormat),
                 note.LengthAs(settings.NoteLengthType, tempoMap),
                 note.Velocity,
                 note.OffVelocity
             });
         }
     }
 }