From a935d4e619144c338bd5ec10f73c82a656776dbc Mon Sep 17 00:00:00 2001 From: snt Date: Sun, 19 May 2024 01:36:23 +0200 Subject: [PATCH] =?UTF-8?q?multi=20dispositivo=20con=20env=C3=ADo=20indepe?= =?UTF-8?q?ndientes=20por=20capa.=20est=C3=A1=20sucio=20con=20trozos=20sn?= =?UTF-8?q?=20usar=20y=20statics,=20pero=20funciona.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/LibreMediaServer_Audio.hed | 190 ++++++++++++++++---------------- src/libremediaserver-audio.cpp | 2 +- src/ma_writer_node.c | 17 +-- src/miniaudioengine.cpp | 24 +++- src/miniaudioengine.h | 1 + 5 files changed, 128 insertions(+), 106 deletions(-) diff --git a/docs/LibreMediaServer_Audio.hed b/docs/LibreMediaServer_Audio.hed index 1598cab..90b0781 100644 --- a/docs/LibreMediaServer_Audio.hed +++ b/docs/LibreMediaServer_Audio.hed @@ -1,93 +1,99 @@ ް׆ˌĠ򝤫鿰맫͓Ԕ -ҊÅЁ䍡 -ӽ -͌وГ -䩴؍ - - -ǁ - -ήƵ -ꂨ⑯ɞɅ -ˆ -㨥 -פ - -Θב -˻ - -ūî -䈍 -п -¥߸ڋ -Ĩ© -勌㊈ -͹ -ˢ݈ -ɢƢ -񍒍Й -˟ - -ǔ -檵 -Ӡ̧׀ -ꗪㄮϞѝ -ᯠ쫶 -ϼȡ嵶 -ᄨڍ֟ - -ڱ -񔸼񣏎 -ڔ - - -֐ - -̽ɤ -甯؞τ - - - - - - -𣇒 -Ԇ - -䷩ -ߍ - - - - - - - - - - -܂ -쏎 -מ - - -Ӽ - - - - - - - - - - -͚ʝǓ - - - -ݽ - - - - +ҊÅЁͽ +Щܰ +Χ +쏎՚ +ڥ +з +򗹡 +֐ +ᬡ䨳͘ +۽Ӣ + +ԙ + +ا࠭ +Ϡɮ +򃡺쏎 +Ē + +ջо +󕐙ޗ + +Ѵد߯ +ںԻϩ +񖝋ޕ +㓜 +Ѹڱ +ܯԕ + +ĉ +ⷶ +šҔ +㰽 +С׃ +苩ܑ +ٿ뺻 +ڧӴ̧Ӈ +똫䅭̝ԛʂ +껺 +۾ + +Κ + + +Dž +ꬡ˞“ +̾ +虤刬Ⓨ̀ +㨳 + + + +҂ + + +鱤 + +ً + +ۄ +í + + + + + + + + +𓎍 +̀ + +Řϒ +݁׺ + +րɂÈ +񺥤 +ଛ + +ܕ + + + + + +쏒 + + +稳 + + + + + +ٕ + + + + diff --git a/src/libremediaserver-audio.cpp b/src/libremediaserver-audio.cpp index 2916007..76f711d 100644 --- a/src/libremediaserver-audio.cpp +++ b/src/libremediaserver-audio.cpp @@ -140,7 +140,7 @@ void libreMediaServerAudio::dmxInput(int layer, int channel, int value) m_played.append(m_ola->getValue(layer, DMX_FILE)); } #endif - } else if (channel >= HP_FREQ && channel <= HIGH_GAIN) { + } else if (channel >= HP_FREQ) { m_mae.filterParamChanged(layer, m_dmxSettings.at(layer).audioDevice, channel, value); #ifndef NOGUI if (m_ui) { diff --git a/src/ma_writer_node.c b/src/ma_writer_node.c index e05d38d..f58881d 100644 --- a/src/ma_writer_node.c +++ b/src/ma_writer_node.c @@ -18,16 +18,15 @@ static void ma_writer_node_process_pcm_frames(ma_node* pNode, const float** ppFr ma_writer_node* pWriteNode = (ma_writer_node*)pNode; MA_ASSERT(pWriteNode != NULL); - MA_ASSERT(ma_node_get_input_bus_count(&pWriteNode->baseNode) == 1); + MA_ASSERT(ma_node_get_input_bus_count(&pWriteNode->baseNode) == 2); if (*pFrameCountIn > 0) { void *pWriteBuffer = NULL; ma_pcm_rb_acquire_write(pWriteNode->pBuffer, pFrameCountIn, &pWriteBuffer); if (pWriteBuffer != NULL) { - ma_copy_pcm_frames(pWriteBuffer, ppFramesIn[0], *pFrameCountIn, ma_format_f32, pWriteNode->channels); + ma_copy_pcm_frames(pWriteBuffer, ppFramesIn[1], *pFrameCountIn, ma_format_f32, pWriteNode->channels); ma_pcm_rb_commit_write(pWriteNode->pBuffer, *pFrameCountIn); } - //ma_silence_pcm_frames(ppFramesOut[0], *pFrameCountOut, ma_format_f32, pWriteNode->channels); } //*pFrameCountOut = 0; ma_copy_pcm_frames(ppFramesOut[0], ppFramesIn[0], *pFrameCountOut, ma_format_f32, pWriteNode->channels); @@ -37,7 +36,7 @@ static ma_node_vtable g_ma_writer_node_vtable = { ma_writer_node_process_pcm_frames, NULL, - 1, + 2, 1, 0 // MA_NODE_FLAG_CONTINUOUS_PROCESSING @@ -48,6 +47,8 @@ MA_API ma_result ma_writer_node_init(ma_node_graph* pNodeGraph, const ma_writer_ { ma_result result; ma_node_config baseConfig; + ma_uint32 inputChannels[2]; // Equal in size to the number of input channels specified in the vtable. + ma_uint32 outputChannels[1]; if (pWriteNode == NULL || pConfig == NULL || pConfig->pBuffer == NULL \ || (pConfig->channels > MA_MAX_NODE_BUS_COUNT) ) { @@ -55,11 +56,13 @@ MA_API ma_result ma_writer_node_init(ma_node_graph* pNodeGraph, const ma_writer_ } MA_ZERO_OBJECT(pWriteNode); - + inputChannels[0] = pConfig->channels; + inputChannels[1] = pConfig->channels; + outputChannels[0] = pConfig->channels; baseConfig = pConfig->nodeConfig; baseConfig.vtable = &g_ma_writer_node_vtable; - baseConfig.pInputChannels = &pConfig->channels; - baseConfig.pOutputChannels = &pConfig->channels; + baseConfig.pInputChannels = inputChannels; + baseConfig.pOutputChannels = outputChannels; result = ma_node_init(pNodeGraph, &baseConfig, pAllocationCallbacks, &pWriteNode->baseNode); if (result != MA_SUCCESS) { diff --git a/src/miniaudioengine.cpp b/src/miniaudioengine.cpp index 914708d..33c7840 100644 --- a/src/miniaudioengine.cpp +++ b/src/miniaudioengine.cpp @@ -183,13 +183,13 @@ ma_result MiniAudioEngine::createFilterBank(int id, uint layer) cout << "ERROR " << result << ": Failed to attach high shelf filter node." << endl; return result; } - if (id == 0) { - //result = ma_node_attach_output_bus(&fb->output, 1, endpoint, 0); +if (id == 0) { + result = ma_node_attach_output_bus(&fb->output, 0, &m_sendToAux[id], 0); if (result != MA_SUCCESS) { cout << "ERROR " << result << ": Failed to attach output node to engine." << endl; return result; } - result = ma_node_attach_output_bus(&fb->output, 0, &m_sendToAux[id], 0); + result = ma_node_attach_output_bus(&fb->output, 1, &m_sendToAux[id], 1); if (result != MA_SUCCESS) { cout << "ERROR " << result << ": Failed to attach output node to aux send 1." << endl; return result; @@ -204,7 +204,7 @@ ma_result MiniAudioEngine::setNodeGraph(int id) { if (id == 0) { ma_node_graph *ng = ma_engine_get_node_graph(&m_engine[id]); - size_t sizeInFrames = SAMPLE_RATE / 10; // ma_get_bytes_per_frame(FORMAT, CHANNELS); + size_t sizeInFrames = SAMPLE_RATE; // ma_get_bytes_per_frame(FORMAT, CHANNELS); result = ma_pcm_rb_init(FORMAT, CHANNELS, sizeInFrames, NULL, NULL, &aux1Buffer); if (result != MA_SUCCESS) { printf("Failed to initialize ring buffer.\n"); @@ -623,8 +623,20 @@ ma_result MiniAudioEngine::filterParamChanged(int layer, int audioDevice, int ch cout << "ERROR " << result << ": Failed set gain high shelf filter node." << endl; return result; } - } - return (result); + } else if (channel == SEND1) { + ma_node_set_output_bus_volume(&fb->output, 0, pow((value / 255.0f), 2)); + if (result != MA_SUCCESS) { + cout << "ERROR " << result << ": Failed set Send 1 Volume." << endl; + return result; + } + } else if (channel == SEND2) { + ma_node_set_output_bus_volume(&fb->output, 1, pow((value / 255.0f), 2)); + if (result != MA_SUCCESS) { + cout << "ERROR " << result << ": Failed set Send 2 Volume." << endl; + } + return result; + } + return (result); } bool MiniAudioEngine::setBypass(int audioDevice, int layer, bool bypass) diff --git a/src/miniaudioengine.h b/src/miniaudioengine.h index d908c70..69147d3 100644 --- a/src/miniaudioengine.h +++ b/src/miniaudioengine.h @@ -7,6 +7,7 @@ #define MA_DEBUG_OUTPUT #define MA_DISABLE_PULSEAUDIO #define MA_DEBUG_OUTPUT +#define MA_LOG_LEVEL_DEBUG DEBUG #define MINIAUDIO_IMPLEMENTATION #include "miniaudio.h" #include "ma_writer_node.h"