public function __construct(Song $song) { parent::__construct(); # Build sequence $channelRouter = new ChannelRouter(); $channelRouterConfigurator = new ChannelRouterConfigurator($channelRouter); $channelRouterConfigurator->configureRouter($song->getChannels()); $settings = (new MidiSettings())->getdefaults(); $midiSequenceParser = new MidiSequenceParser($song, self::ADD_FIRST_TICK_MOVE | self::ADD_DEFAULT_CONTROLS | self::ADD_MIXER_MESSAGES); $midiSequenceParser->setTranspose($settings->getTranspose()); $midiSequenceParser->parse(new MidiSequenceHandler($song->countTracks() + 1, $channelRouter, $this)); }
private function writeTracks(Song $song) { for ($i = 0; $i < $song->countTracks(); $i++) { $track = $song->getTrack($i); $this->writeTrack($track); } }