multi dispositivo con envío independientes por capa. está sucio con
trozos sn usar y statics, pero funciona.
This commit is contained in:
parent
fc274179ad
commit
a935d4e619
5 changed files with 128 additions and 106 deletions
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue