Strange, let's try that again. I'll just copy and paste, it's not too big:
#include <Elementary.h>
#include <alsa/asoundlib.h>
static snd_seq_t *seq_handle;
static int out_port;
void midi_open(void)
{
snd_seq_open(&seq_handle, "default", SND_SEQ_OPEN_OUTPUT, 0);
snd_seq_set_client_name(seq_handle, "midcontroller");
out_port = snd_seq_create_simple_port(seq_handle, "out",
SND_SEQ_PORT_CAP_READ|SND_SEQ_PORT_CAP_SUBS_READ,
SND_SEQ_PORT_TYPE_APPLICATION);
}
static void
on_done(void *data, Evas_Object *obj, void *event_info)
{
// quit the mainloop (elm_run function will return)
elm_exit();
}
static void
_changed_cb(void *data, Evas_Object *obj, void *event_info)
{
double val = elm_slider_value_get(obj);
snd_seq_event_t ev;
snd_seq_ev_clear(&ev);
snd_seq_ev_set_source(&ev, out_port);
snd_seq_ev_set_subs(&ev);
snd_seq_ev_set_controller(&ev, 1, 1, (int)val);
snd_seq_ev_set_direct(&ev);
snd_seq_event_output_direct(seq_handle, &ev);
snd_seq_drain_output(seq_handle);
}
EAPI_MAIN int
elm_main(int argc, char **argv)
{
midi_open();
Evas_Object *win, *box, *sl;
win = elm_win_util_standard_add("slider", "Slider");
evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
box = elm_box_add(win);
elm_box_horizontal_set(box, EINA_TRUE);
elm_win_resize_object_add(win, box);
evas_object_show(box);
//add slider
sl = elm_slider_add(win);
elm_slider_horizontal_set(sl, EINA_FALSE);
//set default text
elm_object_text_set(sl, "Slide me");
evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND,
EVAS_HINT_EXPAND);
//set initial value
elm_slider_value_set(sl, 0.0);
//span size of slider
elm_slider_span_size_set(sl, 200);
//show units label
elm_slider_unit_format_set(sl, "%1.0f units");
//min and max values
elm_slider_min_max_set(sl, 0, 127);
//show value on the slider knob
elm_slider_indicator_format_set(sl, "%1.0f");
//invert
elm_slider_inverted_set(sl, EINA_TRUE);
//pack at the end of the box
elm_box_pack_end(box, sl);
evas_object_show(sl);
//callback to function returning value
evas_object_smart_callback_add(sl, "changed", _changed_cb, NULL);
evas_object_show(win);
elm_run();
elm_shutdown();
return 0;
}
ELM_MAIN()
On Wed, Feb 13, 2013 at 10:42 AM, Daniel Juyung Seo <[email protected]>wrote:
> Hello, there is no file attachment.
> Maybe it's missing or filtered out?
> What is the file extension?
> Can you resend the file?
>
> Thanks.
>
> Daniel Juyung Seo (SeoZ)
>
> On Wed, Feb 13, 2013 at 11:02 PM, Justin Rosander
> <[email protected]>wrote:
>
> > Hi there,
> > I'm having some trouble with the first program I've written using
> > Elementary. It is a midi controller that sends CC messages for
> controller
> > 1, channel 1 using the ALSA sequencer API. It works, but applications
> > cannot connect directly to it; I have to use aconnect to do this, which
> is
> > not ideal. I don't know if anyone here has any experience with this kind
> > of thing, but I would appreciate any help that I can get. Source is
> > attached, and will build using the following:
> >
> > gcc main.c -o slider -lasound `pkg-config elementary --cflags --libs`
> >
> > I am using the E17 release, not svn, and my OS is Debian stable.
> >
> > Regards,
> > Justin
> >
> >
> >
> ------------------------------------------------------------------------------
> > Free Next-Gen Firewall Hardware Offer
> > Buy your Sophos next-gen firewall before the end March 2013
> > and get the hardware for free! Learn more.
> > http://p.sf.net/sfu/sophos-d2d-feb
> > _______________________________________________
> > enlightenment-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/enlightenment-users
> >
> >
>
> ------------------------------------------------------------------------------
> Free Next-Gen Firewall Hardware Offer
> Buy your Sophos next-gen firewall before the end March 2013
> and get the hardware for free! Learn more.
> http://p.sf.net/sfu/sophos-d2d-feb
> _______________________________________________
> enlightenment-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-users
>
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
enlightenment-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-users