Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
miniaudio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
miniaudio
Commits
841c0b8d
Commit
841c0b8d
authored
Feb 11, 2020
by
David Reid
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor restructuring in preparation for removing -lm dependency.
parent
25b21e58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
8 deletions
+46
-8
miniaudio.h
miniaudio.h
+46
-8
No files found.
miniaudio.h
View file @
841c0b8d
...
...
@@ -5027,11 +5027,49 @@ Standard Library Stuff
#define ma_clamp(x, lo, hi) (ma_max(lo, ma_min(x, hi)))
#define ma_offset_ptr(p, offset) (((ma_uint8*)(p)) + (offset))
#define ma_sinf(x) ((float)sin((double)(x)))
#define ma_cosf(x) ((float)cos((double)(x)))
#define ma_buffer_frame_capacity(buffer, channels, format) (sizeof(buffer) / ma_get_bytes_per_sample(format) / (channels))
static MA_INLINE double ma_sin(double x)
{
/* TODO: Implement custom sin(x). */
return sin(x);
}
static MA_INLINE double ma_cos(double x)
{
return ma_sin((MA_PI*0.5) - x);
}
static MA_INLINE double ma_log2(double x)
{
/* TODO: Implement custom log2(x). */
return log2(x);
}
static MA_INLINE double ma_pow(double x, double y)
{
/* TODO: Implement custom pow(x, y). */
return pow(x, y);
}
static MA_INLINE double ma_log10(double x)
{
return ma_log2(x) * 0.30102999566398119521;
}
static MA_INLINE float ma_powf(float x, float y)
{
return (float)ma_pow((double)x, (double)y);
}
static MA_INLINE float ma_log10f(float x)
{
return (float)ma_log10((double)x);
}
/*
Return Values:
0: Success
...
...
@@ -7007,12 +7045,12 @@ void ma_apply_volume_factor_pcm_frames(void* pPCMFrames, ma_uint32 frameCount, m
float ma_factor_to_gain_db(float factor)
{
return (float)(20*
log10
(factor));
return (float)(20*
ma_log10f
(factor));
}
float ma_gain_db_to_factor(float gain)
{
return (float)
pow(10, gain/20.0
);
return (float)
ma_powf(10, gain/20.0f
);
}
...
...
@@ -28569,8 +28607,8 @@ static MA_INLINE ma_biquad_config ma_lpf__get_biquad_config(const ma_lpf_config*
q = 0.707107;
w = 2 * MA_PI_D * pConfig->cutoffFrequency / pConfig->sampleRate;
s = sin(w);
c = cos(w);
s =
ma_
sin(w);
c =
ma_
cos(w);
a = s / (2*q);
bqConfig.b0 = (1 - c) / 2;
...
...
@@ -37363,7 +37401,7 @@ ma_uint64 ma_sine_wave_read_pcm_frames(ma_sine_wave* pSineWave, void* pFramesOut
ma_uint64 iChannel;
float s;
s = (float)(sin(pSineWave->time * pSineWave->periodsPerSecond) * pSineWave->amplitude);
s = (float)(
ma_
sin(pSineWave->time * pSineWave->periodsPerSecond) * pSineWave->amplitude);
pSineWave->time += pSineWave->delta;
for (iChannel = 0; iChannel < channels; iChannel += 1) {
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment