Skip to content

Commit

Permalink
allow arbitrary sized output groups
Browse files Browse the repository at this point in the history
  • Loading branch information
sollapse authored Sep 4, 2016
1 parent 32c6b5d commit 3f2a456
Showing 1 changed file with 34 additions and 33 deletions.
67 changes: 34 additions & 33 deletions libpetrifoo/jackdriver.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ static int process(jack_nframes_t frames, void* arg)

for(int i = 0; i < MAX_JACK_CHANNELS; i++)
{
l_grp[i] = (jack_sample_t*)jack_port_get_buffer(l_grp_port[i], frames);
r_grp[i] = (jack_sample_t*)jack_port_get_buffer(r_grp_port[i], frames);
l_grp[i] = (jack_sample_t*)jack_port_get_buffer(l_grp_port[i], frames);
r_grp[i] = (jack_sample_t*)jack_port_get_buffer(r_grp_port[i], frames);
}

jack_position_t pos;
Expand Down Expand Up @@ -211,13 +211,14 @@ static int process(jack_nframes_t frames, void* arg)

for(j = 0; j < MAX_JACK_CHANNELS; j++)
{
for(i = 0; i < frames; i++)
{
l_grp[j][i] = grp_buffer[j][i * 2];
r_grp[j][i] = grp_buffer[j][i * 2 + 1];
}


for(i = 0; i < frames; i++)
{
l_grp[j][i] = grp_buffer[j][i * 2];
r_grp[j][i] = grp_buffer[j][i * 2 + 1];
}

}

for(i = 0; i < frames; i++)
{
Expand Down Expand Up @@ -260,21 +261,21 @@ static int buffer_size_change(jack_nframes_t b, void* arg)
/*alloc multichannel buffer*/
for(i = 0; i < MAX_JACK_CHANNELS; i++)
{
if ((grp_new[i] = malloc (sizeof (float) * periodsize * 2)) == NULL)
{
pf_error(PF_ERR_JACK_BUF_SIZE_CHANGE);
stop();
}
if ((grp_new[i] = malloc (sizeof (float) * periodsize * 2)) == NULL)
{
pf_error(PF_ERR_JACK_BUF_SIZE_CHANGE);
stop();
}

if(grp_buffer[i] != NULL)
free(grp_buffer[i]);
if(grp_buffer[i] != NULL)
free(grp_buffer[i]);

}
}

if(grp_buffer != NULL)
free(grp_buffer);
free(grp_buffer);

grp_buffer = grp_new;
grp_buffer = grp_new;

periodsize = b;

Expand Down Expand Up @@ -371,15 +372,15 @@ static int start(void)

for(i = 0; i < MAX_JACK_CHANNELS; i++)
{
snprintf(groupname, 16, "group %i_left", i + 1);
l_grp_port[i] = jack_port_register( client,
snprintf(groupname, 16, "group %i_left", i + 1);
l_grp_port[i] = jack_port_register( client,
groupname,
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
0);

snprintf(groupname, 16, "group %i_right", i + 1);
r_grp_port[i] = jack_port_register( client,
snprintf(groupname, 16, "group %i_right", i + 1);
r_grp_port[i] = jack_port_register( client,
groupname,
JACK_DEFAULT_AUDIO_TYPE,
JackPortIsOutput,
Expand Down Expand Up @@ -414,14 +415,14 @@ static int start(void)

for(i = 0; i < MAX_JACK_CHANNELS; i++)
{
if ((grp_buffer[i] = malloc (sizeof (float) * periodsize * 2)) == NULL)
{
pf_error(PF_ERR_JACK_BUF_ALLOC);
jack_client_close (client);
pthread_mutex_unlock (&running_mutex);
return -1;
}
if ((grp_buffer[i] = malloc (sizeof (float) * periodsize * 2)) == NULL)
{
pf_error(PF_ERR_JACK_BUF_ALLOC);
jack_client_close (client);
pthread_mutex_unlock (&running_mutex);
return -1;
}
}

mixer_flush();

Expand Down Expand Up @@ -489,10 +490,10 @@ static int stop(void)

for(i = 0; i < MAX_JACK_CHANNELS; i++)
{
if(grp_buffer[i] != NULL)
free(grp_buffer[i]);
}
free(grp_buffer);
if(grp_buffer[i] != NULL)
free(grp_buffer[i]);
}
free(grp_buffer);
}

running = 0;
Expand Down

3 comments on commit 3f2a456

@mxmilkiib
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello. I had used your fork for https://aur.archlinux.org/packages/petri-foo-git/ but it's giving a compile error atm, and there's no issue queue so I'm commenting here.

[100%] Linking C executable petri-foo
/usr/bin/ld: CMakeFiles/petri-foo.dir/bank-ops.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/bool_section.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/channelsection.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/envelopetab.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/float_section.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/gui.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/lfotab.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/log_display.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/mastersection.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/midisection.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/mod_section.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/mod_src_gui.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/paramtab.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/patchlist.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/patchsection.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/petri-foo.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/sample-editor.c.o:(.bss+0x8): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/sample-selector.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/sampletab.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/session.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
/usr/bin/ld: CMakeFiles/petri-foo.dir/voicetab.c.o:(.bss+0x0): multiple definition of `recent_manager'; CMakeFiles/petri-foo.dir/audio-settings.c.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
make[2]: *** [gui/CMakeFiles/petri-foo.dir/build.make:502: gui/petri-foo] Error 1
make[1]: *** [CMakeFiles/Makefile2:336: gui/CMakeFiles/petri-foo.dir/all] Error 2
make: *** [Makefile:149: all] Error 2

@sollapse
Copy link
Owner Author

@sollapse sollapse commented on 3f2a456 Aug 3, 2020 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mxmilkiib
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.