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

C++ snd_seq_drain_output函数代码示例

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

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



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

示例1: stopPlayer

void JVlibForm::on_System_PauseMidi_button_toggled(bool checked)
{
  unsigned int current_tick;
  if (checked) {
      stopPlayer();
      if (seqTimer->isActive()) {
            disconnect(JVlibForm::seqTimer, SIGNAL(timeout()), this, SLOT(tickDisplay()));
            seqTimer->stop();
      }
        snd_seq_get_queue_status(seq, queue, status);
	current_tick = snd_seq_queue_status_get_tick_time(status);
        snd_seq_stop_queue(seq,queue,NULL);
        snd_seq_drain_output(seq);
	stop_sound();
	disconnect_port();
        System_PauseMidi_button->setText("Resume");
  }
  else {
	connect_port();
        snd_seq_continue_queue(seq, queue, NULL);
        snd_seq_drain_output(seq);
        snd_seq_get_queue_status(seq, queue, status);
	current_tick = snd_seq_queue_status_get_tick_time(status);
        System_PauseMidi_button->setText("Pause");
        connect(JVlibForm::seqTimer, SIGNAL(timeout()), this, SLOT(tickDisplay()));
	startPlayer(current_tick);
        seqTimer->start(100);
  }
}   // end on_System_PauseMidi_button_toggled
开发者ID:RoberNoTson,项目名称:JV1080lib,代码行数:29,代码来源:midi_player.cpp


示例2: ALSADrv_MIDI_SetTempo

void ALSADrv_MIDI_SetTempo(int tempo, int division)
{
    double tps;
    snd_seq_queue_tempo_t * t;
    int result;

    if (queueRunning) {
        snd_seq_stop_queue(seq, seq_queue, NULL);
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }

    snd_seq_queue_tempo_alloca(&t);
    snd_seq_queue_tempo_set_tempo(t, 60000000 / tempo);
    snd_seq_queue_tempo_set_ppq(t, division);
    snd_seq_set_queue_tempo(seq, seq_queue, t);

    tps = ( (double) tempo * (double) division ) / 60.0;
    threadQueueTicks = (int) ceil(tps / (double) THREAD_QUEUE_INTERVAL);

    if (queueRunning) {
        snd_seq_start_queue(seq, seq_queue, NULL);
        while ((result = snd_seq_drain_output(seq)) > 0) ;
        if (result < 0) {
            fprintf(stderr, "ALSA could not drain output: err %d\n", result);
        }
    }
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:30,代码来源:driver_alsa.c


示例3: snd_seq_ev_clear

void JVlibForm::on_System_MIDI_progressBar_sliderReleased() {
    if (!System_PauseMidi_button->isChecked()) return;
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_direct(&ev);
    snd_seq_get_queue_status(seq, queue, status);
    // reset queue position
    snd_seq_ev_is_tick(&ev);
    snd_seq_ev_set_queue_pos_tick(&ev, queue, 0);
    snd_seq_event_output(seq, &ev);
    snd_seq_drain_output(seq);
    // scan the event queue for the closest tick >= 'x'
    int y = 0;
    for (std::vector<event>::iterator Event=all_events.begin(); Event!=all_events.end(); ++Event)  {
        if (static_cast<int>(Event->tick) >= System_MIDI_progressBar->sliderPosition()) {
            ev.time.tick = Event->tick;
	    event_num = y;
            break;
        }
        y++;
    }
    ev.dest.client = SND_SEQ_CLIENT_SYSTEM;
    ev.dest.port = SND_SEQ_PORT_SYSTEM_TIMER;
    snd_seq_ev_set_queue_pos_tick(&ev, queue, ev.time.tick);
    snd_seq_event_output(seq, &ev);
    snd_seq_drain_output(seq);
    snd_seq_real_time_t *new_time = new snd_seq_real_time_t;
    double x = static_cast<double>(ev.time.tick)/all_events.back().tick;
    new_time->tv_sec = (x*song_length_seconds);
    new_time->tv_nsec = 0;
    snd_seq_ev_set_queue_pos_real(&ev, queue, new_time);
    MIDI_time_display->setText(QString::number(static_cast<int>(new_time->tv_sec)/60).rightJustified(2,'0')+
      ":"+QString::number(static_cast<int>(new_time->tv_sec)%60).rightJustified(2,'0'));
    if (System_PauseMidi_button->isChecked()) return;
}	// end on_System_MIDI_progressBar_sliderReleased
开发者ID:RoberNoTson,项目名称:JV1080lib,代码行数:35,代码来源:midi_player.cpp


示例4: Q_ASSERT

void MIDIDevice::feedBack(t_input_channel channel, t_input_value value)
{
	/* MIDI devices can have only 128 notes or controllers */
	if (channel < 128)
	{
		snd_seq_event_t ev;
		MIDIInput* plugin;

		plugin = static_cast<MIDIInput*> (parent());
		Q_ASSERT(plugin != NULL);
		Q_ASSERT(plugin->alsa() != NULL);
		Q_ASSERT(m_address != NULL);

		/* Setup an event structure */
		snd_seq_ev_clear(&ev);
		snd_seq_ev_set_dest(&ev, m_address->client, m_address->port);
		snd_seq_ev_set_subs(&ev);
		snd_seq_ev_set_direct(&ev);

		/* Send control change, channel 1 (0) */
		snd_seq_ev_set_controller(&ev, 0, channel, value >> 1);
		snd_seq_event_output(plugin->alsa(), &ev);
		snd_seq_drain_output(plugin->alsa());

		/* Send note on/off, channel 1 (0) */
		if (value == 0)
			snd_seq_ev_set_noteoff(&ev, 0, channel, 0);
		else
			snd_seq_ev_set_noteon(&ev, 0, channel, value >> 1);
		snd_seq_event_output(plugin->alsa(), &ev);
		snd_seq_drain_output(plugin->alsa());
	}
开发者ID:speakman,项目名称:qlc,代码行数:32,代码来源:unix-mididevice.cpp


示例5: Q_ASSERT

void MIDIDevice::feedBack(t_input_channel channel, t_input_value value)
{
	/* MIDI devices can have only 128 notes or controllers */
	if (channel < 128)
	{
		snd_seq_event_t ev;
		MIDIInput* plugin;

		plugin = static_cast<MIDIInput*> (parent());
		Q_ASSERT(plugin != NULL);
		Q_ASSERT(plugin->alsa() != NULL);
		Q_ASSERT(m_address != NULL);

		/* Setup an event structure */
		snd_seq_ev_clear(&ev);
		snd_seq_ev_set_dest(&ev, m_address->client, m_address->port);
		snd_seq_ev_set_subs(&ev);
		snd_seq_ev_set_direct(&ev);

		char scaled = static_cast <char> (SCALE(double(value),
							double(0),
							double(KInputValueMax),
							double(0),
							double(127)));

		if (m_mode == ControlChange)
		{
			/* Send control change */
			snd_seq_ev_set_controller(&ev, midiChannel(),
						  channel, scaled);
			snd_seq_event_output(plugin->alsa(), &ev);
			snd_seq_drain_output(plugin->alsa());
		}
		else
		{
			/* Send note on/off */
			if (value == 0)
			{
				snd_seq_ev_set_noteoff(&ev, midiChannel(),
							channel, scaled);
			}
			else
			{
				snd_seq_ev_set_noteon(&ev, midiChannel(),
							channel, scaled);
			}

			snd_seq_event_output(plugin->alsa(), &ev);
			snd_seq_drain_output(plugin->alsa());
		}
	}
}
开发者ID:speakman,项目名称:qlc,代码行数:52,代码来源:mididevice.cpp


示例6: sendMessageNow

    void sendMessageNow (const MidiMessage& message)
    {
        if (message.getRawDataSize() > maxEventSize)
        {
            maxEventSize = message.getRawDataSize();
            snd_midi_event_free (midiParser);
            snd_midi_event_new (maxEventSize, &midiParser);
        }

        snd_seq_event_t event;
        snd_seq_ev_clear (&event);

        snd_midi_event_encode (midiParser,
                               message.getRawData(),
                               message.getRawDataSize(),
                               &event);

        snd_midi_event_reset_encode (midiParser);

        snd_seq_ev_set_source (&event, 0);
        snd_seq_ev_set_subs (&event);
        snd_seq_ev_set_direct (&event);

        snd_seq_event_output (seqHandle, &event);
        snd_seq_drain_output (seqHandle);
    }
开发者ID:GuillaumeLeNost,项目名称:ConvolutionFilter,代码行数:26,代码来源:juce_linux_Midi.cpp


示例7: lp2midi

void* lp2midi(void* nothing)
{
    printf("waiting for launchpad events\n");
	snd_seq_event_t event;
    
    while (1) {
		// wait for an event
		lp_receive(lp);

		// setup
		snd_seq_ev_clear(&event);
		snd_seq_ev_set_source(&event, midi_out);	// set the output port number
		snd_seq_ev_set_subs(&event);		// broadcast to subscribers
		
		// fill the event
		switch(lp->event[0]) {
		case NOTE:
			snd_seq_ev_set_noteon(&event, 0, lp->event[1], lp->event[2]);
			break;
		case CTRL:
			snd_seq_ev_set_controller(&event, 0, lp->event[1], lp->event[2]);
			break;
		}
		
		// send now
		snd_seq_ev_set_direct(&event);		
		snd_seq_event_output(midi_client, &event);
		snd_seq_drain_output(midi_client);
    }
}
开发者ID:bluszcz,项目名称:launchpad,代码行数:30,代码来源:lpmidi.c


示例8: enqueueMidiMessage

void MidiQueue::enqueueMidiSyncEvents(const int sourcePort, bool includeMidiStart, bool includeSongPositionReset, unsigned int numberOfMidiClocks)
{
	snd_seq_tick_time_t tick = 0;
	if (includeMidiStart)
	{
		enqueueMidiMessage(SND_SEQ_EVENT_START, sourcePort, tick);
		++tick;
	}

	if (includeSongPositionReset)
	{
		enqueueMidiMessage(SND_SEQ_EVENT_SONGPOS, sourcePort, tick);
		++tick;
	}

	for (unsigned int eventIndex = 0; eventIndex < numberOfMidiClocks; ++eventIndex)
	{
		enqueueMidiMessage(SND_SEQ_EVENT_CLOCK, sourcePort, tick);
		++tick;
	}
	int result = snd_seq_drain_output(_sequencer);
	if (result < 0)
	{
		std::cerr << "MidiQueue::enqueueMidiSyncEvents error:" << snd_strerror(result) << std::endl;
	}
}
开发者ID:dissabte,项目名称:smidi,代码行数:26,代码来源:MidiQueue.cpp


示例9: send_event

void send_event() {
  snd_seq_ev_set_direct(&ev);
  snd_seq_ev_set_source(&ev, my_port);
  snd_seq_ev_set_dest(&ev, seq_client, seq_port);
  snd_seq_event_output(seq_handle, &ev);
  snd_seq_drain_output(seq_handle);
}
开发者ID:abourget,项目名称:my.emacs.d,代码行数:7,代码来源:mymidikbd.c


示例10: ALSADrv_MIDI_HaltPlayback

void ALSADrv_MIDI_HaltPlayback(void)
{
    int result;
    void * ret;
    
    if (!threadRunning) {
        return;
    }

    threadQuit = 1;

    if (pthread_join(thread, &ret)) {
        fprintf(stderr, "ALSA pthread_join returned error\n");
    }

    if (queueRunning) {
        //snd_seq_stop_queue(seq, seq_queue, NULL);
    }

    while ((result = snd_seq_drain_output(seq)) > 0) ;
    if (result < 0) {
        fprintf(stderr, "ALSA could not drain output: err %d\n", result);
    }

    snd_seq_sync_output_queue(seq);

    //queueRunning = 0;
    threadRunning = 0;
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:29,代码来源:driver_alsa.c


示例11: 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


示例12: sendMessageNow

    void sendMessageNow (const MidiMessage& message)
    {
        if (message.getRawDataSize() > maxEventSize)
        {
            maxEventSize = message.getRawDataSize();
            snd_midi_event_free (midiParser);
            snd_midi_event_new (maxEventSize, &midiParser);
        }

        snd_seq_event_t event;
        snd_seq_ev_clear (&event);

        long numBytes = (long) message.getRawDataSize();
        const uint8* data = message.getRawData();

        while (numBytes > 0)
        {
            const long numSent = snd_midi_event_encode (midiParser, data, numBytes, &event);
            if (numSent <= 0)
                break;

            numBytes -= numSent;
            data += numSent;

            snd_seq_ev_set_source (&event, 0);
            snd_seq_ev_set_subs (&event);
            snd_seq_ev_set_direct (&event);

            snd_seq_event_output (seqHandle, &event);
        }

        snd_seq_drain_output (seqHandle);
        snd_midi_event_reset_encode (midiParser);
    }
开发者ID:Theadd,项目名称:WickedExile,代码行数:34,代码来源:juce_linux_Midi.cpp


示例13: note_off

static void
note_off(int note, real_t power) {

  snd_seq_event_t ev;

  if (debug>2) 
	fprintf(stderr, "midimatch: (%ld) note off: note:%-3d p:%.2f maxp:%0.2f\n", 
			absolute_time, note, power, act_freq[note]);
  

  act_freq[note] = 0.0f;
  if (midi_file != NULL )
	midi_write_note_event(0x80 | midi_channel, note, 100, midi_file);

  if ( use_sequencer ) {
	snd_seq_ev_clear(&ev);
	snd_seq_ev_set_source(&ev, 0);
	snd_seq_ev_set_subs(&ev);
	snd_seq_ev_set_direct(&ev);

	snd_seq_ev_set_noteoff(&ev, midi_channel, note, 100) ;
	
	snd_seq_event_output(midi_sequencer, &ev);
	snd_seq_drain_output(midi_sequencer);
  }
}
开发者ID:danilopantani,项目名称:dsp,代码行数:26,代码来源:midimatch.c


示例14: 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


示例15: note_on

static void 
note_on(int note, real_t power) {

  snd_seq_event_t ev;

  if (debug>1) 
	fprintf(stderr, "midimatch: (%ld) note on:  note:%-3d p:%.2f name:%[email protected]%d\n", 
			absolute_time, note, power, 
			midi_notename(note), midi_octave(note));
  else if (debug>0) 
	fprintf(stderr, ".");
 
  stats_note_ons ++;
 
  act_freq[note] = 1;
  if (midi_file != NULL ) {
	midi_write_note_event(0x90 | midi_channel, note, 100, midi_file);
  }

  if ( use_sequencer ) {
	snd_seq_ev_clear(&ev);
	snd_seq_ev_set_source(&ev, 0);
	snd_seq_ev_set_subs(&ev);
	snd_seq_ev_set_direct(&ev);
  
	snd_seq_ev_set_noteon(&ev, midi_channel, note, 100) ;
	
	snd_seq_event_output(midi_sequencer, &ev);
	snd_seq_drain_output(midi_sequencer);
  }
}
开发者ID:danilopantani,项目名称:dsp,代码行数:31,代码来源:midimatch.c


示例16: Q_ASSERT

void MIDIDevice::outputDMX(const QByteArray& universe)
{
    MIDIOut* plugin = static_cast<MIDIOut*> (parent());
    Q_ASSERT(plugin != NULL);
    Q_ASSERT(plugin->alsa() != NULL);
    Q_ASSERT(m_address != NULL);

    /* Setup a common event structure for all values */
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_dest(&ev, m_address->client, m_address->port);
    snd_seq_ev_set_subs(&ev);
    snd_seq_ev_set_direct(&ev);

    /* Since MIDI devices can have only 128 real channels, we don't
       attempt to write more than that */

    for (unsigned char channel = 0; channel < MAX_MIDI_DMX_CHANNELS;
            channel++)
    {
        /* Scale 0-255 to 0-127 */
        char scaled = DMX2MIDI(universe[channel]);

        /* Since MIDI is so slow, we only send values that are
           	   actually changed. */
        if (m_values[channel] == scaled)
            continue;

        /* Store the changed MIDI value */
        m_values[channel] = scaled;

        if (mode() == Note)
        {
            if (scaled == 0)
            {
                /* 0 is sent as a note off command */
                snd_seq_ev_set_noteoff(&ev, midiChannel(),
                                       channel, scaled);
            }
            else
            {
                /* 1-127 is sent as note on command */
                snd_seq_ev_set_noteon(&ev, midiChannel(),
                                      channel, scaled);
            }

            snd_seq_event_output(plugin->alsa(), &ev);
        }
        else
        {
            /* Control change */
            snd_seq_ev_set_controller(&ev, midiChannel(),
                                      channel, scaled);
            snd_seq_event_output_buffer(plugin->alsa(), &ev);
        }
    }

    /* Make sure that all values go to the MIDI endpoint */
    snd_seq_drain_output(plugin->alsa());
}
开发者ID:alexpaulzor,项目名称:qlc,代码行数:60,代码来源:mididevice.cpp


示例17: 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


示例18: locker

void
mastermidibus::flush ()
{
#ifdef HAVE_LIBASOUND
    automutex locker(m_mutex);
    snd_seq_drain_output(m_alsa_seq);
#endif
}
开发者ID:EQ4,项目名称:sequencer24,代码行数:8,代码来源:mastermidibus.cpp


示例19: locker

void
midibus::flush ()
{
#ifdef SEQ64_HAVE_LIBASOUND
    automutex locker(m_mutex);
    snd_seq_drain_output(m_seq);
#endif
}
开发者ID:ahlstromcj,项目名称:sequencer64,代码行数:8,代码来源:midibus.cpp


示例20: Q_ASSERT

void MIDIDevice::feedBack(quint32 channel, uchar value)
{
    MIDIInput* plugin = static_cast<MIDIInput*> (parent());
    Q_ASSERT(plugin != NULL);
    Q_ASSERT(plugin->alsa() != NULL);
    Q_ASSERT(m_address != NULL);

    uchar cmd = 0;
    uchar data1 = 0;
    uchar data2 = 0;
    bool d2v = false;

    if (QLCMIDIProtocol::feedbackToMidi(channel, value, midiChannel(), &cmd,
                                        &data1, &data2, &d2v) == true)
    {
        /* Setup an event structure */
        snd_seq_event_t ev;
        snd_seq_ev_clear(&ev);
        snd_seq_ev_set_dest(&ev, m_address->client, m_address->port);
        snd_seq_ev_set_subs(&ev);
        snd_seq_ev_set_direct(&ev);

        if (MIDI_CMD(cmd) == MIDI_NOTE_OFF)
        {
            /* Send data as note off command */
            snd_seq_ev_set_noteoff(&ev, midiChannel(), data1, data2);
            snd_seq_event_output(plugin->alsa(), &ev);
            snd_seq_drain_output(plugin->alsa());
        }
        else if (MIDI_CMD(cmd) == MIDI_NOTE_ON)
        {
            /* Send data as note on command */
            snd_seq_ev_set_noteon(&ev, midiChannel(), data1, data2);
            snd_seq_event_output(plugin->alsa(), &ev);
            snd_seq_drain_output(plugin->alsa());
        }
        else if (MIDI_CMD(cmd) == MIDI_CONTROL_CHANGE)
        {
            /* Send data as control change command */
            snd_seq_ev_set_controller(&ev, midiChannel(), data1, data2);
            snd_seq_event_output(plugin->alsa(), &ev);
            snd_seq_drain_output(plugin->alsa());
        }
    }
}
开发者ID:glocklueng,项目名称:qlc,代码行数:45,代码来源:mididevice.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ snd_seq_ev_clear函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_seq_close函数代码示例发布时间: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