Commit ab873752 authored by David Reid's avatar David Reid

Add ma_engine_get_volume().

Public issue https://github.com/mackron/miniaudio/issues/700
parent 0eadb0f3
......@@ -2,6 +2,7 @@ v0.11.18 - TBD
=====================
* Fix some AIFF compatibility issues.
* 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()`.
* AAudio: Fix an error where the buffer size is not configured correctly which sometimes results in excessively high latency.
......
......@@ -11219,7 +11219,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_stop(ma_engine* pEngine);
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 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_find_closest_listener(const ma_engine* pEngine, float absolutePosX, float absolutePosY, float absolutePosZ);
......@@ -74719,13 +74721,23 @@ MA_API ma_result ma_engine_set_volume(ma_engine* pEngine, float volume)
return ma_node_set_output_bus_volume(ma_node_graph_get_endpoint(&pEngine->nodeGraph), 0, volume);
}
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB)
MA_API float ma_engine_get_volume(ma_engine* pEngine)
{
if (pEngine == NULL) {
return MA_INVALID_ARGS;
return 0;
}
return ma_node_set_output_bus_volume(ma_node_graph_get_endpoint(&pEngine->nodeGraph), 0, ma_volume_db_to_linear(gainDB));
return ma_node_get_output_bus_volume(ma_node_graph_get_endpoint(&pEngine->nodeGraph), 0);
}
MA_API ma_result ma_engine_set_gain_db(ma_engine* pEngine, float gainDB)
{
return ma_engine_set_volume(pEngine, ma_volume_db_to_linear(gainDB));
}
MA_API float ma_engine_get_gain_db(ma_engine* pEngine)
{
return ma_volume_linear_to_db(ma_engine_get_volume(pEngine));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment