Skip to content

Commit

Permalink
lichen-community-systemsgh-67: Addresses several warning revealed by …
Browse files Browse the repository at this point in the history
…MSVC.
  • Loading branch information
colinbdclark committed Jul 6, 2024
1 parent 00b1500 commit f5dc957
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion libsignaletic/include/libsignaletic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ float sig_DelayLine_allpass(struct sig_DelayLine* self, float sample,
size_t readPos, float g);

float sig_DelayLine_linearAllpass(struct sig_DelayLine* self,
float sample, size_t readPos, float g);
float sample, float readPos, float g);

float sig_DelayLine_cubicAllpass(struct sig_DelayLine* self, float sample,
float readPos, float g);
Expand Down
20 changes: 10 additions & 10 deletions libsignaletic/src/libsignaletic.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,33 @@ inline float sig_linearMap(float value,
return (value - fromMin) * (toMax - toMin) / (fromMax - fromMin) + toMin;
}

inline uint16_t sig_unipolarToUint12(float sample) {
extern inline uint16_t sig_unipolarToUint12(float sample) {
return (uint16_t) (sample * 4095.0f);
}

inline uint16_t sig_bipolarToUint12(float sample) {
extern inline uint16_t sig_bipolarToUint12(float sample) {
float normalized = sample * 0.5 + 0.5;
return (uint16_t) (normalized * 4095.0f);
}

inline uint16_t sig_bipolarToInvUint12(float sample) {
extern inline uint16_t sig_bipolarToInvUint12(float sample) {
return sig_bipolarToUint12(-sample);
}

inline float sig_uint16ToBipolar(uint16_t sample) {
extern inline float sig_uint16ToBipolar(uint16_t sample) {
float normalized = (float) (sample / 65535.0f);
float scaled = normalized * 2.0f - 1.0f;

return scaled;
}

inline float sig_uint16ToUnipolar(uint16_t sample) {
extern inline float sig_uint16ToUnipolar(uint16_t sample) {
float normalized = (float) (sample / 65535.0f);

return normalized;
}

inline float sig_invUint16ToBipolar(uint16_t sample) {
extern inline float sig_invUint16ToBipolar(uint16_t sample) {
return -sig_uint16ToBipolar(sample);
}

Expand Down Expand Up @@ -922,7 +922,7 @@ inline float sig_DelayLine_allpass(struct sig_DelayLine* self, float sample,
}

inline float sig_DelayLine_linearAllpass(struct sig_DelayLine* self,
float sample, size_t readPos, float g) {
float sample, float readPos, float g) {
sig_DelayLine_allpass_IMPL(self, sample, readPos, g,
sig_DelayLine_linearReadAt);
}
Expand Down Expand Up @@ -3114,8 +3114,8 @@ void sig_dsp_TiltEQ_init(struct sig_dsp_TiltEQ* self,

void sig_dsp_TiltEQ_generate(void* signal) {
struct sig_dsp_TiltEQ* self = (struct sig_dsp_TiltEQ*) signal;
float amp = 8.656170; // 6.0f / log(2)
float gfactor = 5.0; // Proportional gain.
float amp = 8.656170f; // 6.0f / log(2)
float gfactor = 5.0f; // Proportional gain.
float sr3 = self->sr3;
float lpOut = self->lpOut;

Expand Down Expand Up @@ -3328,7 +3328,7 @@ void sig_dsp_Comb_generate(void* signal) {
readPos = maxDelayLength - 1;
}

delayTime = sig_fmaxf(delayTime, 0.00001); // Delay time can't be zero.
delayTime = sig_fmaxf(delayTime, 0.00001f); // Delay time can't be zero.
float read = sig_DelayLine_linearReadAt(self->delayLine, readPos);
float outputSample = sig_filter_smooth(read, self->previousSample,
lpfCoefficient);
Expand Down
14 changes: 7 additions & 7 deletions libsignaletic/tests/test-libsignaletic.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ void test_sig_fillWithSilence(void) {
testAssertBufferIsSilent(&allocator, buffer, 16);
}

void test_sig_AudioSettings_new() {
void test_sig_AudioSettings_new(void) {
struct sig_AudioSettings* s = sig_AudioSettings_new(&allocator);

TEST_ASSERT_EQUAL_FLOAT_MESSAGE(sig_DEFAULT_AUDIOSETTINGS.sampleRate,
Expand All @@ -226,7 +226,7 @@ void test_sig_AudioSettings_new() {
sig_AudioSettings_destroy(&allocator, s);
}

void test_sig_samplesToSeconds() {
void test_sig_samplesToSeconds(void) {
struct sig_AudioSettings* s = sig_AudioSettings_new(&allocator);

size_t expected = 48000;
Expand Down Expand Up @@ -787,17 +787,17 @@ void testClockDetector_SingleWaveform(sig_waveform_generator waveform,
WaveformPlayer_destroy(clockPlayer);
}

void test_sig_dsp_ClockDetector_square() {
void test_sig_dsp_ClockDetector_square(void) {
// Square wave, 2Hz for two seconds.
testClockDetector_SingleWaveform(sig_waveform_square, 2.0f, 2.0f);
}

void test_sig_dsp_ClockDetector_sine() {
void test_sig_dsp_ClockDetector_sine(void) {
// Sine wave, 10 Hz.
testClockDetector_SingleWaveform(sig_waveform_sine, 2.0f, 10.0f);
}

void test_sig_dsp_ClockDetector_slowDown() {
void test_sig_dsp_ClockDetector_slowDown(void) {
float bufferDuration = 2.0f;
size_t bufferLen = (size_t) (audioSettings->sampleRate * bufferDuration);
size_t halfBufferLen = bufferLen / 2;
Expand Down Expand Up @@ -827,14 +827,14 @@ void test_sig_dsp_ClockDetector_slowDown() {
sig_test_BufferPlayer_destroy(&allocator, clockPlayer);
}

void test_sig_dsp_ClockDetector_stop() {
void test_sig_dsp_ClockDetector_stop(void) {
float bufferDuration = 122.0f;
float clockDuration = 1.0f;
size_t bufferLen = (size_t) (audioSettings->sampleRate * bufferDuration);
size_t clockSectionLen = (size_t)
(audioSettings->sampleRate * clockDuration);
size_t silentSectionLen = (size_t)
audioSettings->sampleRate * (bufferDuration - clockDuration);
(audioSettings->sampleRate * (bufferDuration - clockDuration));
float clockFreq = 10.0f;

struct sig_Buffer* waveformBuffer = sig_Buffer_new(&allocator, bufferLen);
Expand Down

0 comments on commit f5dc957

Please sign in to comment.