Skip to content

Commit

Permalink
Fix GitHub Actions build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Aug 16, 2024
1 parent 72e0537 commit 554c647
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
9 changes: 6 additions & 3 deletions source/src/buffer/fftbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ FFTBuffer::FFTBuffer(std::string filename, int fft_size, int hop_size)
size_t file_size = ftell(fd);
fseek(fd, 0, SEEK_SET);
double num_frames_frac = (double) file_size / (this->num_bins * 2 * sizeof(float));
printf("FFTBuffer: File size %zu bytes, %.2f frames\n", file_size, num_frames_frac);
if (num_frames_frac != (int) num_frames_frac)
{
throw std::runtime_error("Error: Not an integer number of frames (found " + std::to_string(num_frames) + " frames)");
Expand All @@ -59,9 +58,13 @@ FFTBuffer::FFTBuffer(std::string filename, int fft_size, int hop_size)

this->resize(num_frames);

for (int frame = 0; frame < num_frames; frame++)
for (unsigned int frame = 0; frame < num_frames; frame++)
{
fread(this->data[frame], sizeof(float), this->num_bins * 2, fd);
size_t rv = fread(this->data[frame], sizeof(float), this->num_bins * 2, fd);
if (rv != this->num_bins * 2)
{
throw std::runtime_error("FFTBuffer: Read too few items");
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions source/src/node/buffer/granulation/grainsegments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void SegmentedGranulator::process(Buffer &out, int num_frames)
{
this->triggered = false;
int index = (int) this->index->out[0][frame];
if (index < 0 || index >= this->onset_times.size())
if (index < 0 || index >= (int) this->onset_times.size())
{
throw std::runtime_error("Invalid segment index: " + std::to_string(index) + " (num_segments = " + std::to_string(this->onset_times.size()) + ")");
}
Expand Down Expand Up @@ -135,7 +135,7 @@ void SegmentedGranulator::trigger(std::string name, float value)
}

int index = (int) value;
if (index < 0 || index >= this->onset_times.size())
if (index < 0 || index >= (int) this->onset_times.size())
{
throw std::runtime_error("Invalid segment index: " + std::to_string(index) + " (num_segments = " + std::to_string(this->onset_times.size()) + ")");
}
Expand Down
4 changes: 2 additions & 2 deletions source/src/node/buffer/segment-player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,14 @@ void SegmentPlayer::trigger(std::string name, float value)
std::vector<float> onsets = onsetsref->float_array_value();
if (onsets.size() > 0)
{
int segment_index;
unsigned int segment_index;
/*--------------------------------------------------------------------------------
* If `value` is explicitly specified, use this as the segment index.
* Otherwise, use the value of the `index` input, or a random value.
*--------------------------------------------------------------------------------*/
if (value != SIGNALFLOW_NULL_FLOAT)
{
segment_index = (int) value;
segment_index = (unsigned int) value;
}
else if (this->index)
{
Expand Down
2 changes: 1 addition & 1 deletion source/src/node/fft/fft-scale-magnitudes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ FFTScaleMagnitudes::FFTScaleMagnitudes(NodeRef input,
: FFTOpNode(input), scale(scale)
{
this->name = "fft-scale-magnitudes";
if (this->scale.size() != this->num_bins)
if (this->scale.size() != (unsigned int) this->num_bins)
{
throw std::runtime_error("FFTScaleMagnitudes: scale array must be same length as magnitude array (" + std::to_string(this->num_bins) + ")");
}
Expand Down
4 changes: 2 additions & 2 deletions source/src/node/io/input/soundio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ void read_callback(struct SoundIoInStream *instream,

for (int frame = 0; frame < frame_count; frame++)
{
for (int channel = 0; channel < input->buffer->get_num_channels(); channel += 1)
for (unsigned int channel = 0; channel < input->buffer->get_num_channels(); channel += 1)
{
float *ptr = reinterpret_cast<float *>(areas[channel].ptr + areas[channel].step * frame);
input->buffer->data[channel][input->write_pos] = *ptr;
Expand Down Expand Up @@ -121,7 +121,7 @@ int AudioIn_SoundIO::init()
throw audio_io_exception("libsoundio init error: unable to start device: " + std::string(soundio_strerror(err)));
}

if (this->num_channels_requested > this->instream->layout.channel_count)
if (this->num_channels_requested > (unsigned int) this->instream->layout.channel_count)
{
throw audio_io_exception("AudioIn: Not enough input channels available (requested " + std::to_string(this->num_channels_requested) + ", available " + std::to_string(this->instream->layout.channel_count) + ")");
}
Expand Down

0 comments on commit 554c647

Please sign in to comment.