您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ snd_seq_close函数代码示例

51自学网 2021-06-03 08:02:37
  C++
这篇教程C++ snd_seq_close函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中snd_seq_close函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_seq_close函数的具体用法?C++ snd_seq_close怎么用?C++ snd_seq_close使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了snd_seq_close函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: printf

bool Midi2UdpThread::initSeq(){	if(snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_INPUT, 0) < 0) {    	printf("midi2udp: Error opening ALSA sequencer./n");    	return false;  	}		snd_seq_set_client_name(seq_handle, "DSMIDIWIFI MIDI2UDP");		char portname[64] = "DSMIDIWIFI MIDI2UDP IN";		int res = midi_in_port = snd_seq_create_simple_port(seq_handle, portname, SND_SEQ_PORT_CAP_WRITE|SND_SEQ_PORT_CAP_SUBS_WRITE,              SND_SEQ_PORT_TYPE_APPLICATION);		if(res < 0) {		printf("midi2udp: Error creating MIDI port!/n");				snd_seq_close(seq_handle);		return false;	}	        res = snd_midi_event_new(MAX_MIDI_MESSAGE_LENGTH, &eventparser);	if(res != 0) {		printf("midi2udp: Error making midi event parser!/n");				snd_seq_close(seq_handle);		return false;	}	snd_midi_event_init(eventparser);		midi_event = (snd_seq_event_t*)malloc(sizeof(snd_seq_event_t));		return true;}
开发者ID:0xtob,项目名称:dsmi,代码行数:34,


示例2: stop_midireceiver

void stop_midireceiver (JackVST *jvst){	int err; 	snd_seq_event_t event;	snd_seq_t *seq2 = create_sequencer ("jfstquit", true);		jvst->midiquit = 1;		snd_seq_connect_to (seq2, 0, snd_seq_client_id (jvst->seq),0);	snd_seq_ev_clear      (&event);	snd_seq_ev_set_direct (&event);	snd_seq_ev_set_subs   (&event);	snd_seq_ev_set_source (&event, 0);	snd_seq_ev_set_controller (&event,1,0x80,50);		if ((err = snd_seq_event_output (seq2, &event)) < 0) {		fst_error ("cannot send stop event to midi thread: %s/n",			   snd_strerror (err));	}	snd_seq_drain_output (seq2);	snd_seq_close (seq2);	pthread_join (jvst->midi_thread,NULL);	snd_seq_close (jvst->seq);}
开发者ID:davidhalter-archive,项目名称:ardour,代码行数:25,


示例3: seq_open

int seq_open() {  unsigned int caps;  if (!seq_opened) {    /* sequencer opening */    if (snd_seq_open(&seq_handle, "hw", SND_SEQ_OPEN_OUTPUT, 0)) {      fprintf(stderr, "Error opening ALSA sequencer./n");      return(-1);    }    /* our client id */    my_client = snd_seq_client_id(seq_handle);    /* set client info */    snd_seq_set_client_name(seq_handle, DEFAULT_NAME);    /* create port */    caps = SND_SEQ_PORT_CAP_READ;    if (seq_client == SND_SEQ_ADDRESS_SUBSCRIBERS)      caps |= SND_SEQ_PORT_CAP_SUBS_READ;    my_port = snd_seq_create_simple_port(seq_handle, DEFAULT_NAME, caps,SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION);    if (my_port < 0) {      fprintf(stderr, "can't create port/n");      snd_seq_close(seq_handle);      return 0;    }    /* subscribe to MIDI port */    if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) {      if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) {        fprintf(stderr, "can't subscribe to MIDI port (%d:%d)/n", seq_client, seq_port);        snd_seq_close(seq_handle);        return 0;      }    }  }  seq_opened = 1;  return 1;}
开发者ID:abourget,项目名称:my.emacs.d,代码行数:34,


示例4: getConfigSetting

int ALSAMidiDriver::open() {	std::string arg;	unsigned int caps;	if (isOpen)		return -1;	arg = getConfigSetting("alsa_port", ALSA_PORT);	if (parse_addr(arg, &seq_client, &seq_port) < 0) {		perr << "ALSAMidiDriver: Invalid port: " << arg << std::endl;		return -1;	}		if (my_snd_seq_open(&seq_handle)) {		perr << "ALSAMidiDriver: Can't open sequencer" << std::endl;		return -1;	}	isOpen = true;		my_client = snd_seq_client_id(seq_handle);	snd_seq_set_client_name(seq_handle, "PENTAGRAM");	snd_seq_set_client_group(seq_handle, "input");		caps = SND_SEQ_PORT_CAP_READ;	if (seq_client == SND_SEQ_ADDRESS_SUBSCRIBERS)		caps = ~SND_SEQ_PORT_CAP_SUBS_READ;	my_port =		snd_seq_create_simple_port(seq_handle, "PENTAGRAM", caps,								   SND_SEQ_PORT_TYPE_MIDI_GENERIC | SND_SEQ_PORT_TYPE_APPLICATION);	if (my_port < 0) {		snd_seq_close(seq_handle);		isOpen = false;		perr << "ALSAMidiDriver: Can't create port" << std::endl;		return -1;	}	if (seq_client != SND_SEQ_ADDRESS_SUBSCRIBERS) {		/* subscribe to MIDI port */		if (snd_seq_connect_to(seq_handle, my_port, seq_client, seq_port) < 0) {			snd_seq_close(seq_handle);			isOpen = false;			perr << "ALSAMidiDriver: "				 << "Can't subscribe to MIDI port (" << seq_client				 << ":" << seq_port << ")" << std::endl;			return -1;		}	}	pout << "ALSA client initialised [" << seq_client << ":"		 << seq_port << "]" << std::endl;	return 0;}
开发者ID:CalvinRodo,项目名称:exult,代码行数:55,


示例5: createDevice

static snd_seq_t* createDevice (const bool forInput,                                const String& deviceNameToOpen){    snd_seq_t* seqHandle = 0;    if (snd_seq_open (&seqHandle, "default", forInput ? SND_SEQ_OPEN_INPUT                                                      : SND_SEQ_OPEN_OUTPUT, 0) == 0)    {        snd_seq_set_client_name (seqHandle,                                 (const char*) (forInput ? (deviceNameToOpen + T(" Input"))                                                         : (deviceNameToOpen + T(" Output"))));        const int portId            = snd_seq_create_simple_port (seqHandle,                                          forInput ? "in"                                                   : "out",                                          forInput ? (SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE)                                                   : (SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ),                                          forInput ? SND_SEQ_PORT_TYPE_APPLICATION                                                   : SND_SEQ_PORT_TYPE_MIDI_GENERIC);        if (portId < 0)        {            snd_seq_close (seqHandle);            seqHandle = 0;        }    }    return seqHandle;}
开发者ID:alessandropetrolati,项目名称:juced,代码行数:30,


示例6: snd_seq_open

static snd_seq_t *create_alsa_seq(const char *client_name,bool isinput){  snd_seq_t * seq;  int err;    err = snd_seq_open(&seq, "default", SND_SEQ_OPEN_DUPLEX, 0);  if (err){    printf( "Could not open ALSA sequencer, aborting/n/n%s/n/n"	    "Make sure you have configure ALSA properly and that/n"	    "/proc/asound/seq/clients exists and contains relevant/n"	    "devices./n", snd_strerror (err));    return NULL;  }    snd_seq_set_client_name (seq, client_name);    err = snd_seq_create_simple_port (seq, isinput==true?"Input":"Output",                                    (isinput==true?SND_SEQ_PORT_CAP_WRITE:SND_SEQ_PORT_CAP_READ)|SND_SEQ_PORT_CAP_DUPLEX|                                    SND_SEQ_PORT_CAP_SUBS_READ|SND_SEQ_PORT_CAP_SUBS_WRITE,                                    SND_SEQ_PORT_TYPE_APPLICATION|SND_SEQ_PORT_TYPE_SPECIFIC);  if (err){    printf ( "Could not create ALSA port, aborting/n/n%s/n", snd_strerror (err));    snd_seq_close(seq);    return NULL;  }  return seq;}
开发者ID:kmatheussen,项目名称:vsti,代码行数:28,


示例7: snd_seq_close

void Udp2MidiThread::freeSeq(){	int res = snd_seq_close(seq_handle);	if( res < 0 ) {		printf("udp2midi: Error closing socket!/n");	}}
开发者ID:0xtob,项目名称:dsmi,代码行数:7,


示例8: jack_finish

voidjack_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);}
开发者ID:adiknoth,项目名称:tschack,代码行数:31,


示例9: snd_seq_client_info_alloca

AlsaDevices AlsaMusicPlugin::getAlsaDevices() const {	AlsaDevices devices;	snd_seq_t *seq_handle;	if (my_snd_seq_open(&seq_handle) < 0)		return devices; // can't open sequencer	snd_seq_client_info_t *cinfo;	snd_seq_client_info_alloca(&cinfo);	snd_seq_port_info_t *pinfo;	snd_seq_port_info_alloca(&pinfo);	snd_seq_client_info_set_client(cinfo, -1);	while (snd_seq_query_next_client(seq_handle, cinfo) >= 0) {		bool found_valid_port = false;		/* reset query info */		snd_seq_port_info_set_client(pinfo, snd_seq_client_info_get_client(cinfo));		snd_seq_port_info_set_port(pinfo, -1);		while (!found_valid_port && snd_seq_query_next_port(seq_handle, pinfo) >= 0) {			if (check_permission(pinfo)) {				found_valid_port = true;				const char *name = snd_seq_client_info_get_name(cinfo);				// TODO: Can we figure out the appropriate music type?				MusicType type = MT_GM;				int client = snd_seq_client_info_get_client(cinfo);				devices.push_back(AlsaDevice(name, type, client));			}		}	}	snd_seq_close(seq_handle);	return devices;}
开发者ID:Harrypoppins,项目名称:grim_mouse,代码行数:33,


示例10: snd_seq_close

void MIDIOut::initALSA(){	snd_seq_client_info_t* client = NULL;	/* Destroy the old handle */	if (m_alsa != NULL)		snd_seq_close(m_alsa);	m_alsa = NULL;	/* Destroy the plugin's own address */	if (m_address != NULL)		delete m_address;	m_address = NULL;	/* Open the sequencer interface */	if (snd_seq_open(&m_alsa, "default", SND_SEQ_OPEN_DUPLEX, 0) != 0)	{		qWarning() << "Unable to open ALSA interface!";		m_alsa = NULL;		return;	}	/* Set current client information */	snd_seq_client_info_alloca(&client);	snd_seq_set_client_name(m_alsa, name().toAscii());	snd_seq_get_client_info(m_alsa, client);	/* Create an application-level port */	m_address = new snd_seq_addr_t;	m_address->port = snd_seq_create_simple_port(m_alsa, "__QLC__output",		   	SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,			SND_SEQ_PORT_TYPE_MIDI_GENERIC);	m_address->client = snd_seq_client_info_get_client(client);}
开发者ID:speakman,项目名称:qlc,代码行数:34,


示例11: snd_seq_close

void Midi2UdpThread::freeSeq(){	int res = snd_seq_close(seq_handle);	if( res < 0 ) {		printf("midi2udp: Error closing socket!/n");	}}
开发者ID:0xtob,项目名称:dsmi,代码行数:7,


示例12: snd_seq_poll_descriptors_count

void DeviceManager::loop(){    struct pollfd *pfds;    int npfds;    int c, err;    npfds = snd_seq_poll_descriptors_count(handle, POLLIN);    D("npfds: %d", npfds);    pfds = (struct pollfd *)alloca(sizeof(*pfds) * npfds);    for (;;) {        snd_seq_poll_descriptors(handle, pfds, npfds, POLLIN);        if (poll(pfds, npfds, -1) < 0)            break;        do {            snd_seq_event_t *event;            err = snd_seq_event_input(handle, &event);            if (err < 0)                break;            if (event){                list[0]->processEvent(event);            }        } while (err > 0);        fflush(stdout);//        if (stop)//            break;    }    snd_seq_close(handle);}
开发者ID:mvonthron,项目名称:libAkaiMpd,代码行数:28,


示例13: del_aubio_alsa_seq_driver

/** del_aubio_alsa_seq_driver */int del_aubio_alsa_seq_driver(aubio_midi_driver_t* p){    aubio_alsa_seq_driver_t* dev;    dev = (aubio_alsa_seq_driver_t*) p;    if (dev == NULL) {        return AUBIO_OK;    }    dev->status = AUBIO_MIDI_DONE;    /* cancel the thread and wait for it before cleaning up */    if (dev->thread) {        if (pthread_cancel(dev->thread)) {            AUBIO_ERR( "Failed to cancel the midi thread");            return AUBIO_FAIL;        }        if (pthread_join(dev->thread, NULL)) {            AUBIO_ERR( "Failed to join the midi thread");            return AUBIO_FAIL;        }    }    if (dev->seq_port >= 0) {        snd_seq_delete_simple_port (dev->seq_handle, dev->seq_port);    }    if (dev->seq_handle) {        snd_seq_drain_output(dev->seq_handle);        snd_seq_close(dev->seq_handle);    }    AUBIO_FREE(dev);    return AUBIO_OK;}
开发者ID:BYVoid,项目名称:notes_extract,代码行数:33,


示例14: snd_seq_delete_simple_port

qxgeditMidiDevice::~qxgeditMidiDevice (void){	// Reset pseudo-singleton reference.	g_pMidiDevice = NULL;	// Last but not least, delete input thread...	if (m_pInputThread) {		// Try to terminate executive thread,		// but give it a bit of time to cleanup...		if (m_pInputThread->isRunning()) {			m_pInputThread->setRunState(false);		//	m_pInputThread->terminate();			m_pInputThread->wait();		}		delete m_pInputThread;		m_pInputThread = NULL;	}	if (m_pAlsaSeq) {		snd_seq_delete_simple_port(m_pAlsaSeq, m_iAlsaPort);		m_iAlsaPort   = -1;		snd_seq_close(m_pAlsaSeq);		m_iAlsaClient = -1;		m_pAlsaSeq    = NULL;	}}
开发者ID:rncbc,项目名称:qxgedit,代码行数:26,


示例15: test_teardown

static voidtest_teardown (void){  ck_g_object_final_unref (registry);  if (seq) {    snd_seq_close (seq);  }}
开发者ID:Buzztrax,项目名称:buzztrax,代码行数:8,


示例16: snd_seq_stop_queue

void JVlibForm::close_seq() {  if (!seq) return;  snd_seq_stop_queue(seq,queue,NULL);  snd_seq_drop_output(seq);  snd_seq_drain_output(seq);  snd_seq_close(seq);  seq = 0;}
开发者ID:RoberNoTson,项目名称:JV1080lib,代码行数:8,


示例17: snd_seq_close

DeviceManager::~DeviceManager(){    snd_seq_close(handle);    for(std::vector<Device *>::iterator it = list.begin(); it != list.end(); it++){        delete *it;    }    list.clear();}
开发者ID:mvonthron,项目名称:libAkaiMpd,代码行数:9,


示例18: snd_seq_close

void MidiDriver_ALSA::close() {	if (_isOpen) {		_isOpen = false;		MidiDriver_MPU401::close();		if (seq_handle)			snd_seq_close(seq_handle);	} else		warning("MidiDriver_ALSA: Closing the driver before opening it");}
开发者ID:Harrypoppins,项目名称:grim_mouse,代码行数:9,


示例19: free_aseqh

void free_aseqh(snd_seq_t *handle){  int err = 0;  err = snd_seq_close(handle);  if (0 != err)    output_error("problem while closing alsa seq handler/n%s/n",                 snd_strerror(err));}
开发者ID:supergilbert,项目名称:midilooper,代码行数:9,


示例20: while

MIDIOut::~MIDIOut(){	/* Delete all MIDI devices. */	while (m_devices.isEmpty() == false)		delete m_devices.takeFirst();	/* Close the ALSA sequencer interface */	snd_seq_close(m_alsa);	m_alsa = NULL;}
开发者ID:speakman,项目名称:qlc,代码行数:10,


示例21: clean_up

/**  * Get ready to die gracefully. */voidclean_up ( void ){	/* release the mouse */	ioctl( fd, EVIOCGRAB, 0 ); 	close( fd );	snd_seq_close( seq );}
开发者ID:original-male,项目名称:lsmi,代码行数:13,


示例22: midi_uninit

void midi_uninit() {	if (s_midi == NULL) return;	snd_midi_event_free(s_midiCoder);	snd_seq_port_subscribe_free(s_midiSubscription);	snd_seq_delete_port(s_midi, s_midiPort);	snd_seq_close(s_midi);	s_midi = NULL;}
开发者ID:damajor,项目名称:play-dune,代码行数:10,


示例23: midiCloseSeq

/************************************************************************** * 			midiCloseSeq				[internal] */static int midiCloseSeq(void){    if (--numOpenMidiSeq == 0) {	snd_seq_delete_simple_port(midiSeq, port_out);	snd_seq_delete_simple_port(midiSeq, port_in);	snd_seq_close(midiSeq);	midiSeq = NULL;    }    return 0;}
开发者ID:howard5888,项目名称:wineT,代码行数:13,


示例24: alsaseq_close

static PyObject *alsaseq_close(PyObject *self /* Not used */, PyObject *args){	if (!PyArg_ParseTuple(args, "" ))		return NULL;        snd_seq_close(seq_handle);	Py_INCREF(Py_None);	return Py_None;}
开发者ID:bgribble,项目名称:mfp,代码行数:11,


示例25: snd_seq_close

    MidiInputDeviceAlsa::~MidiInputDeviceAlsa() {        // free the midi ports (we can't let the base class do this,        // as the MidiInputPortAlsa destructors need access to        // hAlsaSeq)        for (std::map<int,MidiInputPort*>::iterator iter = Ports.begin(); iter != Ports.end() ; iter++) {            delete static_cast<MidiInputPortAlsa*>(iter->second);        }        Ports.clear();        snd_seq_close(hAlsaSeq);    }
开发者ID:svn2github,项目名称:linuxsampler,代码行数:11,


示例26: snd_midi_event_free

void AlsaSeqMidiInDriver::close(){  if (!this->is_open())    throw std::logic_error("Device not open");  if (m_impl->decoder)    snd_midi_event_free (m_impl->decoder);    snd_seq_close(m_impl->seq);  m_impl->seq=0;}
开发者ID:ChristianFrisson,项目名称:gephex,代码行数:11,


示例27: snd_seq_close

int bx_sound_linux_c::closemidioutput(){#if BX_HAVE_ALSASOUND  if ((use_alsa_seq) && (alsa_seq.handle != NULL)) {    snd_seq_close(alsa_seq.handle);    return BX_SOUNDLOW_OK;  }#endif  fclose(midi);  return BX_SOUNDLOW_OK;}
开发者ID:iver6,项目名称:BA,代码行数:12,


示例28: close_handle

static void close_handle(snd_seq_t *handle){    int rc;    rc = snd_seq_close( handle);    if (rc < 0) {	g_print( "error closing handle (%s)/n",  snd_strerror(rc));    }    return;} /* close_handle() */
开发者ID:elias-pschernig,项目名称:soundtracker,代码行数:12,


示例29: sys_alsa_close_midi

void sys_alsa_close_midi(){    alsa_nmidiin = alsa_nmidiout = 0;    if(midi_handle)      {        snd_seq_close(midi_handle);        if(midiev)          {            snd_midi_event_free(midiev);          }      }}
开发者ID:Angeldude,项目名称:pd,代码行数:12,


示例30: snd_rawmidi_virtual_close

static int snd_rawmidi_virtual_close(snd_rawmidi_t *rmidi){	snd_rawmidi_virtual_t *virt = rmidi->private_data;	virt->open--;	if (virt->open)		return 0;	snd_seq_close(virt->handle);	if (virt->midi_event)		snd_midi_event_free(virt->midi_event);	free(virt);	return 0;}
开发者ID:Boshin,项目名称:workspace,代码行数:12,



注:本文中的snd_seq_close函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ snd_seq_drain_output函数代码示例
C++ snd_printdd函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。