swift
tonepair.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_SOUND_TONEPAIR_H
7 #define SWIFT_SOUND_TONEPAIR_H
8 
9 #include <chrono>
10 #include <tuple>
11 
12 #include "misc/pq/frequency.h"
13 #include "misc/pq/time.h"
14 #include "sound/swiftsoundexport.h"
15 
16 namespace swift::sound
17 {
20  {
21  public:
24  const swift::misc::physical_quantities::CFrequency &secondaryFrequency,
25  std::chrono::milliseconds duration);
26 
28  int getFirstFrequencyHz() const { return m_firstFrequencyHz; }
29 
31  int getSecondFrequencyHz() const { return m_secondFrequencyHz; }
32 
34  std::chrono::milliseconds getDurationMs() const { return m_durationMs; }
35 
37  friend bool operator<(const CTonePair &lhs, const CTonePair &rhs)
38  {
39  return std::tie(lhs.m_firstFrequencyHz, lhs.m_secondFrequencyHz, lhs.m_durationMs) <
40  std::tie(rhs.m_firstFrequencyHz, rhs.m_secondFrequencyHz, rhs.m_durationMs);
41  }
42 
43  private:
44  int m_firstFrequencyHz;
45  int m_secondFrequencyHz;
46  std::chrono::milliseconds m_durationMs;
47  };
48 } // namespace swift::sound
49 
50 #endif // SWIFT_SOUND_TONEPAIR_H
Tone pair to be played.
Definition: tonepair.h:20
int getFirstFrequencyHz() const
Get frequency of the first tone.
Definition: tonepair.h:28
int getSecondFrequencyHz() const
Get frequency of the second tone.
Definition: tonepair.h:31
friend bool operator<(const CTonePair &lhs, const CTonePair &rhs)
Comparison operator.
Definition: tonepair.h:37
std::chrono::milliseconds getDurationMs() const
Get play duration.
Definition: tonepair.h:34
#define SWIFT_SOUND_EXPORT
Export a class or function from the library.