コード例 #1
0
ファイル: ezjack.c プロジェクト: iamgreaser/ezjack
void ezjack_close(ezjack_bundle_t *bun)
{
	int i;

	jack_deactivate(bun->client);

	for(i = 0; i < bun->portstack.incount; i++)
	{
		jack_ringbuffer_free(bun->portstack.inrb[i]);
		free(bun->portstack.inbuf[i]);
	}

	for(i = 0; i < bun->portstack.outcount; i++)
	{
		jack_ringbuffer_free(bun->portstack.outrb[i]);
		free(bun->portstack.outbuf[i]);
	}

	if(bun->fbuf != NULL)
		free(bun->fbuf);

	jack_client_close(bun->client);

	free(bun);
}
コード例 #2
0
//================================================================
void osc_error_handler(int num, const char *msg, const char *path)
{
	if(close_on_incomp==1 && shutdown_in_progress==0)
	{
		fprintf(stderr,"/!\\ liblo server error %d: %s %s\n", num, path, msg);

		fprintf(stderr,"telling sender to pause.\n");

		//lo_address loa=lo_address_new(sender_host,sender_port);
		lo_address loa=lo_address_new_with_proto(lo_proto, sender_host,sender_port);

		lo_message msg=lo_message_new();
		lo_send_message(loa, "/pause", msg);
		lo_message_free(msg);

		io_quit("incompatible_jack_settings");

		fprintf(stderr,"cleaning up...");

		jack_client_close(client);
		//lo_server_thread_free(lo_st);
		jack_ringbuffer_free(rb);
		jack_ringbuffer_free(rb_helper);
		fprintf(stderr," done.\n");

		exit(1);
	}
	else if(shutdown_in_progress==0)
	{
		fprintf(stderr,"\r/!\\ liblo server error %d: %s %s\n", num, path, msg);
		//should be a param
	}
}//end osc_error_handler
コード例 #3
0
ファイル: input_client.c プロジェクト: adiknoth/tschack
void
jack_finish (void *arg)
{
	struct a2j* self = (struct a2j*) arg;
	void* thread_status;

        self->finishing = 1;
        
	a2j_debug("midi: delete");
	
	g_keep_alsa_walking = false;  /* tell alsa io thread to stop, whenever they wake up */
	/* do something that we need to do anyway and will wake the io thread, then join */
	snd_seq_disconnect_from (self->seq, self->port_id, SND_SEQ_CLIENT_SYSTEM, SND_SEQ_PORT_SYSTEM_ANNOUNCE);
	a2j_debug ("wait for ALSA io thread\n");
	pthread_join (self->alsa_io_thread, &thread_status);
	a2j_debug ("thread done\n");
	
	jack_ringbuffer_reset (self->port_add);
	
	a2j_stream_detach (&self->stream);
	
	snd_seq_close(self->seq);
	self->seq = NULL;
	
	a2j_stream_close (self);
	
	jack_ringbuffer_free(self->port_add);
	jack_ringbuffer_free(self->port_del);
	
	free (self);
}
コード例 #4
0
ファイル: RtMidiJack.cpp プロジェクト: svn2github/vmpk
RtMidiOutJack :: ~RtMidiOutJack()
{
  JackMidiData *data = static_cast<JackMidiData *> (apiData_);

  // Cleanup
  jack_client_close( data->client );
  jack_ringbuffer_free( data->buffSize );
  jack_ringbuffer_free( data->buffMessage );
}
コード例 #5
0
ファイル: alsa_rawmidi.c プロジェクト: basilnut/jack2
static
void stream_close(midi_stream_t *s)
{
    if (s->wake_pipe[0] != -1) {
        close(s->wake_pipe[0]);
        close(s->wake_pipe[1]);
    }
    if (s->jack.new_ports)
        jack_ringbuffer_free(s->jack.new_ports);
    if (s->midi.new_ports)
        jack_ringbuffer_free(s->midi.new_ports);
}
コード例 #6
0
// Device termination method.
void qmidinetJackMidiDevice::close (void)
{
	if (m_pRecvThread) {
		if (m_pRecvThread->isRunning()) do {
			m_pRecvThread->setRunState(false);
		//	m_pRecvThread->terminate();
			m_pRecvThread->sync();
		} while (!m_pRecvThread->wait(100));
		delete m_pRecvThread;
		m_pRecvThread = NULL;
	}

	if (m_pJackClient)
		jack_deactivate(m_pJackClient);

	if (m_ppJackPortIn || m_ppJackPortOut) {
		for (int i = 0; i < m_nports; ++i) {
			if (m_ppJackPortIn && m_ppJackPortIn[i])
				jack_port_unregister(m_pJackClient, m_ppJackPortIn[i]);
			if (m_ppJackPortOut && m_ppJackPortOut[i])
				jack_port_unregister(m_pJackClient, m_ppJackPortOut[i]);
		}
		if (m_ppJackPortIn)
			delete [] m_ppJackPortIn;
		if (m_ppJackPortOut)
			delete [] m_ppJackPortOut;
		m_ppJackPortIn = NULL;
		m_ppJackPortOut = NULL;
	}

	if (m_pJackClient) {
		jack_client_close(m_pJackClient);
		m_pJackClient = NULL;
	}

	if (m_pJackBufferIn) {
		jack_ringbuffer_free(m_pJackBufferIn);
		m_pJackBufferIn = NULL;
	}

	if (m_pJackBufferOut) {
		jack_ringbuffer_free(m_pJackBufferOut);
		m_pJackBufferOut = NULL;
	}

	if (m_pQueueIn) {
		delete m_pQueueIn;
		m_pQueueIn = NULL;
	}

	m_nports = 0;
}
コード例 #7
0
ファイル: jack.c プロジェクト: Alexandre-Garcia/RetroArch
static void ja_free(void *data)
{
   int i;
   jack_t *jd = (jack_t*)data;

   jd->shutdown = true;

   if (jd->client != NULL)
   {
      jack_deactivate(jd->client);
      jack_client_close(jd->client);
   }

   for (i = 0; i < 2; i++)
      if (jd->buffer[i] != NULL)
         jack_ringbuffer_free(jd->buffer[i]);

#ifdef HAVE_THREADS
   if (jd->cond_lock)
      slock_free(jd->cond_lock);
   if (jd->cond)
      scond_free(jd->cond);
#endif
   free(jd);
}
コード例 #8
0
static int deinit_ringbuffers()
{
  int b,c;

  for(b=0; b<2; b++) {
    if (ringbuffers[b]) {
      for(c=0;c<2;c++) {
        if (ringbuffers[b]->buffer[c]) {
          jack_ringbuffer_free(ringbuffers[b]->buffer[c]);
        }
      }

      if (munlock(ringbuffers[b], sizeof(rotter_ringbuffer_t))) {
        rotter_error("Failed to unlock ringbuffer %c from physical memory.", ringbuffers[b]->label);
      }

      if (ringbuffers[b]->file_handle) {
        rotter_close_file(ringbuffers[b]);
        ringbuffers[b]->file_handle = NULL;
      }

      free(ringbuffers[b]);
    }
  }

  return 0;
}
コード例 #9
0
ファイル: jack_listener.c プロジェクト: GerryKurz/Open-AVB
void shutdown_all(int sig)
{
	fprintf(stdout,"Leaving...\n");

	if (0 != talker) {
		send_process('L'); /** send leave */
	}

	send_process('M'); /** mrp disconnect */
	close(control_socket);

	if (NULL != handle) {
		pcap_breakloop(handle);
		pcap_close(handle);
	}

#ifdef LIBSND
	if (NULL != snd_file) {
		sf_write_sync(snd_file);
		sf_close(snd_file);
	}
#endif

	if (NULL != client) {
		fprintf(stdout, "jack\n");
		jack_client_close(client);
		jack_ringbuffer_free(ringbuffer);
	}

	exit(0);
}
コード例 #10
0
ファイル: JackDspSource.cpp プロジェクト: bryangrim/darkice
/*------------------------------------------------------------------------------
 *  Close the audio source
 *----------------------------------------------------------------------------*/
void
JackDspSource :: close ( void )                  throw ( Exception )
{
    unsigned int i;

    if ( !isOpen() ) {
        return;
    }

    for(i = 0; i < getChannel(); i++) {
        // Close the port for channel
        if ( ports[i] ) {
            jack_port_unregister( client, ports[i] );
            ports[i] = NULL;
        }
        
        // Free up the ring buffer for channel
        if ( rb[i] ) {
            jack_ringbuffer_free( rb[i] );
            rb[i] = NULL;
        }
    }

    /* Leave the jack graph */
    if (client) {
        jack_client_close(client);
        client = NULL;
    }

}
コード例 #11
0
ファイル: jackio.c プロジェクト: UIKit0/calfbox
void cbox_jackio_destroy(struct cbox_io_impl *impl)
{
    struct cbox_jack_io_impl *jii = (struct cbox_jack_io_impl *)impl;
    struct cbox_io *io = impl->pio;
    if (jii->client)
    {
        if (jii->error_str)
        {
            g_free(jii->error_str);
            jii->error_str = NULL;
        }
        else
        {
            for (int i = 0; i < io->io_env.input_count; i++)
                jack_port_unregister(jii->client, jii->inputs[i]);
            free(jii->inputs);
            for (int i = 0; i < io->io_env.output_count; i++)
                jack_port_unregister(jii->client, jii->outputs[i]);
            free(jii->outputs);
            if (jii->midi)
                jack_port_unregister(jii->client, jii->midi);
        }
        if (jii->client_name)
        {
            free(jii->client_name);
            jii->client_name = NULL;
        }
        cbox_io_destroy_all_midi_ports(io);
        
        jack_ringbuffer_free(jii->rb_autoconnect);
        jack_client_close(jii->client);
    }
    free(jii);
}
コード例 #12
0
ファイル: jack.c プロジェクト: Deslon/Supernova
static void free_jack_handle( jack_handle_t* handle )
{
	int i;

	if(handle->ports)
	{
		if(handle->client)
		for(i=0; i<handle->channels; i++)
		{
			/* Close the port for channel*/
			if(handle->ports[i])
				jack_port_unregister(handle->client, handle->ports[i]);
		}
		free(handle->ports);
	}
	if(handle->ports_buf)
		free(handle->ports_buf);
	/* Free up the ring buffer for channel*/
	if(handle->rb)
		jack_ringbuffer_free(handle->rb);
	if (handle->client)
		jack_client_close(handle->client);
	if (handle->procbuf)
		free(handle->procbuf);
	sem_destroy(&handle->sem);
	free(handle);
}
コード例 #13
0
ファイル: alsa_seqmidi.c プロジェクト: Andux/jack2
static
void alsa_seqmidi_delete(alsa_midi_t *m)
{
	alsa_seqmidi_t *self = (alsa_seqmidi_t*) m;

	debug_log("midi: delete");
	alsa_seqmidi_detach(m);

	stream_close(self, PORT_OUTPUT);
	stream_close(self, PORT_INPUT);

	jack_ringbuffer_free(self->port_add);
	jack_ringbuffer_free(self->port_del);
	sem_close(&self->port_sem);

	free(self);
}
コード例 #14
0
ファイル: JACK_RTaudiooutput.C プロジェクト: kennethlyn/zynqt
void JACKfinish(){
    jackfinish=1;
    jack_ringbuffer_free(rb);
    jack_client_close(jackclient);

    usleep(100000);
    delete(jackoutl);
    delete(jackoutr);
};
コード例 #15
0
ファイル: jacklayer.cpp プロジェクト: alexzah/ring-daemon
JackLayer::~JackLayer()
{
    stopStream();

    for (auto p : out_ports_)
        jack_port_unregister(playbackClient_, p);
    for (auto p : in_ports_)
        jack_port_unregister(captureClient_, p);

    if (jack_client_close(playbackClient_))
        RING_ERR("JACK client could not close");
    if (jack_client_close(captureClient_))
        RING_ERR("JACK client could not close");

    for (auto r : out_ringbuffers_)
        jack_ringbuffer_free(r);
    for (auto r : in_ringbuffers_)
        jack_ringbuffer_free(r);
}
コード例 #16
0
ファイル: ad_jack.c プロジェクト: Bangybug/sphinxbase
int32
ad_close(ad_rec_t * handle)
{
    free (handle->sample_buffer);
    jack_ringbuffer_free (handle->rbuffer); 	
    jack_client_close (handle->client);
    free(handle);

    return 0;
}
コード例 #17
0
ファイル: alsa_seqmidi.c プロジェクト: Andux/jack2
static
void stream_close(alsa_seqmidi_t *self, int dir)
{
	stream_t *str = &self->stream[dir];

	if (str->codec)
		snd_midi_event_free(str->codec);
	if (str->new_ports)
		jack_ringbuffer_free(str->new_ports);
}
コード例 #18
0
ファイル: input_client.c プロジェクト: adiknoth/tschack
static
void
a2j_stream_close (struct a2j * self)
{
	struct a2j_stream *str = &self->stream;

	if (str->codec)
		snd_midi_event_free (str->codec);
	if (str->new_ports)
		jack_ringbuffer_free (str->new_ports);
}
コード例 #19
0
ファイル: alsa_rawmidi.c プロジェクト: basilnut/jack2
static
void midi_port_close(const alsa_rawmidi_t *midi, midi_port_t *port)
{
    if (port->data_ring) {
        jack_ringbuffer_free(port->data_ring);
        port->data_ring = NULL;
    }
    if (port->event_ring) {
        jack_ringbuffer_free(port->event_ring);
        port->event_ring = NULL;
    }
    if (port->jack) {
        jack_port_unregister(midi->client, port->jack);
        port->jack = NULL;
    }
    if (port->rawmidi) {
        snd_rawmidi_close(port->rawmidi);
        port->rawmidi = NULL;
    }
}
コード例 #20
0
//================================================================
//ctrl+c etc
static void signal_handler(int sig)
{
	fprintf(stderr,"\nterminate signal %d received.\n",sig);

	io_quit("terminated");

	shutdown_in_progress=1;
	process_enabled=0;

	if(close_on_incomp==0)
	{
		fprintf(stderr,"telling sender to pause.\n");

		//lo_address loa=lo_address_new(sender_host,sender_port);
		lo_address loa=lo_address_new_with_proto(lo_proto, sender_host,sender_port);

		lo_message msg=lo_message_new();
		lo_send_message(loa, "/pause", msg);
		lo_message_free(msg);
	}

	fprintf(stderr,"cleaning up...");

	jack_deactivate(client);

	int index=0;
	while(ioPortArray[index]!=NULL && index<input_port_count)
	{
		jack_port_unregister(client,ioPortArray[index]);
		index++;
	}

	jack_client_close(client);
//      lo_server_thread_free(lo_st);
	jack_ringbuffer_free(rb);
	jack_ringbuffer_free(rb_helper);

	fprintf(stderr," done.\n");

	exit(0);
}//end signal_handler
コード例 #21
0
ファイル: jackcard.c プロジェクト: luge/foolject
void jack_card_destroy(JackCard *obj)
{
  if (obj->jack_running) jack_client_close (obj->client);
  snd_card_uninit(SND_CARD(obj));
  if (obj->read.buffer) {
    jack_ringbuffer_free(obj->read.buffer);
    obj->read.buffer = NULL;
  }
  if (obj->write.buffer) {
    jack_ringbuffer_free(obj->write.buffer);
    obj->write.buffer = NULL;
  }
  if (obj->read.phys_ports) {
    g_free(obj->read.phys_ports);
    obj->read.phys_ports = NULL;
  }
  if (obj->write.phys_ports) {
    g_free(obj->write.phys_ports);
    obj->write.phys_ports = NULL;
  }
}
コード例 #22
0
ファイル: AudioPlayer.cpp プロジェクト: 87maxi/oom
void AudioPlayer::stopClient()
{
	if(m_client)
	{
		jack_client_close (m_client) ;
		jack_ringbuffer_free (ringbuf) ;
		free (outs) ;
		free (output_port) ;
		m_client = 0;
		emit readyForPlay();
	}
}
コード例 #23
0
ファイル: alsa_seqmidi.c プロジェクト: Andux/jack2
static
void port_free(alsa_seqmidi_t *self, port_t *port)
{
	//snd_seq_disconnect_from(self->seq, self->port_id, port->remote.client, port->remote.port);
	//snd_seq_disconnect_to(self->seq, self->port_id, port->remote.client, port->remote.port);
	if (port->early_events)
		jack_ringbuffer_free(port->early_events);
	if (port->jack_port)
		jack_port_unregister(self->jack, port->jack_port);
	info_log("port deleted: %s", port->name);

	free(port);
}
コード例 #24
0
ファイル: ad_jack.c プロジェクト: AtDinesh/Jaf_pose_est
int32
ad_close(ad_rec_t * handle)
{
    free (handle->sample_buffer);
#ifdef HAVE_SAMPLERATE_H
    free (handle->resample_buffer);
#endif
    jack_ringbuffer_free (handle->rbuffer); 	
    jack_client_close (handle->client);
    free(handle);

    return 0;
}
コード例 #25
0
ファイル: alsa.c プロジェクト: pmyadlowsky/qmx
static void close_card(ALSA_CARD *card) {
	dev_stop(card);
	if (card->handle != NULL) {
		snd_pcm_hw_params_free(card->hparams);
		snd_pcm_close(card->handle);
		card->handle = NULL;
		}
	if (card->ringbuf != NULL) jack_ringbuffer_free(card->ringbuf);
	shutdown_source(&card->base);
	log_msg("ALSA: close card %s '%s'\n", card->device, card->name);
	free(card->device);
	free(card->name);
	free(card);
	return;
	}
コード例 #26
0
ファイル: port.c プロジェクト: Llefjord/jack1
void
a2j_port_free (struct a2j_port * port)
{
	// snd_seq_disconnect_from (driver->seq, driver->port_id, port->remote.client, port->remote.port);
	// snd_seq_disconnect_to (driver->seq, driver->port_id, port->remote.client, port->remote.port);

	if (port->inbound_events) {
		jack_ringbuffer_free (port->inbound_events);
	}

	if (port->jack_port != JACK_INVALID_PORT && !port->driver_ptr->finishing) {
		jack_port_unregister (port->driver_ptr->jack_client, port->jack_port);
	}

	free (port);
}
コード例 #27
0
ファイル: Disk_Stream.C プロジェクト: elthariel/non-daw
Disk_Stream::~Disk_Stream ( )
{
    /* it isn't safe to do all this with the RT thread running */
    engine->lock();

    shutdown();

     _track = NULL;

    sem_destroy( &_blocks );

    for ( int i = channels(); i--; )
        jack_ringbuffer_free( _rb[ i ] );

    engine->unlock();
}
コード例 #28
0
ファイル: jack.c プロジェクト: BG2BKK/cmus
/* init or resize buffers if needed */
static int op_jack_buffer_init(jack_nframes_t samples, void *arg)
{
	if (buffer_size > samples * BUFFER_MULTIPLYER) {
		/* we just don't shrink buffers, since this could result
		 * in gaps and they won't get that big anyway
		 */
		return 0;
	}

	buffer_size = samples * BUFFER_MULTIPLYER;
	if (buffer_size < BUFFER_SIZE_MIN) {
		buffer_size = BUFFER_SIZE_MIN;
	}
	d_print("new buffer size %zu\n", buffer_size);

	char *tmp = xmalloc(buffer_size);

	for (int i = 0; i < CHANNELS; i++) {
		jack_ringbuffer_t *new_buffer = jack_ringbuffer_create(buffer_size);

		if (!new_buffer) {
			d_print("ringbuffer alloc failed\n");
			free(tmp);
			fail = 1;
			op_jack_exit();
			return 1;
		}
		if (ringbuffer[i] != NULL) {
			size_t length = jack_ringbuffer_read_space(ringbuffer[i]);

			/* actualy this could both read/write less than length.
			 * In that case, which should not happen[TM], there will
			 * be a gap in playback.
			 */
			jack_ringbuffer_read(ringbuffer[i], tmp, length);
			jack_ringbuffer_write(new_buffer, tmp, length);

			jack_ringbuffer_free(ringbuffer[i]);
		}

		ringbuffer[i] = new_buffer;
	}

	free(tmp);
	return 0;
}
コード例 #29
0
ファイル: stream.c プロジェクト: pmyadlowsky/qmx
void close_stream(STREAM_HDR *stream) {
	stream->streaming = 0;
	if (stream->shout != NULL) {
		shout_close(stream->shout);
		stream->shout = NULL;
		}
	if (stream->shoutbuf != NULL) {
		free(stream->shoutbuf);
		stream->shoutbuf = NULL;
		stream->shoutbuf_size = 0;
		}
	if (stream->ringbuf != NULL) {
		jack_ringbuffer_free(stream->ringbuf);
		stream->ringbuf = NULL;
		}
	return;
	}
コード例 #30
0
ファイル: Disk_Stream.C プロジェクト: harryhaaren/non
Disk_Stream::~Disk_Stream ( )
{
    /* it isn't safe to do all this with the RT thread running */

//    timeline->wrlock();

     _track = NULL;

    sem_destroy( &_blocks );

    for ( int i = channels(); i--; )
    {
        jack_ringbuffer_free( _rb[ i ] );
        _rb[i] = 0;
    }

//    timeline->unlock();
}