code: func (s *Stream) Write(events []Event) error {
  	size := len(events)
  	if size > maxEventBufferSize {
  		return ErrMaxBuffer
  	}
  	buffer := make([]C.PmEvent, size)
  	for i, evt := range events {
  		var event C.PmEvent
  		event.timestamp = C.PmTimestamp(evt.Timestamp)
  		event.message = C.PmMessage((((evt.Data2 << 16) & 0xFF0000) | ((evt.Data1 << 8) & 0xFF00) | (evt.Status & 0xFF)))
  		buffer[i] = event
  	}
  	return convertToError(C.Pm_Write(unsafe.Pointer(s.pmStream), &buffer[0], C.int32_t(size)))
  }
docs: // Write writes a buffer of MIDI events to the output stream.