Browse Source

[0.83.2] jack_set_buffer_size() "alpha test" version

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@513 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
joq 21 years ago
parent
commit
50c12df7e2
5 changed files with 109 additions and 4 deletions
  1. +1
    -1
      configure.in
  2. +1
    -0
      example-clients/.cvsignore
  3. +5
    -0
      example-clients/Makefile.am
  4. +96
    -0
      example-clients/bufsize.c
  5. +6
    -3
      jackd/engine.c

+ 1
- 1
configure.in View File

@@ -14,7 +14,7 @@ dnl changes are made
dnl ---
JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=83
JACK_MICRO_VERSION=1
JACK_MICRO_VERSION=2

dnl ---
dnl HOWTO: updating the jack protocal version


+ 1
- 0
example-clients/.cvsignore View File

@@ -10,6 +10,7 @@ jack_impulse_grabber
jack_monitor_client
jack_simple_client
jackrec
jack_bufsize
jack_showtime
jack_lsp
jack_metro


+ 5
- 0
example-clients/Makefile.am View File

@@ -33,6 +33,7 @@ bin_PROGRAMS = jack_load \
jack_disconnect \
jack_metro \
jack_showtime \
jack_bufsize \
jack_lsp \
$(JACKREC) \
$(JACK_TRANSPORT)
@@ -73,6 +74,10 @@ jack_showtime_SOURCES = showtime.c
jack_showtime_LDFLAGS = -lrt -ldl -lpthread
jack_showtime_LDADD = ../libjack/libjack.la

jack_bufsize_SOURCES = bufsize.c
jack_bufsize_LDFLAGS =
jack_bufsize_LDADD = ../libjack/libjack.la


if HAVE_SNDFILE
jackrec_SOURCES = capture_client.c ringbuffer.c ringbuffer.h


+ 96
- 0
example-clients/bufsize.c View File

@@ -0,0 +1,96 @@
/*
* bufsize.c -- change JACK buffer size.
*
* Copyright (C) 2003 Jack O'Quin.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <jack/jack.h>
#include <jack/transport.h>

char *package; /* program name */
jack_client_t *client;
jack_nframes_t nframes;

void jack_shutdown(void *arg)
{
fprintf(stderr, "JACK shut down, exiting ...\n");
exit(1);
}

void signal_handler(int sig)
{
jack_client_close(client);
fprintf(stderr, "signal received, exiting ...\n");
exit(0);
}

void parse_arguments(int argc, char *argv[])
{

/* basename $0 */
package = strrchr(argv[0], '/');
if (package == 0)
package = argv[0];
else
package++;

if (argc < 2) {
fprintf(stderr, "usage: %s <bufsize>\n", package);
exit(9);
}

nframes = strtoul(argv[1], NULL, 0);
if (errno == ERANGE) {
fprintf(stderr, "%s: invalid buffer size: %s\n",
package, argv[1]);
exit(2);
}
}

int main(int argc, char *argv[])
{
int rc;

parse_arguments(argc, argv);

/* become a JACK client */
if ((client = jack_client_new(package)) == 0) {
fprintf(stderr, "JACK server not running?\n");
exit(1);
}

signal(SIGQUIT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGHUP, signal_handler);
signal(SIGINT, signal_handler);

jack_on_shutdown(client, jack_shutdown, 0);

rc = jack_set_buffer_size(client, nframes);
if (rc)
fprintf(stderr, "jack_set_buffer_size() returns %d\n", rc);

jack_client_close(client);

return rc;
}

+ 6
- 3
jackd/engine.c View File

@@ -395,10 +395,13 @@ jack_resize_port_segment (jack_engine_t *engine,

/* update any existing output port offsets */
for (i = 0; i < engine->port_max; i++) {
if (engine->control->ports[i].flags|JackPortIsOutput &&
engine->control->ports[i].ptype_id == ptid) {
if (engine->control->ports[i].flags & JackPortIsOutput
&& engine->control->ports[i].ptype_id == ptid) {
bi = engine->internal_ports[i].buffer_info;
engine->control->ports[i].offset = bi->offset;
if (bi) {
engine->control->ports[i].offset =
bi->offset;
}
}
}
pthread_mutex_unlock (&pti->buffer_lock);


Loading…
Cancel
Save