// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: midi_internal.proto

#include "midi_internal.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG
namespace midi {
constexpr ContinuousFeature::ContinuousFeature(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : av_polyphony_(0)
  , av_silence_(0)
  , note_duration_(0)
  , note_duration_norm_(0){}
struct ContinuousFeatureDefaultTypeInternal {
  constexpr ContinuousFeatureDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~ContinuousFeatureDefaultTypeInternal() {}
  union {
    ContinuousFeature _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ContinuousFeatureDefaultTypeInternal _ContinuousFeature_default_instance_;
constexpr TrackFeatures::TrackFeatures(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : polyphony_distribution_()
  , genre_str_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , min_pitch_(0)
  , max_pitch_(0)
  , av_polyphony_(0)
  , note_density_(0)
  , note_density_v2_(0)
  , max_polyphony_(0)
  , should_prune_(false)
  , order_(0)
  , note_duration_(0)
  , min_polyphony_q_(0)
  , max_polyphony_q_(0)
  , min_note_duration_q_(0)
  , max_note_duration_q_(0)
  , note_density_value_(0){}
struct TrackFeaturesDefaultTypeInternal {
  constexpr TrackFeaturesDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~TrackFeaturesDefaultTypeInternal() {}
  union {
    TrackFeatures _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT TrackFeaturesDefaultTypeInternal _TrackFeatures_default_instance_;
constexpr Note::Note(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : start_(0)
  , end_(0)
  , pitch_(0){}
struct NoteDefaultTypeInternal {
  constexpr NoteDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~NoteDefaultTypeInternal() {}
  union {
    Note _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT NoteDefaultTypeInternal _Note_default_instance_;
constexpr ValidTrack::ValidTrack(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : tracks_(){}
struct ValidTrackDefaultTypeInternal {
  constexpr ValidTrackDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~ValidTrackDefaultTypeInternal() {}
  union {
    ValidTrack _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ValidTrackDefaultTypeInternal _ValidTrack_default_instance_;
constexpr Dataset_Item::Dataset_Item(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : start_(PROTOBUF_ULONGLONG(0))
  , end_(PROTOBUF_ULONGLONG(0))
  , src_size_(PROTOBUF_ULONGLONG(0)){}
struct Dataset_ItemDefaultTypeInternal {
  constexpr Dataset_ItemDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~Dataset_ItemDefaultTypeInternal() {}
  union {
    Dataset_Item _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT Dataset_ItemDefaultTypeInternal _Dataset_Item_default_instance_;
constexpr Dataset::Dataset(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : train_()
  , valid_()
  , test_(){}
struct DatasetDefaultTypeInternal {
  constexpr DatasetDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~DatasetDefaultTypeInternal() {}
  union {
    Dataset _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT DatasetDefaultTypeInternal _Dataset_default_instance_;
constexpr ModelMetadata::ModelMetadata(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : encoder_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , num_layers_(0)
  , num_heads_(0)
  , num_hidden_(0)
  , model_dim_(0)
  , new_state_(false){}
struct ModelMetadataDefaultTypeInternal {
  constexpr ModelMetadataDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~ModelMetadataDefaultTypeInternal() {}
  union {
    ModelMetadata _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT ModelMetadataDefaultTypeInternal _ModelMetadata_default_instance_;
constexpr GenreData::GenreData(
  ::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized)
  : discogs_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , lastfm_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string)
  , tagtraum_(&::PROTOBUF_NAMESPACE_ID::internal::fixed_address_empty_string){}
struct GenreDataDefaultTypeInternal {
  constexpr GenreDataDefaultTypeInternal()
    : _instance(::PROTOBUF_NAMESPACE_ID::internal::ConstantInitialized{}) {}
  ~GenreDataDefaultTypeInternal() {}
  union {
    GenreData _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT GenreDataDefaultTypeInternal _GenreData_default_instance_;
}  // namespace midi
static ::PROTOBUF_NAMESPACE_ID::Metadata file_level_metadata_midi_5finternal_2eproto[8];
static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_midi_5finternal_2eproto = nullptr;
static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_midi_5finternal_2eproto = nullptr;

const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_midi_5finternal_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, av_polyphony_),
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, av_silence_),
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, note_duration_),
  PROTOBUF_FIELD_OFFSET(::midi::ContinuousFeature, note_duration_norm_),
  0,
  1,
  2,
  3,
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, min_pitch_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, max_pitch_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, av_polyphony_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, note_density_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, note_density_v2_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, max_polyphony_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, should_prune_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, order_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, note_duration_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, genre_str_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, min_polyphony_q_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, max_polyphony_q_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, min_note_duration_q_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, max_note_duration_q_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, polyphony_distribution_),
  PROTOBUF_FIELD_OFFSET(::midi::TrackFeatures, note_density_value_),
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9,
  0,
  10,
  11,
  12,
  13,
  ~0u,
  14,
  PROTOBUF_FIELD_OFFSET(::midi::Note, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::Note, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::Note, start_),
  PROTOBUF_FIELD_OFFSET(::midi::Note, end_),
  PROTOBUF_FIELD_OFFSET(::midi::Note, pitch_),
  0,
  1,
  2,
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::midi::ValidTrack, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::ValidTrack, tracks_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset_Item, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset_Item, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::Dataset_Item, start_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset_Item, end_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset_Item, src_size_),
  0,
  1,
  2,
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::midi::Dataset, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::Dataset, train_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset, valid_),
  PROTOBUF_FIELD_OFFSET(::midi::Dataset, test_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, encoder_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, num_layers_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, num_heads_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, num_hidden_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, model_dim_),
  PROTOBUF_FIELD_OFFSET(::midi::ModelMetadata, new_state_),
  0,
  1,
  2,
  3,
  4,
  5,
  PROTOBUF_FIELD_OFFSET(::midi::GenreData, _has_bits_),
  PROTOBUF_FIELD_OFFSET(::midi::GenreData, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  PROTOBUF_FIELD_OFFSET(::midi::GenreData, discogs_),
  PROTOBUF_FIELD_OFFSET(::midi::GenreData, lastfm_),
  PROTOBUF_FIELD_OFFSET(::midi::GenreData, tagtraum_),
  0,
  1,
  2,
};
static const ::PROTOBUF_NAMESPACE_ID::internal::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, 9, sizeof(::midi::ContinuousFeature)},
  { 13, 34, sizeof(::midi::TrackFeatures)},
  { 50, 58, sizeof(::midi::Note)},
  { 61, -1, sizeof(::midi::ValidTrack)},
  { 67, 75, sizeof(::midi::Dataset_Item)},
  { 78, -1, sizeof(::midi::Dataset)},
  { 86, 97, sizeof(::midi::ModelMetadata)},
  { 103, 111, sizeof(::midi::GenreData)},
};

static ::PROTOBUF_NAMESPACE_ID::Message const * const file_default_instances[] = {
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_ContinuousFeature_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_TrackFeatures_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_Note_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_ValidTrack_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_Dataset_Item_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_Dataset_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_ModelMetadata_default_instance_),
  reinterpret_cast<const ::PROTOBUF_NAMESPACE_ID::Message*>(&::midi::_GenreData_default_instance_),
};

const char descriptor_table_protodef_midi_5finternal_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n\023midi_internal.proto\022\004midi\032 google/prot"
  "obuf/descriptor.proto\"p\n\021ContinuousFeatu"
  "re\022\024\n\014av_polyphony\030\001 \001(\002\022\022\n\nav_silence\030\002"
  " \001(\002\022\025\n\rnote_duration\030\003 \001(\002\022\032\n\022note_dura"
  "tion_norm\030\004 \001(\002\"\210\003\n\rTrackFeatures\022\021\n\tmin"
  "_pitch\030\001 \001(\005\022\021\n\tmax_pitch\030\002 \001(\005\022\024\n\014av_po"
  "lyphony\030\003 \001(\002\022\024\n\014note_density\030\004 \001(\005\022\027\n\017n"
  "ote_density_v2\030\005 \001(\005\022\025\n\rmax_polyphony\030\006 "
  "\001(\005\022\024\n\014should_prune\030\007 \001(\010\022\r\n\005order\030\010 \001(\005"
  "\022\025\n\rnote_duration\030\t \001(\002\022\021\n\tgenre_str\030\n \001"
  "(\t\022\027\n\017min_polyphony_q\030\013 \001(\005\022\027\n\017max_polyp"
  "hony_q\030\014 \001(\005\022\033\n\023min_note_duration_q\030\r \001("
  "\005\022\033\n\023max_note_duration_q\030\016 \001(\005\022\036\n\026polyph"
  "ony_distribution\030\017 \003(\005\022\032\n\022note_density_v"
  "alue\030\020 \001(\002\"1\n\004Note\022\r\n\005start\030\001 \001(\005\022\013\n\003end"
  "\030\002 \001(\005\022\r\n\005pitch\030\003 \001(\005\"\034\n\nValidTrack\022\016\n\006t"
  "racks\030\001 \003(\005\"\247\001\n\007Dataset\022!\n\005train\030\001 \003(\0132\022"
  ".midi.Dataset.Item\022!\n\005valid\030\002 \003(\0132\022.midi"
  ".Dataset.Item\022 \n\004test\030\003 \003(\0132\022.midi.Datas"
  "et.Item\0324\n\004Item\022\r\n\005start\030\001 \002(\004\022\013\n\003end\030\002 "
  "\002(\004\022\020\n\010src_size\030\003 \002(\004\"\201\001\n\rModelMetadata\022"
  "\017\n\007encoder\030\001 \001(\t\022\022\n\nnum_layers\030\002 \001(\005\022\021\n\t"
  "num_heads\030\003 \001(\005\022\022\n\nnum_hidden\030\004 \001(\005\022\021\n\tm"
  "odel_dim\030\005 \001(\005\022\021\n\tnew_state\030\006 \001(\010\">\n\tGen"
  "reData\022\017\n\007discogs\030\001 \001(\t\022\016\n\006lastfm\030\002 \001(\t\022"
  "\020\n\010tagtraum\030\003 \001(\t:/\n\006maxval\022\035.google.pro"
  "tobuf.FieldOptions\030\321\206\003 \001(\005:/\n\006minval\022\035.g"
  "oogle.protobuf.FieldOptions\030\322\206\003 \001(\005:0\n\007f"
  "maxval\022\035.google.protobuf.FieldOptions\030\323\206"
  "\003 \001(\002:0\n\007fminval\022\035.google.protobuf.Field"
  "Options\030\324\206\003 \001(\002"
  ;
static const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable*const descriptor_table_midi_5finternal_2eproto_deps[1] = {
  &::descriptor_table_google_2fprotobuf_2fdescriptor_2eproto,
};
static ::PROTOBUF_NAMESPACE_ID::internal::once_flag descriptor_table_midi_5finternal_2eproto_once;
const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_midi_5finternal_2eproto = {
  false, false, 1215, descriptor_table_protodef_midi_5finternal_2eproto, "midi_internal.proto", 
  &descriptor_table_midi_5finternal_2eproto_once, descriptor_table_midi_5finternal_2eproto_deps, 1, 8,
  schemas, file_default_instances, TableStruct_midi_5finternal_2eproto::offsets,
  file_level_metadata_midi_5finternal_2eproto, file_level_enum_descriptors_midi_5finternal_2eproto, file_level_service_descriptors_midi_5finternal_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK ::PROTOBUF_NAMESPACE_ID::Metadata
descriptor_table_midi_5finternal_2eproto_metadata_getter(int index) {
  ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_midi_5finternal_2eproto);
  return descriptor_table_midi_5finternal_2eproto.file_level_metadata[index];
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY static ::PROTOBUF_NAMESPACE_ID::internal::AddDescriptorsRunner dynamic_init_dummy_midi_5finternal_2eproto(&descriptor_table_midi_5finternal_2eproto);
namespace midi {

// ===================================================================

class ContinuousFeature::_Internal {
 public:
  using HasBits = decltype(std::declval<ContinuousFeature>()._has_bits_);
  static void set_has_av_polyphony(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_av_silence(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_note_duration(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_note_duration_norm(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
};

ContinuousFeature::ContinuousFeature(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.ContinuousFeature)
}
ContinuousFeature::ContinuousFeature(const ContinuousFeature& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::memcpy(&av_polyphony_, &from.av_polyphony_,
    static_cast<size_t>(reinterpret_cast<char*>(&note_duration_norm_) -
    reinterpret_cast<char*>(&av_polyphony_)) + sizeof(note_duration_norm_));
  // @@protoc_insertion_point(copy_constructor:midi.ContinuousFeature)
}

void ContinuousFeature::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&av_polyphony_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&note_duration_norm_) -
    reinterpret_cast<char*>(&av_polyphony_)) + sizeof(note_duration_norm_));
}

ContinuousFeature::~ContinuousFeature() {
  // @@protoc_insertion_point(destructor:midi.ContinuousFeature)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void ContinuousFeature::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
}

void ContinuousFeature::ArenaDtor(void* object) {
  ContinuousFeature* _this = reinterpret_cast< ContinuousFeature* >(object);
  (void)_this;
}
void ContinuousFeature::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void ContinuousFeature::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void ContinuousFeature::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.ContinuousFeature)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    ::memset(&av_polyphony_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&note_duration_norm_) -
        reinterpret_cast<char*>(&av_polyphony_)) + sizeof(note_duration_norm_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* ContinuousFeature::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // optional float av_polyphony = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
          _Internal::set_has_av_polyphony(&has_bits);
          av_polyphony_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      // optional float av_silence = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 21)) {
          _Internal::set_has_av_silence(&has_bits);
          av_silence_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      // optional float note_duration = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 29)) {
          _Internal::set_has_note_duration(&has_bits);
          note_duration_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      // optional float note_duration_norm = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 37)) {
          _Internal::set_has_note_duration_norm(&has_bits);
          note_duration_norm_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* ContinuousFeature::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.ContinuousFeature)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional float av_polyphony = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_av_polyphony(), target);
  }

  // optional float av_silence = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(2, this->_internal_av_silence(), target);
  }

  // optional float note_duration = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->_internal_note_duration(), target);
  }

  // optional float note_duration_norm = 4;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(4, this->_internal_note_duration_norm(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.ContinuousFeature)
  return target;
}

size_t ContinuousFeature::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.ContinuousFeature)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    // optional float av_polyphony = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 + 4;
    }

    // optional float av_silence = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 + 4;
    }

    // optional float note_duration = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 + 4;
    }

    // optional float note_duration_norm = 4;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 + 4;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ContinuousFeature::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.ContinuousFeature)
  GOOGLE_DCHECK_NE(&from, this);
  const ContinuousFeature* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ContinuousFeature>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.ContinuousFeature)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.ContinuousFeature)
    MergeFrom(*source);
  }
}

void ContinuousFeature::MergeFrom(const ContinuousFeature& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.ContinuousFeature)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000000fu) {
    if (cached_has_bits & 0x00000001u) {
      av_polyphony_ = from.av_polyphony_;
    }
    if (cached_has_bits & 0x00000002u) {
      av_silence_ = from.av_silence_;
    }
    if (cached_has_bits & 0x00000004u) {
      note_duration_ = from.note_duration_;
    }
    if (cached_has_bits & 0x00000008u) {
      note_duration_norm_ = from.note_duration_norm_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void ContinuousFeature::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.ContinuousFeature)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void ContinuousFeature::CopyFrom(const ContinuousFeature& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.ContinuousFeature)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool ContinuousFeature::IsInitialized() const {
  return true;
}

void ContinuousFeature::InternalSwap(ContinuousFeature* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(ContinuousFeature, note_duration_norm_)
      + sizeof(ContinuousFeature::note_duration_norm_)
      - PROTOBUF_FIELD_OFFSET(ContinuousFeature, av_polyphony_)>(
          reinterpret_cast<char*>(&av_polyphony_),
          reinterpret_cast<char*>(&other->av_polyphony_));
}

::PROTOBUF_NAMESPACE_ID::Metadata ContinuousFeature::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class TrackFeatures::_Internal {
 public:
  using HasBits = decltype(std::declval<TrackFeatures>()._has_bits_);
  static void set_has_min_pitch(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_max_pitch(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_av_polyphony(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_note_density(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_note_density_v2(HasBits* has_bits) {
    (*has_bits)[0] |= 32u;
  }
  static void set_has_max_polyphony(HasBits* has_bits) {
    (*has_bits)[0] |= 64u;
  }
  static void set_has_should_prune(HasBits* has_bits) {
    (*has_bits)[0] |= 128u;
  }
  static void set_has_order(HasBits* has_bits) {
    (*has_bits)[0] |= 256u;
  }
  static void set_has_note_duration(HasBits* has_bits) {
    (*has_bits)[0] |= 512u;
  }
  static void set_has_genre_str(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_min_polyphony_q(HasBits* has_bits) {
    (*has_bits)[0] |= 1024u;
  }
  static void set_has_max_polyphony_q(HasBits* has_bits) {
    (*has_bits)[0] |= 2048u;
  }
  static void set_has_min_note_duration_q(HasBits* has_bits) {
    (*has_bits)[0] |= 4096u;
  }
  static void set_has_max_note_duration_q(HasBits* has_bits) {
    (*has_bits)[0] |= 8192u;
  }
  static void set_has_note_density_value(HasBits* has_bits) {
    (*has_bits)[0] |= 16384u;
  }
};

TrackFeatures::TrackFeatures(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena),
  polyphony_distribution_(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.TrackFeatures)
}
TrackFeatures::TrackFeatures(const TrackFeatures& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_),
      polyphony_distribution_(from.polyphony_distribution_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  genre_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_genre_str()) {
    genre_str_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_genre_str(), 
      GetArena());
  }
  ::memcpy(&min_pitch_, &from.min_pitch_,
    static_cast<size_t>(reinterpret_cast<char*>(&note_density_value_) -
    reinterpret_cast<char*>(&min_pitch_)) + sizeof(note_density_value_));
  // @@protoc_insertion_point(copy_constructor:midi.TrackFeatures)
}

void TrackFeatures::SharedCtor() {
genre_str_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&min_pitch_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&note_density_value_) -
    reinterpret_cast<char*>(&min_pitch_)) + sizeof(note_density_value_));
}

TrackFeatures::~TrackFeatures() {
  // @@protoc_insertion_point(destructor:midi.TrackFeatures)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void TrackFeatures::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
  genre_str_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void TrackFeatures::ArenaDtor(void* object) {
  TrackFeatures* _this = reinterpret_cast< TrackFeatures* >(object);
  (void)_this;
}
void TrackFeatures::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void TrackFeatures::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void TrackFeatures::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.TrackFeatures)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  polyphony_distribution_.Clear();
  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    genre_str_.ClearNonDefaultToEmpty();
  }
  if (cached_has_bits & 0x000000feu) {
    ::memset(&min_pitch_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&should_prune_) -
        reinterpret_cast<char*>(&min_pitch_)) + sizeof(should_prune_));
  }
  if (cached_has_bits & 0x00007f00u) {
    ::memset(&order_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&note_density_value_) -
        reinterpret_cast<char*>(&order_)) + sizeof(note_density_value_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* TrackFeatures::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // optional int32 min_pitch = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
          _Internal::set_has_min_pitch(&has_bits);
          min_pitch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 max_pitch = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
          _Internal::set_has_max_pitch(&has_bits);
          max_pitch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional float av_polyphony = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 29)) {
          _Internal::set_has_av_polyphony(&has_bits);
          av_polyphony_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      // optional int32 note_density = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
          _Internal::set_has_note_density(&has_bits);
          note_density_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 note_density_v2 = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
          _Internal::set_has_note_density_v2(&has_bits);
          note_density_v2_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 max_polyphony = 6;
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
          _Internal::set_has_max_polyphony(&has_bits);
          max_polyphony_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional bool should_prune = 7;
      case 7:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
          _Internal::set_has_should_prune(&has_bits);
          should_prune_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 order = 8;
      case 8:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) {
          _Internal::set_has_order(&has_bits);
          order_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional float note_duration = 9;
      case 9:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 77)) {
          _Internal::set_has_note_duration(&has_bits);
          note_duration_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      // optional string genre_str = 10;
      case 10:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
          auto str = _internal_mutable_genre_str();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          #ifndef NDEBUG
          ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "midi.TrackFeatures.genre_str");
          #endif  // !NDEBUG
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 min_polyphony_q = 11;
      case 11:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 88)) {
          _Internal::set_has_min_polyphony_q(&has_bits);
          min_polyphony_q_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 max_polyphony_q = 12;
      case 12:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 96)) {
          _Internal::set_has_max_polyphony_q(&has_bits);
          max_polyphony_q_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 min_note_duration_q = 13;
      case 13:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 104)) {
          _Internal::set_has_min_note_duration_q(&has_bits);
          min_note_duration_q_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 max_note_duration_q = 14;
      case 14:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 112)) {
          _Internal::set_has_max_note_duration_q(&has_bits);
          max_note_duration_q_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // repeated int32 polyphony_distribution = 15;
      case 15:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 120)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_polyphony_distribution(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<120>(ptr));
        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_polyphony_distribution(), ptr, ctx);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional float note_density_value = 16;
      case 16:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 133)) {
          _Internal::set_has_note_density_value(&has_bits);
          note_density_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* TrackFeatures::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.TrackFeatures)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 min_pitch = 1;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_min_pitch(), target);
  }

  // optional int32 max_pitch = 2;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_max_pitch(), target);
  }

  // optional float av_polyphony = 3;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(3, this->_internal_av_polyphony(), target);
  }

  // optional int32 note_density = 4;
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_note_density(), target);
  }

  // optional int32 note_density_v2 = 5;
  if (cached_has_bits & 0x00000020u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_note_density_v2(), target);
  }

  // optional int32 max_polyphony = 6;
  if (cached_has_bits & 0x00000040u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(6, this->_internal_max_polyphony(), target);
  }

  // optional bool should_prune = 7;
  if (cached_has_bits & 0x00000080u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(7, this->_internal_should_prune(), target);
  }

  // optional int32 order = 8;
  if (cached_has_bits & 0x00000100u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(8, this->_internal_order(), target);
  }

  // optional float note_duration = 9;
  if (cached_has_bits & 0x00000200u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(9, this->_internal_note_duration(), target);
  }

  // optional string genre_str = 10;
  if (cached_has_bits & 0x00000001u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_genre_str().data(), static_cast<int>(this->_internal_genre_str().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "midi.TrackFeatures.genre_str");
    target = stream->WriteStringMaybeAliased(
        10, this->_internal_genre_str(), target);
  }

  // optional int32 min_polyphony_q = 11;
  if (cached_has_bits & 0x00000400u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(11, this->_internal_min_polyphony_q(), target);
  }

  // optional int32 max_polyphony_q = 12;
  if (cached_has_bits & 0x00000800u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(12, this->_internal_max_polyphony_q(), target);
  }

  // optional int32 min_note_duration_q = 13;
  if (cached_has_bits & 0x00001000u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(13, this->_internal_min_note_duration_q(), target);
  }

  // optional int32 max_note_duration_q = 14;
  if (cached_has_bits & 0x00002000u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(14, this->_internal_max_note_duration_q(), target);
  }

  // repeated int32 polyphony_distribution = 15;
  for (int i = 0, n = this->_internal_polyphony_distribution_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(15, this->_internal_polyphony_distribution(i), target);
  }

  // optional float note_density_value = 16;
  if (cached_has_bits & 0x00004000u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(16, this->_internal_note_density_value(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.TrackFeatures)
  return target;
}

size_t TrackFeatures::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.TrackFeatures)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated int32 polyphony_distribution = 15;
  {
    size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      Int32Size(this->polyphony_distribution_);
    total_size += 1 *
                  ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_polyphony_distribution_size());
    total_size += data_size;
  }

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    // optional string genre_str = 10;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_genre_str());
    }

    // optional int32 min_pitch = 1;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_min_pitch());
    }

    // optional int32 max_pitch = 2;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_max_pitch());
    }

    // optional float av_polyphony = 3;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 + 4;
    }

    // optional int32 note_density = 4;
    if (cached_has_bits & 0x00000010u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_note_density());
    }

    // optional int32 note_density_v2 = 5;
    if (cached_has_bits & 0x00000020u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_note_density_v2());
    }

    // optional int32 max_polyphony = 6;
    if (cached_has_bits & 0x00000040u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_max_polyphony());
    }

    // optional bool should_prune = 7;
    if (cached_has_bits & 0x00000080u) {
      total_size += 1 + 1;
    }

  }
  if (cached_has_bits & 0x00007f00u) {
    // optional int32 order = 8;
    if (cached_has_bits & 0x00000100u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_order());
    }

    // optional float note_duration = 9;
    if (cached_has_bits & 0x00000200u) {
      total_size += 1 + 4;
    }

    // optional int32 min_polyphony_q = 11;
    if (cached_has_bits & 0x00000400u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_min_polyphony_q());
    }

    // optional int32 max_polyphony_q = 12;
    if (cached_has_bits & 0x00000800u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_max_polyphony_q());
    }

    // optional int32 min_note_duration_q = 13;
    if (cached_has_bits & 0x00001000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_min_note_duration_q());
    }

    // optional int32 max_note_duration_q = 14;
    if (cached_has_bits & 0x00002000u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_max_note_duration_q());
    }

    // optional float note_density_value = 16;
    if (cached_has_bits & 0x00004000u) {
      total_size += 2 + 4;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void TrackFeatures::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.TrackFeatures)
  GOOGLE_DCHECK_NE(&from, this);
  const TrackFeatures* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<TrackFeatures>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.TrackFeatures)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.TrackFeatures)
    MergeFrom(*source);
  }
}

void TrackFeatures::MergeFrom(const TrackFeatures& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.TrackFeatures)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  polyphony_distribution_.MergeFrom(from.polyphony_distribution_);
  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x000000ffu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_genre_str(from._internal_genre_str());
    }
    if (cached_has_bits & 0x00000002u) {
      min_pitch_ = from.min_pitch_;
    }
    if (cached_has_bits & 0x00000004u) {
      max_pitch_ = from.max_pitch_;
    }
    if (cached_has_bits & 0x00000008u) {
      av_polyphony_ = from.av_polyphony_;
    }
    if (cached_has_bits & 0x00000010u) {
      note_density_ = from.note_density_;
    }
    if (cached_has_bits & 0x00000020u) {
      note_density_v2_ = from.note_density_v2_;
    }
    if (cached_has_bits & 0x00000040u) {
      max_polyphony_ = from.max_polyphony_;
    }
    if (cached_has_bits & 0x00000080u) {
      should_prune_ = from.should_prune_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  if (cached_has_bits & 0x00007f00u) {
    if (cached_has_bits & 0x00000100u) {
      order_ = from.order_;
    }
    if (cached_has_bits & 0x00000200u) {
      note_duration_ = from.note_duration_;
    }
    if (cached_has_bits & 0x00000400u) {
      min_polyphony_q_ = from.min_polyphony_q_;
    }
    if (cached_has_bits & 0x00000800u) {
      max_polyphony_q_ = from.max_polyphony_q_;
    }
    if (cached_has_bits & 0x00001000u) {
      min_note_duration_q_ = from.min_note_duration_q_;
    }
    if (cached_has_bits & 0x00002000u) {
      max_note_duration_q_ = from.max_note_duration_q_;
    }
    if (cached_has_bits & 0x00004000u) {
      note_density_value_ = from.note_density_value_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void TrackFeatures::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.TrackFeatures)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void TrackFeatures::CopyFrom(const TrackFeatures& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.TrackFeatures)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool TrackFeatures::IsInitialized() const {
  return true;
}

void TrackFeatures::InternalSwap(TrackFeatures* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  polyphony_distribution_.InternalSwap(&other->polyphony_distribution_);
  genre_str_.Swap(&other->genre_str_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(TrackFeatures, note_density_value_)
      + sizeof(TrackFeatures::note_density_value_)
      - PROTOBUF_FIELD_OFFSET(TrackFeatures, min_pitch_)>(
          reinterpret_cast<char*>(&min_pitch_),
          reinterpret_cast<char*>(&other->min_pitch_));
}

::PROTOBUF_NAMESPACE_ID::Metadata TrackFeatures::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class Note::_Internal {
 public:
  using HasBits = decltype(std::declval<Note>()._has_bits_);
  static void set_has_start(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_end(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_pitch(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
};

Note::Note(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.Note)
}
Note::Note(const Note& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::memcpy(&start_, &from.start_,
    static_cast<size_t>(reinterpret_cast<char*>(&pitch_) -
    reinterpret_cast<char*>(&start_)) + sizeof(pitch_));
  // @@protoc_insertion_point(copy_constructor:midi.Note)
}

void Note::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&pitch_) -
    reinterpret_cast<char*>(&start_)) + sizeof(pitch_));
}

Note::~Note() {
  // @@protoc_insertion_point(destructor:midi.Note)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void Note::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
}

void Note::ArenaDtor(void* object) {
  Note* _this = reinterpret_cast< Note* >(object);
  (void)_this;
}
void Note::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Note::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Note::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.Note)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    ::memset(&start_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&pitch_) -
        reinterpret_cast<char*>(&start_)) + sizeof(pitch_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* Note::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // optional int32 start = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
          _Internal::set_has_start(&has_bits);
          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 end = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
          _Internal::set_has_end(&has_bits);
          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 pitch = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          _Internal::set_has_pitch(&has_bits);
          pitch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* Note::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.Note)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional int32 start = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_start(), target);
  }

  // optional int32 end = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_end(), target);
  }

  // optional int32 pitch = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_pitch(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.Note)
  return target;
}

size_t Note::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.Note)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    // optional int32 start = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_start());
    }

    // optional int32 end = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_end());
    }

    // optional int32 pitch = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_pitch());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Note::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.Note)
  GOOGLE_DCHECK_NE(&from, this);
  const Note* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Note>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.Note)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.Note)
    MergeFrom(*source);
  }
}

void Note::MergeFrom(const Note& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.Note)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      start_ = from.start_;
    }
    if (cached_has_bits & 0x00000002u) {
      end_ = from.end_;
    }
    if (cached_has_bits & 0x00000004u) {
      pitch_ = from.pitch_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void Note::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.Note)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void Note::CopyFrom(const Note& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.Note)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Note::IsInitialized() const {
  return true;
}

void Note::InternalSwap(Note* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(Note, pitch_)
      + sizeof(Note::pitch_)
      - PROTOBUF_FIELD_OFFSET(Note, start_)>(
          reinterpret_cast<char*>(&start_),
          reinterpret_cast<char*>(&other->start_));
}

::PROTOBUF_NAMESPACE_ID::Metadata Note::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class ValidTrack::_Internal {
 public:
};

ValidTrack::ValidTrack(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena),
  tracks_(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.ValidTrack)
}
ValidTrack::ValidTrack(const ValidTrack& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      tracks_(from.tracks_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:midi.ValidTrack)
}

void ValidTrack::SharedCtor() {
}

ValidTrack::~ValidTrack() {
  // @@protoc_insertion_point(destructor:midi.ValidTrack)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void ValidTrack::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
}

void ValidTrack::ArenaDtor(void* object) {
  ValidTrack* _this = reinterpret_cast< ValidTrack* >(object);
  (void)_this;
}
void ValidTrack::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void ValidTrack::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void ValidTrack::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.ValidTrack)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  tracks_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* ValidTrack::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // repeated int32 tracks = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
          ptr -= 1;
          do {
            ptr += 1;
            _internal_add_tracks(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<8>(ptr));
        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10) {
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_tracks(), ptr, ctx);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* ValidTrack::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.ValidTrack)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated int32 tracks = 1;
  for (int i = 0, n = this->_internal_tracks_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(1, this->_internal_tracks(i), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.ValidTrack)
  return target;
}

size_t ValidTrack::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.ValidTrack)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated int32 tracks = 1;
  {
    size_t data_size = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      Int32Size(this->tracks_);
    total_size += 1 *
                  ::PROTOBUF_NAMESPACE_ID::internal::FromIntSize(this->_internal_tracks_size());
    total_size += data_size;
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ValidTrack::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.ValidTrack)
  GOOGLE_DCHECK_NE(&from, this);
  const ValidTrack* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ValidTrack>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.ValidTrack)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.ValidTrack)
    MergeFrom(*source);
  }
}

void ValidTrack::MergeFrom(const ValidTrack& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.ValidTrack)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  tracks_.MergeFrom(from.tracks_);
}

void ValidTrack::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.ValidTrack)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void ValidTrack::CopyFrom(const ValidTrack& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.ValidTrack)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool ValidTrack::IsInitialized() const {
  return true;
}

void ValidTrack::InternalSwap(ValidTrack* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  tracks_.InternalSwap(&other->tracks_);
}

::PROTOBUF_NAMESPACE_ID::Metadata ValidTrack::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class Dataset_Item::_Internal {
 public:
  using HasBits = decltype(std::declval<Dataset_Item>()._has_bits_);
  static void set_has_start(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_end(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_src_size(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static bool MissingRequiredFields(const HasBits& has_bits) {
    return ((has_bits[0] & 0x00000007) ^ 0x00000007) != 0;
  }
};

Dataset_Item::Dataset_Item(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.Dataset.Item)
}
Dataset_Item::Dataset_Item(const Dataset_Item& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::memcpy(&start_, &from.start_,
    static_cast<size_t>(reinterpret_cast<char*>(&src_size_) -
    reinterpret_cast<char*>(&start_)) + sizeof(src_size_));
  // @@protoc_insertion_point(copy_constructor:midi.Dataset.Item)
}

void Dataset_Item::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&src_size_) -
    reinterpret_cast<char*>(&start_)) + sizeof(src_size_));
}

Dataset_Item::~Dataset_Item() {
  // @@protoc_insertion_point(destructor:midi.Dataset.Item)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void Dataset_Item::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
}

void Dataset_Item::ArenaDtor(void* object) {
  Dataset_Item* _this = reinterpret_cast< Dataset_Item* >(object);
  (void)_this;
}
void Dataset_Item::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Dataset_Item::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Dataset_Item::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.Dataset.Item)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    ::memset(&start_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&src_size_) -
        reinterpret_cast<char*>(&start_)) + sizeof(src_size_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* Dataset_Item::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // required uint64 start = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
          _Internal::set_has_start(&has_bits);
          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // required uint64 end = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
          _Internal::set_has_end(&has_bits);
          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // required uint64 src_size = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          _Internal::set_has_src_size(&has_bits);
          src_size_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* Dataset_Item::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.Dataset.Item)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required uint64 start = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(1, this->_internal_start(), target);
  }

  // required uint64 end = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(2, this->_internal_end(), target);
  }

  // required uint64 src_size = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt64ToArray(3, this->_internal_src_size(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.Dataset.Item)
  return target;
}

size_t Dataset_Item::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:midi.Dataset.Item)
  size_t total_size = 0;

  if (_internal_has_start()) {
    // required uint64 start = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_start());
  }

  if (_internal_has_end()) {
    // required uint64 end = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_end());
  }

  if (_internal_has_src_size()) {
    // required uint64 src_size = 3;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_src_size());
  }

  return total_size;
}
size_t Dataset_Item::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.Dataset.Item)
  size_t total_size = 0;

  if (((_has_bits_[0] & 0x00000007) ^ 0x00000007) == 0) {  // All required fields are present.
    // required uint64 start = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_start());

    // required uint64 end = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_end());

    // required uint64 src_size = 3;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::UInt64Size(
        this->_internal_src_size());

  } else {
    total_size += RequiredFieldsByteSizeFallback();
  }
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Dataset_Item::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.Dataset.Item)
  GOOGLE_DCHECK_NE(&from, this);
  const Dataset_Item* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Dataset_Item>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.Dataset.Item)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.Dataset.Item)
    MergeFrom(*source);
  }
}

void Dataset_Item::MergeFrom(const Dataset_Item& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.Dataset.Item)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      start_ = from.start_;
    }
    if (cached_has_bits & 0x00000002u) {
      end_ = from.end_;
    }
    if (cached_has_bits & 0x00000004u) {
      src_size_ = from.src_size_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void Dataset_Item::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.Dataset.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void Dataset_Item::CopyFrom(const Dataset_Item& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.Dataset.Item)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Dataset_Item::IsInitialized() const {
  if (_Internal::MissingRequiredFields(_has_bits_)) return false;
  return true;
}

void Dataset_Item::InternalSwap(Dataset_Item* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(Dataset_Item, src_size_)
      + sizeof(Dataset_Item::src_size_)
      - PROTOBUF_FIELD_OFFSET(Dataset_Item, start_)>(
          reinterpret_cast<char*>(&start_),
          reinterpret_cast<char*>(&other->start_));
}

::PROTOBUF_NAMESPACE_ID::Metadata Dataset_Item::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class Dataset::_Internal {
 public:
};

Dataset::Dataset(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena),
  train_(arena),
  valid_(arena),
  test_(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.Dataset)
}
Dataset::Dataset(const Dataset& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      train_(from.train_),
      valid_(from.valid_),
      test_(from.test_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:midi.Dataset)
}

void Dataset::SharedCtor() {
}

Dataset::~Dataset() {
  // @@protoc_insertion_point(destructor:midi.Dataset)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void Dataset::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
}

void Dataset::ArenaDtor(void* object) {
  Dataset* _this = reinterpret_cast< Dataset* >(object);
  (void)_this;
}
void Dataset::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void Dataset::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Dataset::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.Dataset)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  train_.Clear();
  valid_.Clear();
  test_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* Dataset::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // repeated .midi.Dataset.Item train = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_train(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
        } else goto handle_unusual;
        continue;
      // repeated .midi.Dataset.Item valid = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_valid(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<18>(ptr));
        } else goto handle_unusual;
        continue;
      // repeated .midi.Dataset.Item test = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_test(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<26>(ptr));
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* Dataset::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.Dataset)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .midi.Dataset.Item train = 1;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_train_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, this->_internal_train(i), target, stream);
  }

  // repeated .midi.Dataset.Item valid = 2;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_valid_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, this->_internal_valid(i), target, stream);
  }

  // repeated .midi.Dataset.Item test = 3;
  for (unsigned int i = 0,
      n = static_cast<unsigned int>(this->_internal_test_size()); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(3, this->_internal_test(i), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.Dataset)
  return target;
}

size_t Dataset::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.Dataset)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .midi.Dataset.Item train = 1;
  total_size += 1UL * this->_internal_train_size();
  for (const auto& msg : this->train_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated .midi.Dataset.Item valid = 2;
  total_size += 1UL * this->_internal_valid_size();
  for (const auto& msg : this->valid_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  // repeated .midi.Dataset.Item test = 3;
  total_size += 1UL * this->_internal_test_size();
  for (const auto& msg : this->test_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Dataset::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.Dataset)
  GOOGLE_DCHECK_NE(&from, this);
  const Dataset* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<Dataset>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.Dataset)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.Dataset)
    MergeFrom(*source);
  }
}

void Dataset::MergeFrom(const Dataset& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.Dataset)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  train_.MergeFrom(from.train_);
  valid_.MergeFrom(from.valid_);
  test_.MergeFrom(from.test_);
}

void Dataset::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.Dataset)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void Dataset::CopyFrom(const Dataset& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.Dataset)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool Dataset::IsInitialized() const {
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(train_)) return false;
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(valid_)) return false;
  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(test_)) return false;
  return true;
}

void Dataset::InternalSwap(Dataset* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  train_.InternalSwap(&other->train_);
  valid_.InternalSwap(&other->valid_);
  test_.InternalSwap(&other->test_);
}

::PROTOBUF_NAMESPACE_ID::Metadata Dataset::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class ModelMetadata::_Internal {
 public:
  using HasBits = decltype(std::declval<ModelMetadata>()._has_bits_);
  static void set_has_encoder(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_num_layers(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_num_heads(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_num_hidden(HasBits* has_bits) {
    (*has_bits)[0] |= 8u;
  }
  static void set_has_model_dim(HasBits* has_bits) {
    (*has_bits)[0] |= 16u;
  }
  static void set_has_new_state(HasBits* has_bits) {
    (*has_bits)[0] |= 32u;
  }
};

ModelMetadata::ModelMetadata(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.ModelMetadata)
}
ModelMetadata::ModelMetadata(const ModelMetadata& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  encoder_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_encoder()) {
    encoder_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_encoder(), 
      GetArena());
  }
  ::memcpy(&num_layers_, &from.num_layers_,
    static_cast<size_t>(reinterpret_cast<char*>(&new_state_) -
    reinterpret_cast<char*>(&num_layers_)) + sizeof(new_state_));
  // @@protoc_insertion_point(copy_constructor:midi.ModelMetadata)
}

void ModelMetadata::SharedCtor() {
encoder_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&num_layers_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&new_state_) -
    reinterpret_cast<char*>(&num_layers_)) + sizeof(new_state_));
}

ModelMetadata::~ModelMetadata() {
  // @@protoc_insertion_point(destructor:midi.ModelMetadata)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void ModelMetadata::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
  encoder_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void ModelMetadata::ArenaDtor(void* object) {
  ModelMetadata* _this = reinterpret_cast< ModelMetadata* >(object);
  (void)_this;
}
void ModelMetadata::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void ModelMetadata::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void ModelMetadata::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.ModelMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    encoder_.ClearNonDefaultToEmpty();
  }
  if (cached_has_bits & 0x0000003eu) {
    ::memset(&num_layers_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&new_state_) -
        reinterpret_cast<char*>(&num_layers_)) + sizeof(new_state_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* ModelMetadata::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // optional string encoder = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_encoder();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          #ifndef NDEBUG
          ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "midi.ModelMetadata.encoder");
          #endif  // !NDEBUG
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 num_layers = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
          _Internal::set_has_num_layers(&has_bits);
          num_layers_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 num_heads = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
          _Internal::set_has_num_heads(&has_bits);
          num_heads_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 num_hidden = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
          _Internal::set_has_num_hidden(&has_bits);
          num_hidden_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional int32 model_dim = 5;
      case 5:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
          _Internal::set_has_model_dim(&has_bits);
          model_dim_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional bool new_state = 6;
      case 6:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
          _Internal::set_has_new_state(&has_bits);
          new_state_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* ModelMetadata::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.ModelMetadata)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional string encoder = 1;
  if (cached_has_bits & 0x00000001u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_encoder().data(), static_cast<int>(this->_internal_encoder().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "midi.ModelMetadata.encoder");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_encoder(), target);
  }

  // optional int32 num_layers = 2;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_num_layers(), target);
  }

  // optional int32 num_heads = 3;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(3, this->_internal_num_heads(), target);
  }

  // optional int32 num_hidden = 4;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(4, this->_internal_num_hidden(), target);
  }

  // optional int32 model_dim = 5;
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(5, this->_internal_model_dim(), target);
  }

  // optional bool new_state = 6;
  if (cached_has_bits & 0x00000020u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteBoolToArray(6, this->_internal_new_state(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.ModelMetadata)
  return target;
}

size_t ModelMetadata::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.ModelMetadata)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x0000003fu) {
    // optional string encoder = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_encoder());
    }

    // optional int32 num_layers = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_num_layers());
    }

    // optional int32 num_heads = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_num_heads());
    }

    // optional int32 num_hidden = 4;
    if (cached_has_bits & 0x00000008u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_num_hidden());
    }

    // optional int32 model_dim = 5;
    if (cached_has_bits & 0x00000010u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
          this->_internal_model_dim());
    }

    // optional bool new_state = 6;
    if (cached_has_bits & 0x00000020u) {
      total_size += 1 + 1;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void ModelMetadata::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.ModelMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  const ModelMetadata* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<ModelMetadata>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.ModelMetadata)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.ModelMetadata)
    MergeFrom(*source);
  }
}

void ModelMetadata::MergeFrom(const ModelMetadata& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.ModelMetadata)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x0000003fu) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_encoder(from._internal_encoder());
    }
    if (cached_has_bits & 0x00000002u) {
      num_layers_ = from.num_layers_;
    }
    if (cached_has_bits & 0x00000004u) {
      num_heads_ = from.num_heads_;
    }
    if (cached_has_bits & 0x00000008u) {
      num_hidden_ = from.num_hidden_;
    }
    if (cached_has_bits & 0x00000010u) {
      model_dim_ = from.model_dim_;
    }
    if (cached_has_bits & 0x00000020u) {
      new_state_ = from.new_state_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
}

void ModelMetadata::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.ModelMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void ModelMetadata::CopyFrom(const ModelMetadata& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.ModelMetadata)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool ModelMetadata::IsInitialized() const {
  return true;
}

void ModelMetadata::InternalSwap(ModelMetadata* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  encoder_.Swap(&other->encoder_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(ModelMetadata, new_state_)
      + sizeof(ModelMetadata::new_state_)
      - PROTOBUF_FIELD_OFFSET(ModelMetadata, num_layers_)>(
          reinterpret_cast<char*>(&num_layers_),
          reinterpret_cast<char*>(&other->num_layers_));
}

::PROTOBUF_NAMESPACE_ID::Metadata ModelMetadata::GetMetadata() const {
  return GetMetadataStatic();
}


// ===================================================================

class GenreData::_Internal {
 public:
  using HasBits = decltype(std::declval<GenreData>()._has_bits_);
  static void set_has_discogs(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_lastfm(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
  static void set_has_tagtraum(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
};

GenreData::GenreData(::PROTOBUF_NAMESPACE_ID::Arena* arena)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena) {
  SharedCtor();
  RegisterArenaDtor(arena);
  // @@protoc_insertion_point(arena_constructor:midi.GenreData)
}
GenreData::GenreData(const GenreData& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  discogs_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_discogs()) {
    discogs_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_discogs(), 
      GetArena());
  }
  lastfm_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_lastfm()) {
    lastfm_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_lastfm(), 
      GetArena());
  }
  tagtraum_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_tagtraum()) {
    tagtraum_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_tagtraum(), 
      GetArena());
  }
  // @@protoc_insertion_point(copy_constructor:midi.GenreData)
}

void GenreData::SharedCtor() {
discogs_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
lastfm_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
tagtraum_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

GenreData::~GenreData() {
  // @@protoc_insertion_point(destructor:midi.GenreData)
  SharedDtor();
  _internal_metadata_.Delete<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

void GenreData::SharedDtor() {
  GOOGLE_DCHECK(GetArena() == nullptr);
  discogs_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  lastfm_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  tagtraum_.DestroyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}

void GenreData::ArenaDtor(void* object) {
  GenreData* _this = reinterpret_cast< GenreData* >(object);
  (void)_this;
}
void GenreData::RegisterArenaDtor(::PROTOBUF_NAMESPACE_ID::Arena*) {
}
void GenreData::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void GenreData::Clear() {
// @@protoc_insertion_point(message_clear_start:midi.GenreData)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      discogs_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      lastfm_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000004u) {
      tagtraum_.ClearNonDefaultToEmpty();
    }
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* GenreData::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
    ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
    CHK_(ptr);
    switch (tag >> 3) {
      // optional string discogs = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
          auto str = _internal_mutable_discogs();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          #ifndef NDEBUG
          ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "midi.GenreData.discogs");
          #endif  // !NDEBUG
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional string lastfm = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
          auto str = _internal_mutable_lastfm();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          #ifndef NDEBUG
          ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "midi.GenreData.lastfm");
          #endif  // !NDEBUG
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      // optional string tagtraum = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
          auto str = _internal_mutable_tagtraum();
          ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
          #ifndef NDEBUG
          ::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "midi.GenreData.tagtraum");
          #endif  // !NDEBUG
          CHK_(ptr);
        } else goto handle_unusual;
        continue;
      default: {
      handle_unusual:
        if ((tag & 7) == 4 || tag == 0) {
          ctx->SetLastTag(tag);
          goto success;
        }
        ptr = UnknownFieldParse(tag,
            _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
            ptr, ctx);
        CHK_(ptr != nullptr);
        continue;
      }
    }  // switch
  }  // while
success:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto success;
#undef CHK_
}

::PROTOBUF_NAMESPACE_ID::uint8* GenreData::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:midi.GenreData)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional string discogs = 1;
  if (cached_has_bits & 0x00000001u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_discogs().data(), static_cast<int>(this->_internal_discogs().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "midi.GenreData.discogs");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_discogs(), target);
  }

  // optional string lastfm = 2;
  if (cached_has_bits & 0x00000002u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_lastfm().data(), static_cast<int>(this->_internal_lastfm().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "midi.GenreData.lastfm");
    target = stream->WriteStringMaybeAliased(
        2, this->_internal_lastfm(), target);
  }

  // optional string tagtraum = 3;
  if (cached_has_bits & 0x00000004u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_tagtraum().data(), static_cast<int>(this->_internal_tagtraum().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "midi.GenreData.tagtraum");
    target = stream->WriteStringMaybeAliased(
        3, this->_internal_tagtraum(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:midi.GenreData)
  return target;
}

size_t GenreData::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:midi.GenreData)
  size_t total_size = 0;

  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    // optional string discogs = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_discogs());
    }

    // optional string lastfm = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_lastfm());
    }

    // optional string tagtraum = 3;
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
          this->_internal_tagtraum());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    return ::PROTOBUF_NAMESPACE_ID::internal::ComputeUnknownFieldsSize(
        _internal_metadata_, total_size, &_cached_size_);
  }
  int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void GenreData::MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_merge_from_start:midi.GenreData)
  GOOGLE_DCHECK_NE(&from, this);
  const GenreData* source =
      ::PROTOBUF_NAMESPACE_ID::DynamicCastToGenerated<GenreData>(
          &from);
  if (source == nullptr) {
  // @@protoc_insertion_point(generalized_merge_from_cast_fail:midi.GenreData)
    ::PROTOBUF_NAMESPACE_ID::internal::ReflectionOps::Merge(from, this);
  } else {
  // @@protoc_insertion_point(generalized_merge_from_cast_success:midi.GenreData)
    MergeFrom(*source);
  }
}

void GenreData::MergeFrom(const GenreData& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:midi.GenreData)
  GOOGLE_DCHECK_NE(&from, this);
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000007u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_set_discogs(from._internal_discogs());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_set_lastfm(from._internal_lastfm());
    }
    if (cached_has_bits & 0x00000004u) {
      _internal_set_tagtraum(from._internal_tagtraum());
    }
  }
}

void GenreData::CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) {
// @@protoc_insertion_point(generalized_copy_from_start:midi.GenreData)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

void GenreData::CopyFrom(const GenreData& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:midi.GenreData)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool GenreData::IsInitialized() const {
  return true;
}

void GenreData::InternalSwap(GenreData* other) {
  using std::swap;
  _internal_metadata_.Swap<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  discogs_.Swap(&other->discogs_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
  lastfm_.Swap(&other->lastfm_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
  tagtraum_.Swap(&other->tagtraum_, &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArena());
}

::PROTOBUF_NAMESPACE_ID::Metadata GenreData::GetMetadata() const {
  return GetMetadataStatic();
}

PROTOBUF_ATTRIBUTE_INIT_PRIORITY ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,
    ::PROTOBUF_NAMESPACE_ID::internal::PrimitiveTypeTraits< ::PROTOBUF_NAMESPACE_ID::int32 >, 5, false >
  maxval(kMaxvalFieldNumber, 0);
PROTOBUF_ATTRIBUTE_INIT_PRIORITY ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,
    ::PROTOBUF_NAMESPACE_ID::internal::PrimitiveTypeTraits< ::PROTOBUF_NAMESPACE_ID::int32 >, 5, false >
  minval(kMinvalFieldNumber, 0);
PROTOBUF_ATTRIBUTE_INIT_PRIORITY ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,
    ::PROTOBUF_NAMESPACE_ID::internal::PrimitiveTypeTraits< float >, 2, false >
  fmaxval(kFmaxvalFieldNumber, 0);
PROTOBUF_ATTRIBUTE_INIT_PRIORITY ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier< ::google::protobuf::FieldOptions,
    ::PROTOBUF_NAMESPACE_ID::internal::PrimitiveTypeTraits< float >, 2, false >
  fminval(kFminvalFieldNumber, 0);

// @@protoc_insertion_point(namespace_scope)
}  // namespace midi
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::midi::ContinuousFeature* Arena::CreateMaybeMessage< ::midi::ContinuousFeature >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::ContinuousFeature >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::TrackFeatures* Arena::CreateMaybeMessage< ::midi::TrackFeatures >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::TrackFeatures >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::Note* Arena::CreateMaybeMessage< ::midi::Note >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::Note >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::ValidTrack* Arena::CreateMaybeMessage< ::midi::ValidTrack >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::ValidTrack >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::Dataset_Item* Arena::CreateMaybeMessage< ::midi::Dataset_Item >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::Dataset_Item >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::Dataset* Arena::CreateMaybeMessage< ::midi::Dataset >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::Dataset >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::ModelMetadata* Arena::CreateMaybeMessage< ::midi::ModelMetadata >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::ModelMetadata >(arena);
}
template<> PROTOBUF_NOINLINE ::midi::GenreData* Arena::CreateMaybeMessage< ::midi::GenreData >(Arena* arena) {
  return Arena::CreateMessageInternal< ::midi::GenreData >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
