jack_default_audio_sample_t * frames_left;
jack_default_audio_sample_t * frames_right;
+ jack_default_audio_sample_t * prefader_frames_left;
+ jack_default_audio_sample_t * prefader_frames_right;
bool NaN_detected;
GSList *soloed_channels;
GSList *muted_channels;
bool system; /* system channel, without any associated UI */
+ bool prefader;
};
struct jack_mixer
for (i = start ; i < end ; i++)
{
- frame_left = channel_ptr->frames_left[i-start];
+ if (! output_mix_channel->prefader) {
+ frame_left = channel_ptr->frames_left[i-start];
+ } else {
+ frame_left = channel_ptr->prefader_frames_left[i-start];
+ }
if (frame_left == NAN)
break;
mix_channel->left_buffer_ptr[i] += frame_left;
if (mix_channel->stereo)
{
- frame_right = channel_ptr->frames_right[i-start];
+ if (! output_mix_channel->prefader) {
+ frame_right = channel_ptr->frames_right[i-start];
+ } else {
+ frame_right = channel_ptr->prefader_frames_right[i-start];
+ }
if (frame_right == NAN)
break;
/* process main mix channel */
for (i = start ; i < end ; i++)
{
+ if (! output_mix_channel->prefader) {
mix_channel->left_buffer_ptr[i] *= mix_channel->volume_left;
if (mix_channel->stereo)
{
mix_channel->right_buffer_ptr[i] *= mix_channel->volume_right;
}
+ }
frame_left = fabsf(mix_channel->left_buffer_ptr[i]);
if (mix_channel->peak_left < frame_left)
channel_ptr->frames_left = calloc(end-start, sizeof(jack_default_audio_sample_t));
channel_ptr->frames_right = calloc(end-start, sizeof(jack_default_audio_sample_t));
+ channel_ptr->prefader_frames_left = calloc(end-start, sizeof(jack_default_audio_sample_t));
+ channel_ptr->prefader_frames_right = calloc(end-start, sizeof(jack_default_audio_sample_t));
+
for (i = start ; i < end ; i++)
{
+ channel_ptr->prefader_frames_left[i-start] = channel_ptr->left_buffer_ptr[i];
+ if (channel_ptr->stereo)
+ channel_ptr->prefader_frames_right[i-start] = channel_ptr->right_buffer_ptr[i];
+
if (!FLOAT_EXISTS(channel_ptr->left_buffer_ptr[i]))
{
channel_ptr->NaN_detected = true;
channel_ptr = (struct channel*)node_ptr->data;
free(channel_ptr->frames_left);
free(channel_ptr->frames_right);
+ free(channel_ptr->prefader_frames_left);
+ free(channel_ptr->prefader_frames_right);
}
}
output_channel_ptr->soloed_channels = NULL;
output_channel_ptr->muted_channels = NULL;
output_channel_ptr->system = system;
+ output_channel_ptr->prefader = false;
return output_channel_ptr;
return false;
}
+void
+output_channel_set_prefader(
+ jack_mixer_output_channel_t output_channel,
+ bool pfl_value)
+{
+ struct output_channel *output_channel_ptr = output_channel;
+ output_channel_ptr->prefader = pfl_value;
+}
+
+bool
+output_channel_is_prefader(
+ jack_mixer_output_channel_t output_channel)
+{
+ struct output_channel *output_channel_ptr = output_channel;
+ return output_channel_ptr->prefader;
+}
+
jack_mixer_output_channel_t *output_channel;
} OutputChannelObject;
+static int
+OutputChannel_set_prefader(OutputChannelObject *self, PyObject *value, void *closure)
+{
+ if (value == Py_True) {
+ output_channel_set_prefader(self->output_channel, true);
+ } else {
+ output_channel_set_prefader(self->output_channel, false);
+ }
+ return 0;
+}
+
+static PyObject*
+OutputChannel_get_prefader(OutputChannelObject *self, void *closure)
+{
+ PyObject *result;
+
+ if (output_channel_is_prefader(self->output_channel)) {
+ result = Py_True;
+ } else {
+ result = Py_False;
+ }
+ Py_INCREF(result);
+ return result;
+}
+
+static PyGetSetDef OutputChannel_getseters[] = {
+ {"prefader",
+ (getter)OutputChannel_get_prefader, (setter)OutputChannel_set_prefader,
+ "prefader", NULL},
+ {NULL}
+};
+
static PyObject*
OutputChannel_remove(OutputChannelObject *self, PyObject *args)
{
0, /* tp_iternext */
output_channel_methods, /* tp_methods */
0, /* tp_members */
- 0, /* tp_getset */
+ OutputChannel_getseters, /* tp_getset */
&ChannelType, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */