Be more efficient when recording.
This commit is contained in:
parent
71e0583696
commit
9974e9bb47
|
@ -504,6 +504,7 @@ Canvas::draw_playhead ( void )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
copy();
|
||||
|
||||
for ( uint x = m.vp->w; x-- ; )
|
||||
|
@ -512,6 +513,13 @@ Canvas::draw_playhead ( void )
|
|||
|
||||
flip();
|
||||
|
||||
/* actually if we're recording, we should draw the grid once per
|
||||
* playhead movement also */
|
||||
if ( pattern::recording() == m.grid )
|
||||
{
|
||||
draw();
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ Grid::Grid ( void )
|
|||
viewport.y = 0;
|
||||
|
||||
_playing = false;
|
||||
_suspend_update = false;
|
||||
_start = _end = _index = 0;
|
||||
}
|
||||
|
||||
|
@ -124,6 +125,7 @@ Grid::unlock ( void )
|
|||
|
||||
_rw = NULL;
|
||||
|
||||
if ( ! _suspend_update )
|
||||
signal_events_change();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,6 +111,8 @@ protected:
|
|||
|
||||
int _draw_shape;
|
||||
|
||||
bool _suspend_update;
|
||||
|
||||
unsigned int _bpb; /* beats per bar */
|
||||
unsigned int _ppqn; /* pulses per quarter note (beat) */
|
||||
|
||||
|
@ -142,7 +144,7 @@ protected:
|
|||
|
||||
private:
|
||||
|
||||
int _locked;
|
||||
volatile int _locked;
|
||||
|
||||
public:
|
||||
|
||||
|
|
12
src/jack.C
12
src/jack.C
|
@ -89,19 +89,15 @@ static port_t input[2]; /* contro
|
|||
jack_nframes_t nframes; /* for compatibility with older jack */
|
||||
|
||||
/** get next recorded event, if any--runs in UI thread */
|
||||
midievent *
|
||||
midi_input_event ( int port )
|
||||
bool
|
||||
midi_input_event ( int port, midievent *me )
|
||||
{
|
||||
if ( jack_ringbuffer_read_space( input[ port ].ring_buf ) >= sizeof( midievent ) )
|
||||
{
|
||||
midievent *me = new midievent;
|
||||
|
||||
// MESSAGE( "passing midi input to non-RT thread" );
|
||||
|
||||
if ( jack_ringbuffer_read( input[ port ].ring_buf, (char *)me, sizeof( midievent ) ) )
|
||||
return me;
|
||||
return true;
|
||||
}
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,7 @@ enum { CONTROL, PERFORMANCE };
|
|||
|
||||
class midievent;
|
||||
|
||||
midievent * midi_input_event ( int port );
|
||||
bool midi_input_event ( int port, midievent *e );
|
||||
void midi_output_event ( int port, const midievent *e );
|
||||
void midi_output_event ( int port, const midievent *e, tick_t duration );
|
||||
void midi_all_sound_off ( void );
|
||||
|
|
|
@ -96,11 +96,10 @@ init_song ( void )
|
|||
void
|
||||
handle_midi_input ( void )
|
||||
{
|
||||
midievent *e;
|
||||
while ( ( e = midi_input_event( PERFORMANCE ) ) )
|
||||
midievent e;
|
||||
while ( ( midi_input_event( PERFORMANCE, &e ) ) )
|
||||
{
|
||||
pattern::record_event( e );
|
||||
delete e;
|
||||
pattern::record_event( &e );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -136,6 +136,9 @@ pattern::reset ( void )
|
|||
}
|
||||
}
|
||||
|
||||
/* records a MIDI event into a temporary buffer. It'll only be
|
||||
* permanently added to pattern after recording stops or the pattern
|
||||
* loops. */
|
||||
void
|
||||
pattern::record_event ( const midievent *me )
|
||||
{
|
||||
|
@ -233,7 +236,9 @@ pattern::record_event ( const midievent *me )
|
|||
p->_rw->events.insert( e );
|
||||
}
|
||||
|
||||
p->_suspend_update = true;
|
||||
p->unlock();
|
||||
p->_suspend_update = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue