Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COLOROFF=$(tput sgr0)

printf " - Running %s " "${FILE}"

if ! g++ -std=c++17 -o test "${FILE}" ./includes/RhythmGameUtilities/RhythmGameUtilities.cpp -Iincludes; then
if ! g++ -std=c++17 -o test "${FILE}" -Iincludes; then
printf "%sCOMPILATION FAILED%s\n" "${REDON}" "${COLOROFF}"
exit 1
fi
Expand Down
53 changes: 0 additions & 53 deletions includes/RhythmGameUtilities/Audio.cpp

This file was deleted.

18 changes: 0 additions & 18 deletions includes/RhythmGameUtilities/Audio.h

This file was deleted.

61 changes: 61 additions & 0 deletions includes/RhythmGameUtilities/Audio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#pragma once

#include <cmath>

#ifdef _WIN32
#define PACKAGE_API __declspec(dllexport)
#else
#define PACKAGE_API
#endif

namespace RhythmGameUtilities
{

extern "C"
{
PACKAGE_API int **ConvertSamplesToWaveform(float *samples, int size,
int width, int height)
{
auto waveform = new int *[width];

auto step = floor(size / width);
auto amp = height / 2;

for (auto x = 0; x < width; x += 1)
{
waveform[x] = new int[height];

auto min = 1.0f;
auto max = -1.0f;

for (auto j = 0; j < step; j += 1)
{
auto index = (int)(x * step + j);

auto datum = samples[index];

if (datum < min)
{
min = datum;
}

if (datum > max)
{
max = datum;
}
}

auto minY = (int)((1 + min) * amp);
auto maxY = (int)((1 + max) * amp);

for (auto y = 0; y < height; y += 1)
{
waveform[x][y] = y >= minY && y <= maxY ? 1 : 0;
}
}

return waveform;
}
}

} // namespace RhythmGameUtilities
114 changes: 0 additions & 114 deletions includes/RhythmGameUtilities/Parsers.cpp

This file was deleted.

42 changes: 0 additions & 42 deletions includes/RhythmGameUtilities/Parsers.h

This file was deleted.

Loading