当前位置: 首页>>代码示例>>C++>>正文


C++ snd_seq_ev_clear函数代码示例

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


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

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

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

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

示例4: Func_NoteOn

static void Func_NoteOn( int channel, int key, int velocity )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_noteon(&ev, channel, key, velocity);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

示例5: Func_PolyAftertouch

static void Func_PolyAftertouch( int channel, int key, int pressure )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_keypress(&ev, channel, key, pressure);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

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

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

示例8: Func_ProgramChange

static void Func_ProgramChange( int channel, int program )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_pgmchange(&ev, channel, program);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

示例9: Func_ControlChange

static void Func_ControlChange( int channel, int number, int value )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_controller(&ev, channel, number, value);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

示例10: fprintf

/*
 * Initialize a midi event from the context. The source and
 * destination addresses will be set from the information
 * stored in the context, which depends on the previous
 * connection calls. In addition the time and channel are set.
 * This should be called first before any of the following
 * functions.
 * 
 *  Arguments:
 *    ctxp      - Client application
 *    ep        - Event to init
 *    time      - Midi time
 *    devchan   - Midi channel
 */
void 
SeqContext::seq_midi_event_init(snd_seq_event_t *ep, 
        unsigned long time, int devchan)
{
	int  dev;

	/* our client index is encoded in upper bits of devchan	 */
	dev = devchan >> 4;

	/*
	 * If insufficient output devices have been registered, then we
	 * just scale the device back to fit in the correct range.  This
	 * is not necessarily what you want.
	 */
	if (dev >= destlist->length())
		dev = dev % destlist->length();

	if( verbose ) 
		fprintf(stderr, "init midi event: time=%d source=%d:%d;", 
			(int)time, source.client, source.port);
	
	snd_seq_ev_clear(ep);
	snd_seq_ev_schedule_tick(ep, queue, 0, time);
	ep->source = source;
	if (destlist->length() > 0) {
		ep->dest = *(destlist->index(dev));
		if( verbose ) 
			fprintf(stderr, "dev=%d; destination=%d:%d\n", dev, ep->dest.client, ep->dest.port);
	}
}
开发者ID:johndderry,项目名称:giada-engine,代码行数:44,代码来源:seqcontext.cpp

示例11: Func_ChannelAftertouch

static void Func_ChannelAftertouch( int channel, int pressure )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_chanpress(&ev, channel, pressure);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

示例12: Func_PitchBend

static void Func_PitchBend( int channel, int lsb, int msb )
{
    snd_seq_event_t ev;
    snd_seq_ev_clear(&ev);
    snd_seq_ev_set_pitchbend(&ev, channel, (lsb | (msb << 7)) - 8192);
    sequence_event(&ev);
}
开发者ID:JohnnyonFlame,项目名称:jfaudiolib,代码行数:7,代码来源:driver_alsa.c

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

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

示例15: it

void DssiPluginMidiManager::convertMidiMessages (MidiBuffer& midiMessages,
                                                 const int blockSamples)
{
    const uint8* data;
    int numBytesOfMidiData,
        samplePosition;
    MidiBuffer::Iterator it (midiMessages);

    currentMidiCount = 0;

    while (it.getNextEvent (data,
                            numBytesOfMidiData,
                            samplePosition))
    {
        if (numBytesOfMidiData > maxEventSize)
        {
            maxEventSize = numBytesOfMidiData;
            snd_midi_event_free (midiParser);
            snd_midi_event_new (maxEventSize, &midiParser);
        }

        snd_seq_event_t* event = & midiEventsBuffer [currentMidiCount];
        snd_seq_ev_clear (event);

        snd_midi_event_encode (midiParser,
                               data,
                               numBytesOfMidiData,
                               event);

        if (++currentMidiCount >= 2048)
            break;
    }

    snd_midi_event_reset_encode (midiParser);
}
开发者ID:christianscheuer,项目名称:jivemodular,代码行数:35,代码来源:DssiPlugin.cpp


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