[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed)
From: |
Jeremiah Benham |
Subject: |
Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed) |
Date: |
Sat, 12 Sep 2009 07:45:14 -0500 |
Here is an attempt to implement what you were suggesting Richard. I am
having troubles with it. I repeatedly gives note on events and then
crashes denemo for some reason.
void
jack_playpitch(gint key, gint duration, gint volume, gint channel){
if (!BufferReady){
AllSoundOff=TRUE;
}
if (BufferReady){
loop_index = 0;
global_midi_buffer[0] = NOTE_ON;
global_midi_buffer[1] = key; //freq
global_midi_buffer[2] = volume;
global_duration = duration;
BufferReady=FALSE;
}
}
static void
send_midi_event(jack_nframes_t nframes){
unsigned char *buffer;
gint i=0;
gint channel;
void *port_buffers[MAX_NUMBER_OF_TRACKS];
if (AllSoundOff){
for (channel=0;channel<16;channel++){
buffer = jack_midi_event_reserve(port_buffers[i], 0, 3);
buffer[0] = MIDI_CONTROLLER | channel;
buffer[1] = MIDI_ALL_NOTE_OFF;
buffer[2] = 0;
global_duration = loop_index = 0;
AllSoundOff=FALSE;
}
}
if (!BufferReady)
if (output_ports[i]){
port_buffers[i] = jack_port_get_buffer(output_ports[i], nframes);
jack_midi_clear_buffer(port_buffers[i]);
buffer = jack_midi_event_reserve(port_buffers[i], 0, 3);
buffer[0] = global_midi_buffer[0];
buffer[1] = global_midi_buffer[1];
buffer[2] = global_midi_buffer[2];
BufferReady=TRUE;
}
}
static void
timer_callback(jack_nframes_t nframes){
gint i;
for (i=0;i<nframes;i++)
if (global_duration != 0){
if ((loop_index++ >= global_duration) && BufferReady){
global_midi_buffer[0] = NOTE_OFF;
/*global_midi_buffer[1] = same*/
global_midi_buffer[2] = 0;
BufferReady=FALSE;
global_duration = loop_index = 0;
}
if ((loop_index > global_duration) && !BufferReady){
global_duration = loop_index = 0;
AllSoundOff=TRUE;
}
}
}
Also in process_callback I put this:
if (Denemo.gui->si && output_ports && Denemo.prefs.immediateplayback){
send_midi_event(nframes);
timer_callback(nframes);
}
Thanks for your help,
Jeremiah
- Re: [Denemo-devel] Anacrusis script needed, (continued)
- Re: [Denemo-devel] Anacrusis script needed, Jeremiah Benham, 2009/09/06
- Re: [Denemo-devel] Anacrusis script needed, Richard Shann, 2009/09/06
- Re: [Denemo-devel] Anacrusis script needed, Jeremiah Benham, 2009/09/06
- MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/09
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/10
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/10
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/10
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/10
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/10
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/11
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed),
Jeremiah Benham <=
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/12
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Richard Shann, 2009/09/14
- Re: MIDI (was Re: [Denemo-devel] Anacrusis script needed), Jeremiah Benham, 2009/09/14