mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Move ma_copy_and_apply_volume_factor_per_channel_f32() into main file.
This commit is contained in:
+20
@@ -5900,6 +5900,8 @@ MA_API void ma_apply_volume_factor_pcm_frames_s32(ma_int32* pFrames, ma_uint64 f
|
|||||||
MA_API void ma_apply_volume_factor_pcm_frames_f32(float* pFrames, ma_uint64 frameCount, ma_uint32 channels, float factor);
|
MA_API void ma_apply_volume_factor_pcm_frames_f32(float* pFrames, ma_uint64 frameCount, ma_uint32 channels, float factor);
|
||||||
MA_API void ma_apply_volume_factor_pcm_frames(void* pFrames, ma_uint64 frameCount, ma_format format, ma_uint32 channels, float factor);
|
MA_API void ma_apply_volume_factor_pcm_frames(void* pFrames, ma_uint64 frameCount, ma_format format, ma_uint32 channels, float factor);
|
||||||
|
|
||||||
|
MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Helper for converting a linear factor to gain in decibels.
|
Helper for converting a linear factor to gain in decibels.
|
||||||
@@ -34516,6 +34518,24 @@ MA_API void ma_apply_volume_factor_pcm_frames(void* pPCMFrames, ma_uint64 frameC
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains)
|
||||||
|
{
|
||||||
|
ma_uint64 iFrame;
|
||||||
|
|
||||||
|
if (channels == 2) {
|
||||||
|
/* TODO: Do an optimized implementation for stereo and mono. Can do a SIMD optimized implementation as well. */
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
|
||||||
|
ma_uint32 iChannel;
|
||||||
|
for (iChannel = 0; iChannel < channels; iChannel += 1) {
|
||||||
|
pFramesOut[iFrame * channels + iChannel] = pFramesIn[iFrame * channels + iChannel] * pChannelGains[iChannel];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MA_API float ma_factor_to_gain_db(float factor)
|
MA_API float ma_factor_to_gain_db(float factor)
|
||||||
{
|
{
|
||||||
return (float)(20*ma_log10f(factor));
|
return (float)(20*ma_log10f(factor));
|
||||||
|
|||||||
@@ -304,9 +304,6 @@ job will be posted back onto the job queue for later processing. When the job fi
|
|||||||
system means the no matter how many job threads are executing, decoding of an individual sound will always get processed serially. The advantage to having
|
system means the no matter how many job threads are executing, decoding of an individual sound will always get processed serially. The advantage to having
|
||||||
multiple threads comes into play when loading multiple sounds at the time time.
|
multiple threads comes into play when loading multiple sounds at the time time.
|
||||||
*/
|
*/
|
||||||
MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains);
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
ma_uint32 channels;
|
ma_uint32 channels;
|
||||||
@@ -2909,23 +2906,6 @@ static void ma_channel_map_apply_f32(float* pFramesOut, const ma_channel* pChann
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
MA_API void ma_copy_and_apply_volume_factor_per_channel_f32(float* pFramesOut, const float* pFramesIn, ma_uint64 frameCount, ma_uint32 channels, float* pChannelGains)
|
|
||||||
{
|
|
||||||
ma_uint64 iFrame;
|
|
||||||
|
|
||||||
if (channels == 2) {
|
|
||||||
/* TODO: Do an optimized implementation for stereo and mono. Can do a SIMD optimized implementation as well. */
|
|
||||||
}
|
|
||||||
|
|
||||||
for (iFrame = 0; iFrame < frameCount; iFrame += 1) {
|
|
||||||
ma_uint32 iChannel;
|
|
||||||
for (iChannel = 0; iChannel < channels; iChannel += 1) {
|
|
||||||
pFramesOut[iFrame * channels + iChannel] = pFramesIn[iFrame * channels + iChannel] * pChannelGains[iChannel];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume)
|
static ma_result ma_mix_pcm_frames_f32(float* pDst, const float* pSrc, ma_uint64 frameCount, ma_uint32 channels, float volume)
|
||||||
{
|
{
|
||||||
ma_uint64 iSample;
|
ma_uint64 iSample;
|
||||||
@@ -14360,7 +14340,7 @@ static ma_node_vtable g_ma_delay_node_vtable =
|
|||||||
NULL,
|
NULL,
|
||||||
1, /* 1 input channels. */
|
1, /* 1 input channels. */
|
||||||
1, /* 1 output channel. */
|
1, /* 1 output channel. */
|
||||||
MA_NODE_FLAG_CONTINUOUS_PROCESSING /* Reverb requires continuous processing to ensure the tail get's processed. */
|
MA_NODE_FLAG_CONTINUOUS_PROCESSING /* Delay requires continuous processing to ensure the tail get's processed. */
|
||||||
};
|
};
|
||||||
|
|
||||||
MA_API ma_result ma_delay_node_init(ma_node_graph* pNodeGraph, const ma_delay_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_delay_node* pDelayNode)
|
MA_API ma_result ma_delay_node_init(ma_node_graph* pNodeGraph, const ma_delay_node_config* pConfig, const ma_allocation_callbacks* pAllocationCallbacks, ma_delay_node* pDelayNode)
|
||||||
|
|||||||
Reference in New Issue
Block a user