Skip to content

Commit

Permalink
style: remove indentation for access specifiers in class definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
BayernMuller committed Nov 3, 2024
1 parent 072ad4a commit 69771c9
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ Language: Cpp
# Style
BasedOnStyle: Microsoft

# No indent for extern block and namespace
# No indent for extern block, namespace, and access specifiers in class
IndentExternBlock: NoIndent
NamespaceIndentation: None
AccessModifierOffset: -4

# Header files order
IncludeIsMainRegex: ".*" # 1. main file
Expand Down
4 changes: 2 additions & 2 deletions cli/cli.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

class CLI
{
public:
public:
int Run(int argc, char **argv);

private:
private:
Fingerprint *getFingerprintFromMusicFile(const std::string &music_file);
Fingerprint *getFingerprintFromStdin(int chunk_seconds, int sample_rate, int channels,
int bits_per_sample, bool is_signed);
Expand Down
4 changes: 2 additions & 2 deletions cli/communication/shazam.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ class Shazam
{
static constexpr char HOST[] = "https://amp.shazam.com/discovery/v5/fr/FR/android/-/tag/";

public:
public:
static std::string Recognize(const Fingerprint *fingerprint);

private:
private:
static std::string getShazamHost();
static std::string getUserAgent();
static std::string getRequestContent(const std::string &uri, unsigned int sample_ms);
Expand Down
4 changes: 2 additions & 2 deletions lib/algorithm/frequency.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ enum class FrequencyBand

class FrequencyPeak
{
public:
public:
FrequencyPeak(std::uint32_t fft_pass_number, std::uint32_t peak_magnitude,
std::uint32_t corrected_peak_frequency_bin, std::uint32_t sample_rate);
~FrequencyPeak();
Expand All @@ -35,7 +35,7 @@ class FrequencyPeak
inline double ComputeAmplitudePCM() const;
inline double ComputeElapsedSeconds() const;

private:
private:
std::uint32_t fft_pass_number_;
std::uint32_t peak_magnitude_;
std::uint32_t corrected_peak_frequency_bin_;
Expand Down
8 changes: 4 additions & 4 deletions lib/algorithm/signature.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ __attribute__((packed));

class Signature
{
public:
public:
Signature(std::uint32_t sample_rate, std::uint32_t num_samples);
~Signature();
void Reset(std::uint32_t sampleRate, std::uint32_t num_samples);
Expand All @@ -56,10 +56,10 @@ class Signature
std::uint32_t SumOfPeaksLength() const;
std::string EncodeBase64() const;

private:
private:
template <typename T>
std::stringstream &write_little_endian(std::stringstream &stream, const T &&value,
size_t size = sizeof(T)) const
size_t size = sizeof(T)) const
{
for (size_t i = 0; i < size; ++i)
{
Expand All @@ -68,7 +68,7 @@ class Signature
return stream;
}

private:
private:
std::uint32_t sample_rate_;
std::uint32_t num_samples_;
std::map<FrequencyBand, std::list<FrequencyPeak>> frequency_band_to_peaks_;
Expand Down
6 changes: 3 additions & 3 deletions lib/algorithm/signature_generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ constexpr auto MAX_PEAKS = 255u;

class SignatureGenerator
{
public:
public:
SignatureGenerator();
void FeedInput(const LowQualityTrack &input);
Signature GetNextSignature();
Expand All @@ -25,15 +25,15 @@ class SignatureGenerator
max_time_seconds_ = max_time_seconds;
}

private:
private:
void processInput(const LowQualityTrack &input);
void doFFT(const LowQualityTrack &input);
void doPeakSpreadingAndRecoginzation();
void doPeakSpreading();
void doPeakRecognition();
void resetSignatureGenerater();

private:
private:
LowQualityTrack input_pending_processing_;
std::uint32_t sample_processed_;
double max_time_seconds_;
Expand Down
4 changes: 2 additions & 2 deletions lib/audio/downsampler.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ using DownsampleFunc = void (*)(LowQualityTrack *, const void *, double, std::ui

class Downsampler
{
public:
public:
static LowQualityTrack GetLowQualityPCM(const Wav &wav, std::int32_t start_sec = 0,
std::int32_t end_sec = -1);

private:
private:
static DownsampleFunc getDownsampleFunc(bool is_signed, std::uint32_t width,
std::uint32_t channels);

Expand Down
6 changes: 3 additions & 3 deletions lib/audio/wav.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ enum class AudioFormat

class Wav
{
public:
public:
Wav(Wav &&) = default;
Wav(const Wav &) = delete;
static Wav FromFile(const std::string &wav_file_path);
Expand Down Expand Up @@ -72,14 +72,14 @@ class Wav
return data_;
}

private:
private:
Wav() = default;
static Wav fromPCM(const char *raw_pcm, std::uint32_t raw_pcm_size, AudioFormat audio_format,
std::uint32_t sample_rate, std::uint32_t sample_width,
std::uint32_t channel_count);
void readWavFileBuffer(std::istream &stream);

private:
private:
WavHeader header_;
FmtSubchunk fmt_;
std::string wav_file_path_;
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/ffmpeg.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ constexpr int EXPECTED_DURATION = 5 * 60; // 5 minutes

class FFmpegWrapper
{
public:
public:
FFmpegWrapper() = delete;
static int ConvertToWav(const std::string &input_file, LowQualityTrack *pcm);

private:
private:
static std::string getFFmpegPath();
static bool isWindows();
};
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/fft.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using RealArray = std::vector<long double>;

class FFT
{
public:
public:
template <typename Iterable> static RealArray RFFT(const Iterable &input)
{
// If input size is 0, return false.
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

template <typename T> class RingBuffer : private std::vector<T>
{
public:
public:
explicit RingBuffer(std::size_t size, T &&default_value = T());
virtual ~RingBuffer();

Expand Down Expand Up @@ -34,7 +34,7 @@ template <typename T> class RingBuffer : private std::vector<T>
return std::vector<T>::end();
}

private:
private:
std::uint32_t num_written_;
std::uint32_t position_;
};
Expand Down

0 comments on commit 69771c9

Please sign in to comment.