public bool WriteTrackHeader(BinaryWriter writer, IPlayerParameters playerParameters, uint trackLength) { if (writer == null) return false; writer.Write(Encoding.UTF8.GetBytes("MTrk")); writer.Write(this._swapManager.SwapUInt32(trackLength)); if (playerParameters != null) WritePlayerParameters(writer, playerParameters); return true; }
public WhenFileExporterIsCalled() { this.PlayerParameters = new PlayerParameters() { TimeSignatureNominator = 4, TimeSignatureDenominator = 4, TimeSignatureClocksPerBeat = 24, Tempo = 120, TimeSignatureNumberOf32ThNotePerBeat = 4 }; this.OrpheeTrack = new OrpheeTrack(0, Channel.Channel1) { PlayerParameters = this.PlayerParameters, CurrentInstrument = Instrument.OrchestralHarp }; this.OrpheeFile = new OrpheeFile(); this.OrpheeFile.AddNewTrack(this.OrpheeTrack); this.OrpheeFileExporter = new OrpheeFileExporter(new FileHeaderWriter(new SwapManager()), new TrackHeaderWriter(new TimeSignatureMessageWriter(), new TempoMessageWriter(), new SwapManager()), new NoteMessageWriter(new ProgramChangeMessageWriter(), new EndOfTrackMessageWriter())); }
public WhenTempoMessageWriterIsCalled() { this.PlayerParameters = new PlayerParameters() { Tempo = 120 }; this.TempoMessageWriter = new TempoMessageWriter(); var result = InitializeFile("TempoMessageTest.test").Result; }
private void WritePlayerParameters(BinaryWriter writer, IPlayerParameters playerParameters) { this._timeSignatureMessageWriter.WriteTimeSignatureMessage(writer, playerParameters); this._tempoMessageWriter.WriteTempoMessage(writer, playerParameters.Tempo); }