mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-24 09:14:04 +02:00
Merge branch 'master' into dev-0.12
This commit is contained in:
+11
-1
@@ -1,9 +1,19 @@
|
|||||||
v0.11.18 - TBD
|
v0.11.18 - 2023-08-07
|
||||||
=====================
|
=====================
|
||||||
* Fix some AIFF compatibility issues.
|
* Fix some AIFF compatibility issues.
|
||||||
|
* Fix an error where the cursor of a Vorbis stream is incorrectly incremented.
|
||||||
* Add support for setting a callback on an `ma_engine` object that get's fired after it processes a chunk of audio. This allows applications to do things such as apply a post-processing effect or output the audio to a file.
|
* Add support for setting a callback on an `ma_engine` object that get's fired after it processes a chunk of audio. This allows applications to do things such as apply a post-processing effect or output the audio to a file.
|
||||||
* Add `ma_engine_get_volume()`.
|
* Add `ma_engine_get_volume()`.
|
||||||
|
* Add `ma_sound_get_time_in_milliseconds()`.
|
||||||
|
* Decouple `MA_API` and `MA_PRIVATE`. This relaxes applications from needing to define both of them if they're only wanting to redefine one.
|
||||||
|
* Decoding backends will now have their onInitFile/W and onInitMemory initialization routines used where appropriate if they're defined.
|
||||||
|
* Increase the accuracy of the linear resampler when setting the ratio with `ma_linear_resampler_set_rate_ratio()`.
|
||||||
|
* Fix erroneous output with the linear resampler when in/out rates are the same.
|
||||||
* AAudio: Fix an error where the buffer size is not configured correctly which sometimes results in excessively high latency.
|
* AAudio: Fix an error where the buffer size is not configured correctly which sometimes results in excessively high latency.
|
||||||
|
* ALSA: Fix a possible error when stopping and restarting a device.
|
||||||
|
* PulseAudio: Minor changes to stream flags.
|
||||||
|
* Win32: Fix an error where `CoUninialize()` is being called when the corresponding `CoInitializeEx()` fails.
|
||||||
|
* Web / Emscripten: Add support for AudioWorklets. This is opt-in and can be enabled by defining `MA_ENABLE_AUDIO_WORKLETS`. You must compile with `-sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY` for this to work. Requires at least Emscripten v3.1.32.
|
||||||
|
|
||||||
|
|
||||||
v0.11.17 - 2023-05-27
|
v0.11.17 - 2023-05-27
|
||||||
|
|||||||
@@ -11,6 +11,10 @@ path like "C:\emsdk\emsdk_env.bat". Note that PowerShell doesn't work for me for
|
|||||||
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html
|
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html
|
||||||
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html -s WASM=0 -Wall -Wextra
|
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html -s WASM=0 -Wall -Wextra
|
||||||
|
|
||||||
|
To compile with support for Audio Worklets:
|
||||||
|
|
||||||
|
emcc ../simple_playback_sine.c -o bin/simple_playback_sine.html -DMA_ENABLE_AUDIO_WORKLETS -sAUDIO_WORKLET=1 -sWASM_WORKERS=1 -sASYNCIFY
|
||||||
|
|
||||||
If you output WASM it may not work when running the web page locally. To test you can run with something
|
If you output WASM it may not work when running the web page locally. To test you can run with something
|
||||||
like this:
|
like this:
|
||||||
|
|
||||||
|
|||||||
+1569
-691
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
Audio playback and capture library. Choice of public domain or MIT-0. See license statements at the end of this file.
|
||||||
miniaudio - v0.11.17 - 2023-05-27
|
miniaudio - v0.11.18 - 2023-08-07
|
||||||
|
|
||||||
David Reid - mackron@gmail.com
|
David Reid - mackron@gmail.com
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define MA_VERSION_MAJOR 0
|
#define MA_VERSION_MAJOR 0
|
||||||
#define MA_VERSION_MINOR 11
|
#define MA_VERSION_MINOR 11
|
||||||
#define MA_VERSION_REVISION 17
|
#define MA_VERSION_REVISION 18
|
||||||
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
|
#define MA_VERSION_STRING MA_XSTRINGIFY(MA_VERSION_MAJOR) "." MA_XSTRINGIFY(MA_VERSION_MINOR) "." MA_XSTRINGIFY(MA_VERSION_REVISION)
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(__clang__)
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
@@ -248,7 +248,7 @@ typedef ma_uint16 wchar_t;
|
|||||||
#define MA_NO_INLINE
|
#define MA_NO_INLINE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(MA_API)
|
/* MA_DLL is not officially supported. You're on your own if you want to use this. */
|
||||||
#if defined(MA_DLL)
|
#if defined(MA_DLL)
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define MA_DLL_IMPORT __declspec(dllimport)
|
#define MA_DLL_IMPORT __declspec(dllimport)
|
||||||
@@ -265,19 +265,29 @@ typedef ma_uint16 wchar_t;
|
|||||||
#define MA_DLL_PRIVATE static
|
#define MA_DLL_PRIVATE static
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MA_API)
|
||||||
|
#if defined(MA_DLL)
|
||||||
#if defined(MINIAUDIO_IMPLEMENTATION) || defined(MA_IMPLEMENTATION)
|
#if defined(MINIAUDIO_IMPLEMENTATION) || defined(MA_IMPLEMENTATION)
|
||||||
#define MA_API MA_DLL_EXPORT
|
#define MA_API MA_DLL_EXPORT
|
||||||
#else
|
#else
|
||||||
#define MA_API MA_DLL_IMPORT
|
#define MA_API MA_DLL_IMPORT
|
||||||
#endif
|
#endif
|
||||||
#define MA_PRIVATE MA_DLL_PRIVATE
|
|
||||||
#else
|
#else
|
||||||
#define MA_API extern
|
#define MA_API extern
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined(MA_STATIC)
|
||||||
|
#if defined(MA_DLL)
|
||||||
|
#define MA_PRIVATE MA_DLL_PRIVATE
|
||||||
|
#else
|
||||||
#define MA_PRIVATE static
|
#define MA_PRIVATE static
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* SIMD alignment in bytes. Currently set to 32 bytes in preparation for future AVX optimizations. */
|
/* SIMD alignment in bytes. Currently set to 32 bytes in preparation for future AVX optimizations. */
|
||||||
#define MA_SIMD_ALIGNMENT 32
|
#define MA_SIMD_ALIGNMENT 32
|
||||||
|
|
||||||
@@ -1351,13 +1361,14 @@ typedef struct
|
|||||||
float volumeBeg; /* If volumeBeg and volumeEnd is equal to 1, no fading happens (ma_fader_process_pcm_frames() will run as a passthrough). */
|
float volumeBeg; /* If volumeBeg and volumeEnd is equal to 1, no fading happens (ma_fader_process_pcm_frames() will run as a passthrough). */
|
||||||
float volumeEnd;
|
float volumeEnd;
|
||||||
ma_uint64 lengthInFrames; /* The total length of the fade. */
|
ma_uint64 lengthInFrames; /* The total length of the fade. */
|
||||||
ma_uint64 cursorInFrames; /* The current time in frames. Incremented by ma_fader_process_pcm_frames(). */
|
ma_int64 cursorInFrames; /* The current time in frames. Incremented by ma_fader_process_pcm_frames(). Signed because it'll be offset by startOffsetInFrames in set_fade_ex(). */
|
||||||
} ma_fader;
|
} ma_fader;
|
||||||
|
|
||||||
MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader);
|
MA_API ma_result ma_fader_init(const ma_fader_config* pConfig, ma_fader* pFader);
|
||||||
MA_API ma_result ma_fader_process_pcm_frames(ma_fader* pFader, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
MA_API ma_result ma_fader_process_pcm_frames(ma_fader* pFader, void* pFramesOut, const void* pFramesIn, ma_uint64 frameCount);
|
||||||
MA_API void ma_fader_get_data_format(const ma_fader* pFader, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate);
|
MA_API void ma_fader_get_data_format(const ma_fader* pFader, ma_format* pFormat, ma_uint32* pChannels, ma_uint32* pSampleRate);
|
||||||
MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames);
|
MA_API void ma_fader_set_fade(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames);
|
||||||
|
MA_API void ma_fader_set_fade_ex(ma_fader* pFader, float volumeBeg, float volumeEnd, ma_uint64 lengthInFrames, ma_int64 startOffsetInFrames);
|
||||||
MA_API float ma_fader_get_current_volume(const ma_fader* pFader);
|
MA_API float ma_fader_get_current_volume(const ma_fader* pFader);
|
||||||
|
|
||||||
|
|
||||||
@@ -3402,7 +3413,7 @@ struct ma_device_config
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
The callback for handling device enumeration. This is fired from `ma_context_enumerated_devices()`.
|
The callback for handling device enumeration. This is fired from `ma_context_enumerate_devices()`.
|
||||||
|
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
@@ -3976,6 +3987,8 @@ struct ma_context
|
|||||||
ma_proc RegOpenKeyExA;
|
ma_proc RegOpenKeyExA;
|
||||||
ma_proc RegCloseKey;
|
ma_proc RegCloseKey;
|
||||||
ma_proc RegQueryValueExA;
|
ma_proc RegQueryValueExA;
|
||||||
|
|
||||||
|
/*HRESULT*/ long CoInitializeResult;
|
||||||
} win32;
|
} win32;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MA_POSIX
|
#ifdef MA_POSIX
|
||||||
@@ -4255,21 +4268,12 @@ struct ma_device
|
|||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
/* AudioWorklets path. */
|
/* AudioWorklets path. */
|
||||||
/* EMSCRIPTEN_WEBAUDIO_T */ int audioContextPlayback;
|
/* EMSCRIPTEN_WEBAUDIO_T */ int audioContext;
|
||||||
/* EMSCRIPTEN_WEBAUDIO_T */ int audioContextCapture;
|
/* EMSCRIPTEN_WEBAUDIO_T */ int audioWorklet;
|
||||||
/* EMSCRIPTEN_AUDIO_WORKLET_NODE_T */ int workletNodePlayback;
|
float* pIntermediaryBuffer;
|
||||||
/* EMSCRIPTEN_AUDIO_WORKLET_NODE_T */ int workletNodeCapture;
|
void* pStackBuffer;
|
||||||
size_t intermediaryBufferSizeInFramesPlayback;
|
ma_result initResult; /* Set to MA_BUSY while initialization is in progress. */
|
||||||
size_t intermediaryBufferSizeInFramesCapture;
|
int deviceIndex; /* We store the device in a list on the JavaScript side. This is used to map our C object to the JS object. */
|
||||||
float* pIntermediaryBufferPlayback;
|
|
||||||
float* pIntermediaryBufferCapture;
|
|
||||||
void* pStackBufferPlayback;
|
|
||||||
void* pStackBufferCapture;
|
|
||||||
ma_bool32 isInitialized;
|
|
||||||
|
|
||||||
/* ScriptProcessorNode path. */
|
|
||||||
int indexPlayback; /* We use a factory on the JavaScript side to manage devices and use an index for JS/C interop. */
|
|
||||||
int indexCapture;
|
|
||||||
} webaudio;
|
} webaudio;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MA_SUPPORT_NULL
|
#ifdef MA_SUPPORT_NULL
|
||||||
@@ -7374,6 +7378,15 @@ typedef struct
|
|||||||
MA_ATOMIC(4, ma_bool32) isSpatializationDisabled; /* Set to false by default. When set to false, will not have spatialisation applied. */
|
MA_ATOMIC(4, ma_bool32) isSpatializationDisabled; /* Set to false by default. When set to false, will not have spatialisation applied. */
|
||||||
MA_ATOMIC(4, ma_uint32) pinnedListenerIndex; /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */
|
MA_ATOMIC(4, ma_uint32) pinnedListenerIndex; /* The index of the listener this node should always use for spatialization. If set to MA_LISTENER_INDEX_CLOSEST the engine will use the closest listener. */
|
||||||
|
|
||||||
|
/* When setting a fade, it's not done immediately in ma_sound_set_fade(). It's deferred to the audio thread which means we need to store the settings here. */
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ma_atomic_float volumeBeg;
|
||||||
|
ma_atomic_float volumeEnd;
|
||||||
|
ma_atomic_uint64 fadeLengthInFrames; /* <-- Defaults to (~(ma_uint64)0) which is used to indicate that no fade should be applied. */
|
||||||
|
ma_atomic_uint64 absoluteGlobalTimeInFrames; /* <-- The time to start the fade. */
|
||||||
|
} fadeSettings;
|
||||||
|
|
||||||
/* Memory management. */
|
/* Memory management. */
|
||||||
ma_bool8 _ownsHeap;
|
ma_bool8 _ownsHeap;
|
||||||
void* _pHeap;
|
void* _pHeap;
|
||||||
@@ -7454,6 +7467,8 @@ typedef ma_sound ma_sound_group;
|
|||||||
MA_API ma_sound_group_config ma_sound_group_config_init(void); /* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
|
MA_API ma_sound_group_config ma_sound_group_config_init(void); /* Deprecated. Will be removed in version 0.12. Use ma_sound_config_2() instead. */
|
||||||
MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine); /* Will be renamed to ma_sound_config_init() in version 0.12. */
|
MA_API ma_sound_group_config ma_sound_group_config_init_2(ma_engine* pEngine); /* Will be renamed to ma_sound_config_init() in version 0.12. */
|
||||||
|
|
||||||
|
typedef void (* ma_engine_process_proc)(void* pUserData, float* pFramesOut, ma_uint64 frameCount);
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
#if !defined(MA_NO_RESOURCE_MANAGER)
|
#if !defined(MA_NO_RESOURCE_MANAGER)
|
||||||
@@ -7463,6 +7478,7 @@ typedef struct
|
|||||||
ma_context* pContext;
|
ma_context* pContext;
|
||||||
ma_device* pDevice; /* If set, the caller is responsible for calling ma_engine_data_callback() in the device's data callback. */
|
ma_device* pDevice; /* If set, the caller is responsible for calling ma_engine_data_callback() in the device's data callback. */
|
||||||
ma_device_id* pPlaybackDeviceID; /* The ID of the playback device to use with the default listener. */
|
ma_device_id* pPlaybackDeviceID; /* The ID of the playback device to use with the default listener. */
|
||||||
|
ma_device_data_proc dataCallback; /* Can be null. Can be used to provide a custom device data callback. */
|
||||||
ma_device_notification_proc notificationCallback;
|
ma_device_notification_proc notificationCallback;
|
||||||
#endif
|
#endif
|
||||||
ma_log* pLog; /* When set to NULL, will use the context's log. */
|
ma_log* pLog; /* When set to NULL, will use the context's log. */
|
||||||
@@ -7479,6 +7495,8 @@ typedef struct
|
|||||||
ma_bool32 noDevice; /* When set to true, don't create a default device. ma_engine_read_pcm_frames() can be called manually to read data. */
|
ma_bool32 noDevice; /* When set to true, don't create a default device. ma_engine_read_pcm_frames() can be called manually to read data. */
|
||||||
ma_mono_expansion_mode monoExpansionMode; /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
|
ma_mono_expansion_mode monoExpansionMode; /* Controls how the mono channel should be expanded to other channels when spatialization is disabled on a sound. */
|
||||||
ma_vfs* pResourceManagerVFS; /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not NULL. */
|
ma_vfs* pResourceManagerVFS; /* A pointer to a pre-allocated VFS object to use with the resource manager. This is ignored if pResourceManager is not NULL. */
|
||||||
|
ma_engine_process_proc onProcess; /* Fired at the end of each call to ma_engine_read_pcm_frames(). For engine's that manage their own internal device (the default configuration), this will be fired from the audio thread, and you do not need to call ma_engine_read_pcm_frames() manually in order to trigger this. */
|
||||||
|
void* pProcessUserData; /* User data that's passed into onProcess. */
|
||||||
} ma_engine_config;
|
} ma_engine_config;
|
||||||
|
|
||||||
MA_API ma_engine_config ma_engine_config_init(void);
|
MA_API ma_engine_config ma_engine_config_init(void);
|
||||||
@@ -7506,6 +7524,8 @@ struct ma_engine
|
|||||||
ma_uint32 gainSmoothTimeInFrames; /* The number of frames to interpolate the gain of spatialized sounds across. */
|
ma_uint32 gainSmoothTimeInFrames; /* The number of frames to interpolate the gain of spatialized sounds across. */
|
||||||
ma_uint32 defaultVolumeSmoothTimeInPCMFrames;
|
ma_uint32 defaultVolumeSmoothTimeInPCMFrames;
|
||||||
ma_mono_expansion_mode monoExpansionMode;
|
ma_mono_expansion_mode monoExpansionMode;
|
||||||
|
ma_engine_process_proc onProcess;
|
||||||
|
void* pProcessUserData;
|
||||||
};
|
};
|
||||||
|
|
||||||
MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEngine);
|
MA_API ma_result ma_engine_init(const ma_engine_config* pConfig, ma_engine* pEngine);
|
||||||
@@ -7530,7 +7550,9 @@ MA_API ma_uint32 ma_engine_get_sample_rate(const ma_engine* pEngine);
|
|||||||
MA_API ma_result ma_engine_start(ma_engine* pEngine);
|
MA_API ma_result ma_engine_start(ma_engine* pEngine);
|
||||||
MA_API ma_result ma_engine_stop(ma_engine* pEngine);
|
MA_API ma_result ma_engine_stop(ma_engine* pEngine);
|
||||||
MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume);
|
MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume);
|
||||||
|
MA_API float ma_engine_get_volume(ma_engine* pEngine);
|
||||||
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB);
|
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB);
|
||||||
|
MA_API float ma_engine_get_gain_db(ma_engine* pEngine);
|
||||||
|
|
||||||
MA_API ma_uint32 ma_engine_get_listener_count(const ma_engine* pEngine);
|
MA_API ma_uint32 ma_engine_get_listener_count(const ma_engine* pEngine);
|
||||||
MA_API ma_uint32 ma_engine_find_closest_listener(const ma_engine* pEngine, float absolutePosX, float absolutePosY, float absolutePosZ);
|
MA_API ma_uint32 ma_engine_find_closest_listener(const ma_engine* pEngine, float absolutePosX, float absolutePosY, float absolutePosZ);
|
||||||
@@ -7564,6 +7586,8 @@ MA_API ma_engine* ma_sound_get_engine(const ma_sound* pSound);
|
|||||||
MA_API ma_data_source* ma_sound_get_data_source(const ma_sound* pSound);
|
MA_API ma_data_source* ma_sound_get_data_source(const ma_sound* pSound);
|
||||||
MA_API ma_result ma_sound_start(ma_sound* pSound);
|
MA_API ma_result ma_sound_start(ma_sound* pSound);
|
||||||
MA_API ma_result ma_sound_stop(ma_sound* pSound);
|
MA_API ma_result ma_sound_stop(ma_sound* pSound);
|
||||||
|
MA_API ma_result ma_sound_stop_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. */
|
||||||
|
MA_API ma_result ma_sound_stop_with_fade_in_milliseconds(ma_sound* pSound, ma_uint64 fadeLengthInFrames); /* Will overwrite any scheduled stop and fade. */
|
||||||
MA_API void ma_sound_set_volume(ma_sound* pSound, float volume);
|
MA_API void ma_sound_set_volume(ma_sound* pSound, float volume);
|
||||||
MA_API float ma_sound_get_volume(const ma_sound* pSound);
|
MA_API float ma_sound_get_volume(const ma_sound* pSound);
|
||||||
MA_API void ma_sound_set_pan(ma_sound* pSound, float pan);
|
MA_API void ma_sound_set_pan(ma_sound* pSound, float pan);
|
||||||
@@ -7606,13 +7630,18 @@ MA_API void ma_sound_set_directional_attenuation_factor(ma_sound* pSound, float
|
|||||||
MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound);
|
MA_API float ma_sound_get_directional_attenuation_factor(const ma_sound* pSound);
|
||||||
MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames);
|
MA_API void ma_sound_set_fade_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames);
|
||||||
MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds);
|
MA_API void ma_sound_set_fade_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds);
|
||||||
|
MA_API void ma_sound_set_fade_start_in_pcm_frames(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInFrames, ma_uint64 absoluteGlobalTimeInFrames);
|
||||||
|
MA_API void ma_sound_set_fade_start_in_milliseconds(ma_sound* pSound, float volumeBeg, float volumeEnd, ma_uint64 fadeLengthInMilliseconds, ma_uint64 absoluteGlobalTimeInMilliseconds);
|
||||||
MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound);
|
MA_API float ma_sound_get_current_fade_volume(const ma_sound* pSound);
|
||||||
MA_API void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
|
MA_API void ma_sound_set_start_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
|
||||||
MA_API void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds);
|
MA_API void ma_sound_set_start_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds);
|
||||||
MA_API void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
|
MA_API void ma_sound_set_stop_time_in_pcm_frames(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInFrames);
|
||||||
MA_API void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds);
|
MA_API void ma_sound_set_stop_time_in_milliseconds(ma_sound* pSound, ma_uint64 absoluteGlobalTimeInMilliseconds);
|
||||||
|
MA_API void ma_sound_set_stop_time_with_fade_in_pcm_frames(ma_sound* pSound, ma_uint64 stopAbsoluteGlobalTimeInFrames, ma_uint64 fadeLengthInFrames);
|
||||||
|
MA_API void ma_sound_set_stop_time_with_fade_in_milliseconds(ma_sound* pSound, ma_uint64 stopAbsoluteGlobalTimeInMilliseconds, ma_uint64 fadeLengthInMilliseconds);
|
||||||
MA_API ma_bool32 ma_sound_is_playing(const ma_sound* pSound);
|
MA_API ma_bool32 ma_sound_is_playing(const ma_sound* pSound);
|
||||||
MA_API ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound);
|
MA_API ma_uint64 ma_sound_get_time_in_pcm_frames(const ma_sound* pSound);
|
||||||
|
MA_API ma_uint64 ma_sound_get_time_in_milliseconds(const ma_sound* pSound);
|
||||||
MA_API void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping);
|
MA_API void ma_sound_set_looping(ma_sound* pSound, ma_bool32 isLooping);
|
||||||
MA_API ma_bool32 ma_sound_is_looping(const ma_sound* pSound);
|
MA_API ma_bool32 ma_sound_is_looping(const ma_sound* pSound);
|
||||||
MA_API ma_bool32 ma_sound_at_end(const ma_sound* pSound);
|
MA_API ma_bool32 ma_sound_at_end(const ma_sound* pSound);
|
||||||
|
|||||||
+614
-542
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,4 @@
|
|||||||
|
#define MA_DEBUG_OUTPUT
|
||||||
#define MA_NO_DECODING
|
#define MA_NO_DECODING
|
||||||
#define MA_NO_ENCODING
|
#define MA_NO_ENCODING
|
||||||
#define MINIAUDIO_IMPLEMENTATION
|
#define MINIAUDIO_IMPLEMENTATION
|
||||||
@@ -73,12 +74,13 @@ static void do_duplex()
|
|||||||
|
|
||||||
deviceConfig = ma_device_config_init(ma_device_type_duplex);
|
deviceConfig = ma_device_config_init(ma_device_type_duplex);
|
||||||
deviceConfig.capture.pDeviceID = NULL;
|
deviceConfig.capture.pDeviceID = NULL;
|
||||||
deviceConfig.capture.format = ma_format_s16;
|
deviceConfig.capture.format = DEVICE_FORMAT;
|
||||||
deviceConfig.capture.channels = 2;
|
deviceConfig.capture.channels = 2;
|
||||||
deviceConfig.capture.shareMode = ma_share_mode_shared;
|
deviceConfig.capture.shareMode = ma_share_mode_shared;
|
||||||
deviceConfig.playback.pDeviceID = NULL;
|
deviceConfig.playback.pDeviceID = NULL;
|
||||||
deviceConfig.playback.format = ma_format_s16;
|
deviceConfig.playback.format = DEVICE_FORMAT;
|
||||||
deviceConfig.playback.channels = 2;
|
deviceConfig.playback.channels = 2;
|
||||||
|
deviceConfig.sampleRate = DEVICE_SAMPLE_RATE;
|
||||||
deviceConfig.dataCallback = data_callback_duplex;
|
deviceConfig.dataCallback = data_callback_duplex;
|
||||||
result = ma_device_init(NULL, &deviceConfig, &device);
|
result = ma_device_init(NULL, &deviceConfig, &device);
|
||||||
if (result != MA_SUCCESS) {
|
if (result != MA_SUCCESS) {
|
||||||
@@ -102,6 +104,12 @@ static EM_BOOL on_canvas_click(int eventType, const EmscriptenMouseEvent* pMouse
|
|||||||
}
|
}
|
||||||
|
|
||||||
isRunning = MA_TRUE;
|
isRunning = MA_TRUE;
|
||||||
|
} else {
|
||||||
|
if (ma_device_get_state(&device) == ma_device_state_started) {
|
||||||
|
ma_device_stop(&device);
|
||||||
|
} else {
|
||||||
|
ma_device_start(&device);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)eventType;
|
(void)eventType;
|
||||||
|
|||||||
Reference in New Issue
Block a user