mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-21 15:56:58 +02:00
Add the notion of samples rates to audio buffers.
This commit is contained in:
+11
-4
@@ -9335,6 +9335,7 @@ typedef struct
|
||||
ma_data_source_base ds;
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_uint32 sampleRate;
|
||||
ma_uint64 cursor;
|
||||
ma_uint64 sizeInFrames;
|
||||
const void* pData;
|
||||
@@ -9358,6 +9359,7 @@ typedef struct
|
||||
{
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_uint32 sampleRate;
|
||||
ma_uint64 sizeInFrames;
|
||||
const void* pData; /* If set to NULL, will allocate a block of memory for you. */
|
||||
ma_allocation_callbacks allocationCallbacks;
|
||||
@@ -55200,7 +55202,7 @@ static ma_result ma_audio_buffer_ref__data_source_on_get_data_format(ma_data_sou
|
||||
|
||||
*pFormat = pAudioBufferRef->format;
|
||||
*pChannels = pAudioBufferRef->channels;
|
||||
*pSampleRate = 0; /* There is no notion of a sample rate with audio buffers. */
|
||||
*pSampleRate = pAudioBufferRef->sampleRate;
|
||||
ma_channel_map_init_standard(ma_standard_channel_map_default, pChannelMap, channelMapCap, pAudioBufferRef->channels);
|
||||
|
||||
return MA_SUCCESS;
|
||||
@@ -55256,6 +55258,7 @@ MA_API ma_result ma_audio_buffer_ref_init(ma_format format, ma_uint32 channels,
|
||||
|
||||
pAudioBufferRef->format = format;
|
||||
pAudioBufferRef->channels = channels;
|
||||
pAudioBufferRef->sampleRate = 0; /* TODO: Version 0.12. Set this to sampleRate. */
|
||||
pAudioBufferRef->cursor = 0;
|
||||
pAudioBufferRef->sizeInFrames = sizeInFrames;
|
||||
pAudioBufferRef->pData = pData;
|
||||
@@ -55466,10 +55469,11 @@ MA_API ma_audio_buffer_config ma_audio_buffer_config_init(ma_format format, ma_u
|
||||
ma_audio_buffer_config config;
|
||||
|
||||
MA_ZERO_OBJECT(&config);
|
||||
config.format = format;
|
||||
config.channels = channels;
|
||||
config.format = format;
|
||||
config.channels = channels;
|
||||
config.sampleRate = 0; /* TODO: Version 0.12. Set this to sampleRate. */
|
||||
config.sizeInFrames = sizeInFrames;
|
||||
config.pData = pData;
|
||||
config.pData = pData;
|
||||
ma_allocation_callbacks_init_copy(&config.allocationCallbacks, pAllocationCallbacks);
|
||||
|
||||
return config;
|
||||
@@ -55498,6 +55502,9 @@ static ma_result ma_audio_buffer_init_ex(const ma_audio_buffer_config* pConfig,
|
||||
return result;
|
||||
}
|
||||
|
||||
/* TODO: Version 0.12. Set this in ma_audio_buffer_ref_init() instead of here. */
|
||||
pAudioBuffer->ref.sampleRate = pConfig->sampleRate;
|
||||
|
||||
ma_allocation_callbacks_init_copy(&pAudioBuffer->allocationCallbacks, &pConfig->allocationCallbacks);
|
||||
|
||||
if (doCopy) {
|
||||
|
||||
Reference in New Issue
Block a user