mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-22 00:06:59 +02:00
Remove bitfields from public structures.
This commit also removes some debugging code accidentally left in from the previous commit.
This commit is contained in:
+37
-42
@@ -2504,10 +2504,10 @@ typedef struct
|
||||
float f32[MA_MAX_CHANNELS][MA_MAX_CHANNELS];
|
||||
ma_int32 s16[MA_MAX_CHANNELS][MA_MAX_CHANNELS];
|
||||
} weights;
|
||||
ma_bool32 isPassthrough : 1;
|
||||
ma_bool32 isSimpleShuffle : 1;
|
||||
ma_bool32 isSimpleMonoExpansion : 1;
|
||||
ma_bool32 isStereoToMono : 1;
|
||||
ma_bool8 isPassthrough;
|
||||
ma_bool8 isSimpleShuffle;
|
||||
ma_bool8 isSimpleMonoExpansion;
|
||||
ma_bool8 isStereoToMono;
|
||||
ma_uint8 shuffleTable[MA_MAX_CHANNELS];
|
||||
} ma_channel_converter;
|
||||
|
||||
@@ -2558,11 +2558,11 @@ typedef struct
|
||||
ma_data_converter_config config;
|
||||
ma_channel_converter channelConverter;
|
||||
ma_resampler resampler;
|
||||
ma_bool32 hasPreFormatConversion : 1;
|
||||
ma_bool32 hasPostFormatConversion : 1;
|
||||
ma_bool32 hasChannelConverter : 1;
|
||||
ma_bool32 hasResampler : 1;
|
||||
ma_bool32 isPassthrough : 1;
|
||||
ma_bool8 hasPreFormatConversion;
|
||||
ma_bool8 hasPostFormatConversion;
|
||||
ma_bool8 hasChannelConverter;
|
||||
ma_bool8 hasResampler;
|
||||
ma_bool8 isPassthrough;
|
||||
} ma_data_converter;
|
||||
|
||||
MA_API ma_result ma_data_converter_init(const ma_data_converter_config* pConfig, ma_data_converter* pConverter);
|
||||
@@ -2712,8 +2712,8 @@ typedef struct
|
||||
ma_uint32 subbufferStrideInBytes;
|
||||
volatile ma_uint32 encodedReadOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. */
|
||||
volatile ma_uint32 encodedWriteOffset; /* Most significant bit is the loop flag. Lower 31 bits contains the actual offset in bytes. */
|
||||
ma_bool32 ownsBuffer : 1; /* Used to know whether or not miniaudio is responsible for free()-ing the buffer. */
|
||||
ma_bool32 clearOnWriteAcquire : 1; /* When set, clears the acquired write buffer before returning from ma_rb_acquire_write(). */
|
||||
ma_bool8 ownsBuffer; /* Used to know whether or not miniaudio is responsible for free()-ing the buffer. */
|
||||
ma_bool8 clearOnWriteAcquire; /* When set, clears the acquired write buffer before returning from ma_rb_acquire_write(). */
|
||||
ma_allocation_callbacks allocationCallbacks;
|
||||
} ma_rb;
|
||||
|
||||
@@ -3270,8 +3270,8 @@ struct ma_device_config
|
||||
ma_uint32 periodSizeInMilliseconds;
|
||||
ma_uint32 periods;
|
||||
ma_performance_profile performanceProfile;
|
||||
ma_bool32 noPreZeroedOutputBuffer; /* When set to true, the contents of the output buffer passed into the data callback will be left undefined rather than initialized to zero. */
|
||||
ma_bool32 noClip; /* When set to true, the contents of the output buffer passed into the data callback will be clipped after returning. Only applies when the playback sample format is f32. */
|
||||
ma_bool8 noPreZeroedOutputBuffer; /* When set to true, the contents of the output buffer passed into the data callback will be left undefined rather than initialized to zero. */
|
||||
ma_bool8 noClip; /* When set to true, the contents of the output buffer passed into the data callback will be clipped after returning. Only applies when the playback sample format is f32. */
|
||||
ma_device_callback_proc dataCallback;
|
||||
ma_stop_proc stopCallback;
|
||||
void* pUserData;
|
||||
@@ -3306,10 +3306,10 @@ struct ma_device_config
|
||||
|
||||
struct
|
||||
{
|
||||
ma_bool32 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool32 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
ma_bool32 noAutoStreamRouting; /* Disables automatic stream routing. */
|
||||
ma_bool32 noHardwareOffloading; /* Disables WASAPI's hardware offloading feature. */
|
||||
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
ma_bool8 noAutoStreamRouting; /* Disables automatic stream routing. */
|
||||
ma_bool8 noHardwareOffloading; /* Disables WASAPI's hardware offloading feature. */
|
||||
} wasapi;
|
||||
struct
|
||||
{
|
||||
@@ -3509,7 +3509,7 @@ struct ma_context
|
||||
ma_uint32 playbackDeviceInfoCount;
|
||||
ma_uint32 captureDeviceInfoCount;
|
||||
ma_device_info* pDeviceInfos; /* Playback devices first, then capture. */
|
||||
ma_bool32 isBackendAsynchronous : 1; /* Set when the context is initialized. Set to 1 for asynchronous backends such as Core Audio and JACK. Do not modify. */
|
||||
ma_bool8 isBackendAsynchronous; /* Set when the context is initialized. Set to 1 for asynchronous backends such as Core Audio and JACK. Do not modify. */
|
||||
|
||||
ma_result (* onUninit )(ma_context* pContext);
|
||||
ma_result (* onEnumDevices )(ma_context* pContext, ma_enum_devices_callback_proc callback, void* pUserData); /* Return false from the callback to stop enumeration. */
|
||||
@@ -3910,12 +3910,12 @@ struct ma_device
|
||||
ma_event stopEvent;
|
||||
ma_thread thread;
|
||||
ma_result workResult; /* This is set by the worker thread after it's finished doing a job. */
|
||||
ma_bool32 usingDefaultSampleRate : 1;
|
||||
ma_bool32 usingDefaultBufferSize : 1;
|
||||
ma_bool32 usingDefaultPeriods : 1;
|
||||
ma_bool32 isOwnerOfContext : 1; /* When set to true, uninitializing the device will also uninitialize the context. Set to true when NULL is passed into ma_device_init(). */
|
||||
ma_bool32 noPreZeroedOutputBuffer : 1;
|
||||
ma_bool32 noClip : 1;
|
||||
ma_bool8 usingDefaultSampleRate;
|
||||
ma_bool8 usingDefaultBufferSize;
|
||||
ma_bool8 usingDefaultPeriods;
|
||||
ma_bool8 isOwnerOfContext; /* When set to true, uninitializing the device will also uninitialize the context. Set to true when NULL is passed into ma_device_init(). */
|
||||
ma_bool8 noPreZeroedOutputBuffer;
|
||||
ma_bool8 noClip;
|
||||
volatile float masterVolumeFactor; /* Volatile so we can use some thread safety when applying volume to periods. */
|
||||
ma_duplex_rb duplexRB; /* Intermediary buffer for duplex device on asynchronous backends. */
|
||||
struct
|
||||
@@ -3935,9 +3935,6 @@ struct ma_device
|
||||
ma_device_id id; /* If using an explicit device, will be set to a copy of the ID used for initialization. Otherwise cleared to 0. */
|
||||
char name[256]; /* Maybe temporary. Likely to be replaced with a query API. */
|
||||
ma_share_mode shareMode; /* Set to whatever was passed in when the device was initialized. */
|
||||
ma_bool32 usingDefaultFormat : 1;
|
||||
ma_bool32 usingDefaultChannels : 1;
|
||||
ma_bool32 usingDefaultChannelMap : 1;
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_channel channelMap[MA_MAX_CHANNELS];
|
||||
@@ -3948,15 +3945,15 @@ struct ma_device
|
||||
ma_uint32 internalPeriodSizeInFrames;
|
||||
ma_uint32 internalPeriods;
|
||||
ma_data_converter converter;
|
||||
ma_bool8 usingDefaultFormat;
|
||||
ma_bool8 usingDefaultChannels;
|
||||
ma_bool8 usingDefaultChannelMap;
|
||||
} playback;
|
||||
struct
|
||||
{
|
||||
ma_device_id id; /* If using an explicit device, will be set to a copy of the ID used for initialization. Otherwise cleared to 0. */
|
||||
char name[256]; /* Maybe temporary. Likely to be replaced with a query API. */
|
||||
ma_share_mode shareMode; /* Set to whatever was passed in when the device was initialized. */
|
||||
ma_bool32 usingDefaultFormat : 1;
|
||||
ma_bool32 usingDefaultChannels : 1;
|
||||
ma_bool32 usingDefaultChannelMap : 1;
|
||||
ma_format format;
|
||||
ma_uint32 channels;
|
||||
ma_channel channelMap[MA_MAX_CHANNELS];
|
||||
@@ -3967,6 +3964,9 @@ struct ma_device
|
||||
ma_uint32 internalPeriodSizeInFrames;
|
||||
ma_uint32 internalPeriods;
|
||||
ma_data_converter converter;
|
||||
ma_bool8 usingDefaultFormat;
|
||||
ma_bool8 usingDefaultChannels;
|
||||
ma_bool8 usingDefaultChannelMap;
|
||||
} capture;
|
||||
|
||||
union
|
||||
@@ -3994,11 +3994,11 @@ struct ma_device
|
||||
ma_uint32 periodSizeInFramesCapture;
|
||||
ma_bool32 isStartedCapture; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
ma_bool32 isStartedPlayback; /* <-- Make sure this is always a whole 32-bits because we use atomic assignments. */
|
||||
ma_bool32 noAutoConvertSRC : 1; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool32 noDefaultQualitySRC : 1; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
ma_bool32 noHardwareOffloading : 1;
|
||||
ma_bool32 allowCaptureAutoStreamRouting : 1;
|
||||
ma_bool32 allowPlaybackAutoStreamRouting : 1;
|
||||
ma_bool8 noAutoConvertSRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM. */
|
||||
ma_bool8 noDefaultQualitySRC; /* When set to true, disables the use of AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY. */
|
||||
ma_bool8 noHardwareOffloading;
|
||||
ma_bool8 allowCaptureAutoStreamRouting;
|
||||
ma_bool8 allowPlaybackAutoStreamRouting;
|
||||
} wasapi;
|
||||
#endif
|
||||
#ifdef MA_SUPPORT_DSOUND
|
||||
@@ -4035,8 +4035,8 @@ struct ma_device
|
||||
{
|
||||
/*snd_pcm_t**/ ma_ptr pPCMPlayback;
|
||||
/*snd_pcm_t**/ ma_ptr pPCMCapture;
|
||||
ma_bool32 isUsingMMapPlayback : 1;
|
||||
ma_bool32 isUsingMMapCapture : 1;
|
||||
ma_bool8 isUsingMMapPlayback;
|
||||
ma_bool8 isUsingMMapCapture;
|
||||
} alsa;
|
||||
#endif
|
||||
#ifdef MA_SUPPORT_PULSEAUDIO
|
||||
@@ -32442,14 +32442,9 @@ MA_API ma_result ma_context_get_device_info(ma_context* pContext, ma_device_type
|
||||
deviceInfo.maxSampleRate = 0;
|
||||
|
||||
for (iNativeFormat = 0; iNativeFormat < deviceInfo.nativeDataFormatCount; iNativeFormat += 1) {
|
||||
printf("format: %d\n", deviceInfo.nativeDataFormats[iNativeFormat].format);
|
||||
printf("channels: %d\n", deviceInfo.nativeDataFormats[iNativeFormat].channels);
|
||||
printf("rate: %d\n", deviceInfo.nativeDataFormats[iNativeFormat].sampleRate);
|
||||
|
||||
/* Formats. */
|
||||
if (deviceInfo.nativeDataFormats[iNativeFormat].format == ma_format_unknown) {
|
||||
/* All formats are supported. */
|
||||
printf("==== ALL FORMATS ====\n");
|
||||
deviceInfo.formats[0] = ma_format_u8;
|
||||
deviceInfo.formats[1] = ma_format_s16;
|
||||
deviceInfo.formats[2] = ma_format_s24;
|
||||
|
||||
Reference in New Issue
Block a user