}
#ifdef USE_ALSA_MIDI_IN
- if (midi->get_is_open()) midi->check_event();
+// if (midi->get_is_open()) midi->check_event();
#endif
/* Forward the sequencer... */
sequencer.step();
loop_is_active=true;
pthread_mutex_unlock(&start);
- device->start(); // Hand flow control over to the device
+ if (!stop_flag) device->start(); // Hand flow control over to the device
/* Stopping engine... */
loop_is_active=false;
midi=new tX_midiin();
#endif
tape=new tx_tapedeck();
+
device=NULL;
recording=false;
recording_request=false;
if ((strcmp(entry->d_name, ".")==0) ||
(strcmp(entry->d_name, "..")==0)) continue;
- filename = (char *) malloc (dirlen + strlen(entry->d_name) + 1 + needslash);
+ filename = (char *) malloc (dirlen + strlen(entry->d_name) + 10 + needslash);
strcpy(filename, "file:");
strcat(filename, dirname);
using namespace std;
-/*
- disabled
-void tX_midievent::print( const char* prefix ) const
-{
- cerr << prefix << ": channel=" << channel << ", type=" << type << ", number=" << number
- << ", value=" << value << ", is_noteon=" << is_noteon << endl;
+static gboolean midi_callback(GIOChannel *source, GIOCondition condition, gpointer data) {
+ tX_midiin *midi=(tX_midiin *) data;
+ midi->check_event();
}
-*/
tX_midiin::tX_midiin()
{
tX_error("tX_midiin(): failed to open the default sequencer device.");
return;
}
- snd_seq_set_client_name(ALSASeqHandle, "TerminatorX");
+ snd_seq_set_client_name(ALSASeqHandle, "terminatorX");
portid =
snd_seq_create_simple_port(ALSASeqHandle,
"Control Input",
snd_seq_nonblock( ALSASeqHandle, 1 );
+ struct pollfd fds[32];
+
+ int res=snd_seq_poll_descriptors (ALSASeqHandle, fds, 32, POLLIN);
+
+ if (res!=1) {
+ tX_error("Failed to poll ALSA descriptors: %i.\n", res);
+ }
+
+ GIOChannel *ioc=g_io_channel_unix_new(fds[0].fd);
+ g_io_add_watch(ioc, (GIOCondition)( G_IO_IN ), midi_callback, (gpointer) this);
+ g_io_channel_unref(ioc);
+
is_open=true;
tX_debug("tX_midiin(): sequencer successfully opened.");
{
tX_midiin::midi_binding_gui* this_ = (tX_midiin::midi_binding_gui*)_this;
- this_->midi->check_event();
+ //this_->midi->check_event();
tX_midievent tmpevent = this_->midi->get_last_event();
is_noteon = false;
}
+ tX_midievent() : channel(0), type(NONE), value(0.0), is_noteon(false) {}
+
/* not being used anyway */
// void print( const char* prefix ) const;
};
#define tt ((vtt_class *) vtt)
-void tX_seqpar :: default_constructor()
+tX_seqpar :: tX_seqpar () : bound_midi_event()
{
touched=0;
gui_active=1;
last_event_recorded=NULL;
}
-tX_seqpar :: tX_seqpar ()
-{
- default_constructor();
-}
-
-/*
-tX_seqpar :: tX_seqpar (void * mytt)
-{
- default_constructor();
- vtt=mytt;
-}
-
-tX_seqpar :: tX_seqpar (float max, float min, float scale, int mappable)
-{
- default_constructor();
- max_value=max;
- min_value=min;
- scale_value=scale;
- is_mappable=mappable;
-}*/
-
void tX_seqpar :: set_mapping_parameters(float max, float min, float scale, int mappable)
{
max_value=max;
is_mappable=mappable;
}
-/*
-tX_seqpar :: tX_seqpar (void *mytt, float max, float min, float scale, int mappable)
-{
- default_constructor();
- vtt=mytt;
- max_value=max;
- min_value=min;
- scale_value=scale;
- is_mappable=mappable;
-}
-*/
-
void tX_seqpar :: handle_mouse_input(float adjustment)
{
float tmpvalue;
}
if (tmpvalue>max_value) tmpvalue=max_value;
- if (tmpvalue<min_value) tmpvalue=min_value;
+ else if (tmpvalue<min_value) tmpvalue=min_value;
}
else
{
tmpvalue=event.value;
}
-
- receive_input_value(tmpvalue);
+
+ touch();
+
+ /* Not using receive() as we want immediate GUI update... */
+ do_exec(tmpvalue);
+ record_value(tmpvalue);
+ do_update_graphics();
}
#endif
/**** Sequencable Parameter: MASTER VOLUME ****/
-tX_seqpar_master_volume :: tX_seqpar_master_volume()
+tX_seqpar_master_volume :: tX_seqpar_master_volume()
{
set_mapping_parameters(2.5, 0, 0.1, 0);
}
guint32 persistence_id;
guint32 touch_timestamp;
void *last_event_recorded;
-
- void default_constructor();
public:
/* default constructor */