Skip to content

Commit

Permalink
miniaudio: Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ideoforms committed Oct 21, 2024
1 parent 8d4c55e commit f6f827f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
10 changes: 8 additions & 2 deletions source/src/node/io/input/miniaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ void read_callback(ma_device *pDevice,

// TODO: the number of channels at the mic input might not be the same as the number of channels of this device
int num_channels = input_node->get_num_output_channels();
for (int frame = 0; frame < frameCount; frame++)
for (unsigned int frame = 0; frame < frameCount; frame++)
{
for (int channel = 0; channel < num_channels; channel++)
for (unsigned int channel = 0; channel < num_channels; channel++)
{
input_node->out[channel][frame] = input_samples[frame * num_channels + channel];
}
Expand Down Expand Up @@ -76,6 +76,8 @@ int AudioIn_MiniAudio::init()
<< std::endl;

this->start();

return 0;
}

int AudioIn_MiniAudio::start()
Expand All @@ -85,6 +87,8 @@ int AudioIn_MiniAudio::start()
{
throw std::runtime_error("miniaudio: Error starting device");
}

return 0;
}

int AudioIn_MiniAudio::stop()
Expand All @@ -94,6 +98,8 @@ int AudioIn_MiniAudio::stop()
{
throw std::runtime_error("miniaudio: Error stopping device");
}

return 0;
}

int AudioIn_MiniAudio::destroy()
Expand Down
10 changes: 5 additions & 5 deletions source/src/node/io/output/miniaudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ void data_callback(ma_device *pDevice,
}

NodeRef output = shared_graph->get_output();
for (int frame = 0; frame < frame_count; frame++)
for (unsigned int frame = 0; frame < frame_count; frame++)
{
for (int channel = 0; channel < channel_count; channel += 1)
for (unsigned int channel = 0; channel < channel_count; channel += 1)
{
output_pointer[channel_count * frame + channel] = output->out[channel][frame];
}
Expand Down Expand Up @@ -138,7 +138,7 @@ int AudioOut_MiniAudio::init()
int selected_device_index = -1;
if (!this->device_name.empty())
{
for (int i = 0; i < playback_device_count; i++)
for (unsigned int i = 0; i < playback_device_count; i++)
{
if (strncmp(playback_devices[i].name, device_name.c_str(), strlen(device_name.c_str())) == 0)
{
Expand Down Expand Up @@ -239,7 +239,7 @@ std::list<std::string> AudioOut_MiniAudio::get_output_device_names()
{
throw std::runtime_error("miniaudio: Failure querying audio devices");
}
for (int i = 0; i < playback_device_count; i++)
for (unsigned int i = 0; i < playback_device_count; i++)
{
device_names.push_back(std::string(playback_devices[i].name));
}
Expand All @@ -265,7 +265,7 @@ std::list<std::string> AudioOut_MiniAudio::get_output_backend_names()
{
throw std::runtime_error("miniaudio: Failure querying backend devices");
}
for (int i = 0; i < enabled_backend_count; i++)
for (unsigned int i = 0; i < enabled_backend_count; i++)
{
std::string backend_name = std::string(ma_get_backend_name(enabled_backends[i]));
if (backend_name != "Custom" && backend_name != "Null")
Expand Down

0 comments on commit f6f827f

Please sign in to comment.