• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_seq_close函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了snd_seq_close函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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,代码来源:midi2udpthread.cpp


示例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,代码来源:vsti.c


示例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,代码来源:mymidikbd.c


示例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,代码来源:ALSAMidiDriver.cpp


示例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,代码来源:juce_linux_Midi.cpp


示例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,代码来源:jackclient.c


示例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,代码来源:udp2midithread.cpp


示例8: jack_finish

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


示例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,代码来源:alsa.cpp


示例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,代码来源:midiout-unix.cpp


示例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,代码来源:midi2udpthread.cpp


示例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,代码来源:devicemanager.cpp


示例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,代码来源:midi_alsa_seq.c


示例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,代码来源:qxgeditMidiDevice.cpp


示例15: test_teardown

static void
test_teardown (void)
{
  ck_g_object_final_unref (registry);
  if (seq) {
    snd_seq_close (seq);
  }
}
开发者ID:Buzztrax,项目名称:buzztrax,代码行数:8,代码来源:e-aseq-discoverer.c


示例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,代码来源:midi_player.cpp


示例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,代码来源:devicemanager.cpp


示例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,代码来源:alsa.cpp


示例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,代码来源:aseq.c


示例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,代码来源:midiout-unix.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_seq_drain_output函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_printd函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap