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

#include "beats.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/io/zero_copy_stream_impl_lite.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG

namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace mixxx {
namespace track {
namespace io {
PROTOBUF_CONSTEXPR Beat::Beat(
    ::_pbi::ConstantInitialized)
  : frame_position_(0)
  , source_(0)

  , enabled_(true){}
struct BeatDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BeatDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BeatDefaultTypeInternal() {}
  union {
    Beat _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BeatDefaultTypeInternal _Beat_default_instance_;
PROTOBUF_CONSTEXPR Bpm::Bpm(
    ::_pbi::ConstantInitialized)
  : bpm_(0)
  , source_(0)
{}
struct BpmDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BpmDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BpmDefaultTypeInternal() {}
  union {
    Bpm _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BpmDefaultTypeInternal _Bpm_default_instance_;
PROTOBUF_CONSTEXPR BeatMap::BeatMap(
    ::_pbi::ConstantInitialized)
  : beat_(){}
struct BeatMapDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BeatMapDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BeatMapDefaultTypeInternal() {}
  union {
    BeatMap _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BeatMapDefaultTypeInternal _BeatMap_default_instance_;
PROTOBUF_CONSTEXPR BeatGrid::BeatGrid(
    ::_pbi::ConstantInitialized)
  : bpm_(nullptr)
  , first_beat_(nullptr){}
struct BeatGridDefaultTypeInternal {
  PROTOBUF_CONSTEXPR BeatGridDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~BeatGridDefaultTypeInternal() {}
  union {
    BeatGrid _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 BeatGridDefaultTypeInternal _BeatGrid_default_instance_;
}  // namespace io
}  // namespace track
}  // namespace mixxx
namespace mixxx {
namespace track {
namespace io {
bool Source_IsValid(int value) {
  switch (value) {
    case 0:
    case 1:
    case 2:
      return true;
    default:
      return false;
  }
}

static ::PROTOBUF_NAMESPACE_ID::internal::ExplicitlyConstructed<std::string> Source_strings[3] = {};

static const char Source_names[] =
  "ANALYZER"
  "FILE_METADATA"
  "USER";

static const ::PROTOBUF_NAMESPACE_ID::internal::EnumEntry Source_entries[] = {
  { {Source_names + 0, 8}, 0 },
  { {Source_names + 8, 13}, 1 },
  { {Source_names + 21, 4}, 2 },
};

static const int Source_entries_by_number[] = {
  0, // 0 -> ANALYZER
  1, // 1 -> FILE_METADATA
  2, // 2 -> USER
};

const std::string& Source_Name(
    Source value) {
  static const bool dummy =
      ::PROTOBUF_NAMESPACE_ID::internal::InitializeEnumStrings(
          Source_entries,
          Source_entries_by_number,
          3, Source_strings);
  (void) dummy;
  int idx = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumName(
      Source_entries,
      Source_entries_by_number,
      3, value);
  return idx == -1 ? ::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString() :
                     Source_strings[idx].get();
}
bool Source_Parse(
    ::PROTOBUF_NAMESPACE_ID::ConstStringParam name, Source* value) {
  int int_value;
  bool success = ::PROTOBUF_NAMESPACE_ID::internal::LookUpEnumValue(
      Source_entries, 3, name, &int_value);
  if (success) {
    *value = static_cast<Source>(int_value);
  }
  return success;
}

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

class Beat::_Internal {
 public:
  using HasBits = decltype(std::declval<Beat>()._has_bits_);
  static void set_has_frame_position(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_enabled(HasBits* has_bits) {
    (*has_bits)[0] |= 4u;
  }
  static void set_has_source(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

Beat::Beat(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:mixxx.track.io.Beat)
}
Beat::Beat(const Beat& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  ::memcpy(&frame_position_, &from.frame_position_,
    static_cast<size_t>(reinterpret_cast<char*>(&enabled_) -
    reinterpret_cast<char*>(&frame_position_)) + sizeof(enabled_));
  // @@protoc_insertion_point(copy_constructor:mixxx.track.io.Beat)
}

inline void Beat::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&frame_position_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&source_) -
    reinterpret_cast<char*>(&frame_position_)) + sizeof(source_));
enabled_ = true;
}

Beat::~Beat() {
  // @@protoc_insertion_point(destructor:mixxx.track.io.Beat)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void Beat::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void Beat::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Beat::Clear() {
// @@protoc_insertion_point(message_clear_start:mixxx.track.io.Beat)
  uint32_t 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(&frame_position_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&source_) -
        reinterpret_cast<char*>(&frame_position_)) + sizeof(source_));
    enabled_ = true;
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Beat::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional int32 frame_position = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
          _Internal::set_has_frame_position(&has_bits);
          frame_position_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional bool enabled = 2 [default = true];
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
          _Internal::set_has_enabled(&has_bits);
          enabled_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .mixxx.track.io.Source source = 3 [default = ANALYZER];
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::mixxx::track::io::Source_IsValid(val))) {
            _internal_set_source(static_cast<::mixxx::track::io::Source>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(3, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Beat::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:mixxx.track.io.Beat)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

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

  // optional bool enabled = 2 [default = true];
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteBoolToArray(2, this->_internal_enabled(), target);
  }

  // optional .mixxx.track.io.Source source = 3 [default = ANALYZER];
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteEnumToArray(
      3, this->_internal_source(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:mixxx.track.io.Beat)
  return target;
}

size_t Beat::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mixxx.track.io.Beat)
  size_t total_size = 0;

  uint32_t 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 frame_position = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += ::_pbi::WireFormatLite::Int32SizePlusOne(this->_internal_frame_position());
    }

    // optional .mixxx.track.io.Source source = 3 [default = ANALYZER];
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::_pbi::WireFormatLite::EnumSize(this->_internal_source());
    }

    // optional bool enabled = 2 [default = true];
    if (cached_has_bits & 0x00000004u) {
      total_size += 1 + 1;
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Beat::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const Beat*>(
      &from));
}

void Beat::MergeFrom(const Beat& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mixxx.track.io.Beat)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t 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) {
      frame_position_ = from.frame_position_;
    }
    if (cached_has_bits & 0x00000002u) {
      source_ = from.source_;
    }
    if (cached_has_bits & 0x00000004u) {
      enabled_ = from.enabled_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Beat::CopyFrom(const Beat& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mixxx.track.io.Beat)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

void Beat::InternalSwap(Beat* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_has_bits_[0], other->_has_bits_[0]);
  ::PROTOBUF_NAMESPACE_ID::internal::memswap<
      PROTOBUF_FIELD_OFFSET(Beat, source_)
      + sizeof(Beat::source_)
      - PROTOBUF_FIELD_OFFSET(Beat, frame_position_)>(
          reinterpret_cast<char*>(&frame_position_),
          reinterpret_cast<char*>(&other->frame_position_));
  swap(enabled_, other->enabled_);
}

std::string Beat::GetTypeName() const {
  return "mixxx.track.io.Beat";
}


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

class Bpm::_Internal {
 public:
  using HasBits = decltype(std::declval<Bpm>()._has_bits_);
  static void set_has_bpm(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static void set_has_source(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

Bpm::Bpm(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:mixxx.track.io.Bpm)
}
Bpm::Bpm(const Bpm& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  ::memcpy(&bpm_, &from.bpm_,
    static_cast<size_t>(reinterpret_cast<char*>(&source_) -
    reinterpret_cast<char*>(&bpm_)) + sizeof(source_));
  // @@protoc_insertion_point(copy_constructor:mixxx.track.io.Bpm)
}

inline void Bpm::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&bpm_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&source_) -
    reinterpret_cast<char*>(&bpm_)) + sizeof(source_));
}

Bpm::~Bpm() {
  // @@protoc_insertion_point(destructor:mixxx.track.io.Bpm)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void Bpm::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void Bpm::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void Bpm::Clear() {
// @@protoc_insertion_point(message_clear_start:mixxx.track.io.Bpm)
  uint32_t 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 & 0x00000003u) {
    ::memset(&bpm_, 0, static_cast<size_t>(
        reinterpret_cast<char*>(&source_) -
        reinterpret_cast<char*>(&bpm_)) + sizeof(source_));
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* Bpm::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional double bpm = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 9)) {
          _Internal::set_has_bpm(&has_bits);
          bpm_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
          ptr += sizeof(double);
        } else
          goto handle_unusual;
        continue;
      // optional .mixxx.track.io.Source source = 2 [default = ANALYZER];
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
          CHK_(ptr);
          if (PROTOBUF_PREDICT_TRUE(::mixxx::track::io::Source_IsValid(val))) {
            _internal_set_source(static_cast<::mixxx::track::io::Source>(val));
          } else {
            ::PROTOBUF_NAMESPACE_ID::internal::WriteVarint(2, val, mutable_unknown_fields());
          }
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* Bpm::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:mixxx.track.io.Bpm)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional double bpm = 1;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteDoubleToArray(1, this->_internal_bpm(), target);
  }

  // optional .mixxx.track.io.Source source = 2 [default = ANALYZER];
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteEnumToArray(
      2, this->_internal_source(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:mixxx.track.io.Bpm)
  return target;
}

size_t Bpm::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mixxx.track.io.Bpm)
  size_t total_size = 0;

  uint32_t 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 & 0x00000003u) {
    // optional double bpm = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 + 8;
    }

    // optional .mixxx.track.io.Source source = 2 [default = ANALYZER];
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::_pbi::WireFormatLite::EnumSize(this->_internal_source());
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void Bpm::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const Bpm*>(
      &from));
}

void Bpm::MergeFrom(const Bpm& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mixxx.track.io.Bpm)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      bpm_ = from.bpm_;
    }
    if (cached_has_bits & 0x00000002u) {
      source_ = from.source_;
    }
    _has_bits_[0] |= cached_has_bits;
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void Bpm::CopyFrom(const Bpm& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mixxx.track.io.Bpm)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

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

std::string Bpm::GetTypeName() const {
  return "mixxx.track.io.Bpm";
}


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

class BeatMap::_Internal {
 public:
};

BeatMap::BeatMap(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned),
  beat_(arena) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:mixxx.track.io.BeatMap)
}
BeatMap::BeatMap(const BeatMap& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      beat_(from.beat_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:mixxx.track.io.BeatMap)
}

inline void BeatMap::SharedCtor() {
}

BeatMap::~BeatMap() {
  // @@protoc_insertion_point(destructor:mixxx.track.io.BeatMap)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void BeatMap::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void BeatMap::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void BeatMap::Clear() {
// @@protoc_insertion_point(message_clear_start:mixxx.track.io.BeatMap)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  beat_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* BeatMap::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // repeated .mixxx.track.io.Beat beat = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr -= 1;
          do {
            ptr += 1;
            ptr = ctx->ParseMessage(_internal_add_beat(), ptr);
            CHK_(ptr);
            if (!ctx->DataAvailable(ptr)) break;
          } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<10>(ptr));
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* BeatMap::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:mixxx.track.io.BeatMap)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated .mixxx.track.io.Beat beat = 1;
  for (unsigned i = 0,
      n = static_cast<unsigned>(this->_internal_beat_size()); i < n; i++) {
    const auto& repfield = this->_internal_beat(i);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(1, repfield, repfield.GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:mixxx.track.io.BeatMap)
  return target;
}

size_t BeatMap::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mixxx.track.io.BeatMap)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // repeated .mixxx.track.io.Beat beat = 1;
  total_size += 1UL * this->_internal_beat_size();
  for (const auto& msg : this->beat_) {
    total_size +=
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(msg);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BeatMap::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const BeatMap*>(
      &from));
}

void BeatMap::MergeFrom(const BeatMap& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mixxx.track.io.BeatMap)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  beat_.MergeFrom(from.beat_);
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void BeatMap::CopyFrom(const BeatMap& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mixxx.track.io.BeatMap)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

void BeatMap::InternalSwap(BeatMap* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  beat_.InternalSwap(&other->beat_);
}

std::string BeatMap::GetTypeName() const {
  return "mixxx.track.io.BeatMap";
}


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

class BeatGrid::_Internal {
 public:
  using HasBits = decltype(std::declval<BeatGrid>()._has_bits_);
  static const ::mixxx::track::io::Bpm& bpm(const BeatGrid* msg);
  static void set_has_bpm(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
  static const ::mixxx::track::io::Beat& first_beat(const BeatGrid* msg);
  static void set_has_first_beat(HasBits* has_bits) {
    (*has_bits)[0] |= 2u;
  }
};

const ::mixxx::track::io::Bpm&
BeatGrid::_Internal::bpm(const BeatGrid* msg) {
  return *msg->bpm_;
}
const ::mixxx::track::io::Beat&
BeatGrid::_Internal::first_beat(const BeatGrid* msg) {
  return *msg->first_beat_;
}
BeatGrid::BeatGrid(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(arena, is_message_owned) {
  SharedCtor();
  // @@protoc_insertion_point(arena_constructor:mixxx.track.io.BeatGrid)
}
BeatGrid::BeatGrid(const BeatGrid& from)
  : ::PROTOBUF_NAMESPACE_ID::MessageLite(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
  if (from._internal_has_bpm()) {
    bpm_ = new ::mixxx::track::io::Bpm(*from.bpm_);
  } else {
    bpm_ = nullptr;
  }
  if (from._internal_has_first_beat()) {
    first_beat_ = new ::mixxx::track::io::Beat(*from.first_beat_);
  } else {
    first_beat_ = nullptr;
  }
  // @@protoc_insertion_point(copy_constructor:mixxx.track.io.BeatGrid)
}

inline void BeatGrid::SharedCtor() {
::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
    reinterpret_cast<char*>(&bpm_) - reinterpret_cast<char*>(this)),
    0, static_cast<size_t>(reinterpret_cast<char*>(&first_beat_) -
    reinterpret_cast<char*>(&bpm_)) + sizeof(first_beat_));
}

BeatGrid::~BeatGrid() {
  // @@protoc_insertion_point(destructor:mixxx.track.io.BeatGrid)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<std::string>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void BeatGrid::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (this != internal_default_instance()) delete bpm_;
  if (this != internal_default_instance()) delete first_beat_;
}

void BeatGrid::SetCachedSize(int size) const {
  _cached_size_.Set(size);
}

void BeatGrid::Clear() {
// @@protoc_insertion_point(message_clear_start:mixxx.track.io.BeatGrid)
  uint32_t 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 & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      GOOGLE_DCHECK(bpm_ != nullptr);
      bpm_->Clear();
    }
    if (cached_has_bits & 0x00000002u) {
      GOOGLE_DCHECK(first_beat_ != nullptr);
      first_beat_->Clear();
    }
  }
  _has_bits_.Clear();
  _internal_metadata_.Clear<std::string>();
}

const char* BeatGrid::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional .mixxx.track.io.Bpm bpm = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_bpm(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // optional .mixxx.track.io.Beat first_beat = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_first_beat(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<std::string>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* BeatGrid::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:mixxx.track.io.BeatGrid)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // optional .mixxx.track.io.Bpm bpm = 1;
  if (cached_has_bits & 0x00000001u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(1, _Internal::bpm(this),
        _Internal::bpm(this).GetCachedSize(), target, stream);
  }

  // optional .mixxx.track.io.Beat first_beat = 2;
  if (cached_has_bits & 0x00000002u) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(2, _Internal::first_beat(this),
        _Internal::first_beat(this).GetCachedSize(), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = stream->WriteRaw(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).data(),
        static_cast<int>(_internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size()), target);
  }
  // @@protoc_insertion_point(serialize_to_array_end:mixxx.track.io.BeatGrid)
  return target;
}

size_t BeatGrid::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:mixxx.track.io.BeatGrid)
  size_t total_size = 0;

  uint32_t 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 & 0x00000003u) {
    // optional .mixxx.track.io.Bpm bpm = 1;
    if (cached_has_bits & 0x00000001u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *bpm_);
    }

    // optional .mixxx.track.io.Beat first_beat = 2;
    if (cached_has_bits & 0x00000002u) {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *first_beat_);
    }

  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    total_size += _internal_metadata_.unknown_fields<std::string>(::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString).size();
  }
  int cached_size = ::_pbi::ToCachedSize(total_size);
  SetCachedSize(cached_size);
  return total_size;
}

void BeatGrid::CheckTypeAndMergeFrom(
    const ::PROTOBUF_NAMESPACE_ID::MessageLite& from) {
  MergeFrom(*::_pbi::DownCast<const BeatGrid*>(
      &from));
}

void BeatGrid::MergeFrom(const BeatGrid& from) {
// @@protoc_insertion_point(class_specific_merge_from_start:mixxx.track.io.BeatGrid)
  GOOGLE_DCHECK_NE(&from, this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = from._has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      _internal_mutable_bpm()->::mixxx::track::io::Bpm::MergeFrom(from._internal_bpm());
    }
    if (cached_has_bits & 0x00000002u) {
      _internal_mutable_first_beat()->::mixxx::track::io::Beat::MergeFrom(from._internal_first_beat());
    }
  }
  _internal_metadata_.MergeFrom<std::string>(from._internal_metadata_);
}

void BeatGrid::CopyFrom(const BeatGrid& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:mixxx.track.io.BeatGrid)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

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

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

std::string BeatGrid::GetTypeName() const {
  return "mixxx.track.io.BeatGrid";
}


// @@protoc_insertion_point(namespace_scope)
}  // namespace io
}  // namespace track
}  // namespace mixxx
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::mixxx::track::io::Beat*
Arena::CreateMaybeMessage< ::mixxx::track::io::Beat >(Arena* arena) {
  return Arena::CreateMessageInternal< ::mixxx::track::io::Beat >(arena);
}
template<> PROTOBUF_NOINLINE ::mixxx::track::io::Bpm*
Arena::CreateMaybeMessage< ::mixxx::track::io::Bpm >(Arena* arena) {
  return Arena::CreateMessageInternal< ::mixxx::track::io::Bpm >(arena);
}
template<> PROTOBUF_NOINLINE ::mixxx::track::io::BeatMap*
Arena::CreateMaybeMessage< ::mixxx::track::io::BeatMap >(Arena* arena) {
  return Arena::CreateMessageInternal< ::mixxx::track::io::BeatMap >(arena);
}
template<> PROTOBUF_NOINLINE ::mixxx::track::io::BeatGrid*
Arena::CreateMaybeMessage< ::mixxx::track::io::BeatGrid >(Arena* arena) {
  return Arena::CreateMessageInternal< ::mixxx::track::io::BeatGrid >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

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