Problems with eMagic Unitor8

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

I have two units of eMagic Unitor8, both Mark I (serial only) and Mark
II (with USB). I'm able to stack them, using the Apple printer cable
and such device works correctly (doesn't matter, which one is
connected to a PC) under Windows XP, as well as Mac OS X (only USB
connection is supported, both units are visible though). Right now I'm
having two issues with Alsa regarding my Unitors:

1. When I connect the Mark II with Mark I stacked on top of it, only
the first one is discovered. Eight input ports and nine outputs (8
separate ones + broadcast) are detected. I'm able to send MIDI Note On
messages to particular ports of the Mark II using amidi. I tried to
use the generic serial MIDI interface with the Mark I connected thru
properly detected Prolific USB -> serial adapter, but it didn't work
at all.

2. I'm using Perl with ALSA::MIDI module
(https://metacpan.org/module/MIDI::ALSA), which actually is the XS
wrapper for the C API of Alsa. The problem is, that I can connect to
many input ports and happily receive messages from different inputs,
while only the first output port is used. For instance, if I specify
that I want to use ports 1, 2 and 3, and I call connectto in that
order, everything I send (no matter to which port), will arrive to the
port 1. I tried to write a simple C program to check if the error is
on the Perl side, but it didn't work (probably because of my lack of C
skills). I attach it, so if anyone can point out some obvious errors,
which would help me to test it properly, I would appreciate any hint.

I'm using Ubuntu with the meta-packet Ubuntu Studio installed on top
of it; Alsa version 1.0.24.

Just to give it the justice - Linux with Alsa is actually the first
system that gave me the possibility to start with my project - dynamic
realtime MIDI processor written in Perl (both Mac & Windows failed in
that department). Even with one output I still have 16 channels and
plenty of possibilities :-)

If you have any tips regarding the first issue, I'm quite aware that
it's very hardware bound and probably difficult to debug without two
stacked Unitors. I'm willing to get involved; I already tried to alter
the SysEx initialization message sent to the unit, replacing the
"first" with "all", but it didn't work (I did it by hexediting the raw
binary of the library, since I didn't want to recompile everything
from the scratch - maybe that's the reason).

Thanks for any help,

Bruno
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <signal.h>
#include <alsa/asoundlib.h>

int main (int argc, char** argv) {
    snd_seq_t *handle;
    snd_seq_event_t *ev;
    int err, my_id, pend, i;

    err = snd_seq_open( &handle, "default", SND_SEQ_OPEN_INPUT, 0 );

    if ( err > 0 )
        return 0;

    snd_seq_set_client_name( handle, "C-Ravel" );

    my_id = snd_seq_client_id( handle );

    for ( i = 0; i < 2; i++ ) {
        err = snd_seq_create_simple_port( handle, "IN", 
                                        SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE,
                                        SND_SEQ_PORT_TYPE_APPLICATION );
        if ( err < 0 ) {
            printf( "Unable to open IN port" );
            return 0;
        }
        else {
            printf( "Opened IN port %d\n", err );
        }
    }

    for ( i = 0; i < 2; i++ ) {
        err = snd_seq_create_simple_port( handle, "OUT", 
                                        SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ,
                                        SND_SEQ_PORT_TYPE_APPLICATION );
        if ( err < 0 ) {
            printf( "Unable to open OUT port" );
            return 0;
        }
        else {
            printf( "Opened OUT port %d\n", err );
        }
    }

    snd_seq_connect_from( handle, 0, 28, 2 );
    snd_seq_connect_from( handle, 1, 28, 5 );
    snd_seq_connect_to( handle, 2, 28, 1 );
    snd_seq_connect_to( handle, 3, 28, 7 );

    while ( 1 ) {
        pend = snd_seq_event_input_pending( handle, 1 );

        while ( pend ) {
            printf( "Trying to get the event\n" );
            pend = snd_seq_event_input( handle, &ev );

            printf( "Got something from %d : %d for %d : %d\n", 
                (ev)->source.client, (ev)->source.port, (ev)->dest.client, (ev)->dest.port );
            // route it
            (ev)->source.port = 0;
            snd_seq_ev_set_dest( ev, 28, 2 );
            printf( "Now it is for %d : %d\n", (ev)->dest.client, (ev)->dest.port );
            err = snd_seq_event_output_direct( handle, ev );
            printf( "output returned %d\n", err );
        }
    }

    snd_seq_close( handle );
}
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Alsa-user mailing list
Alsa-user@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-user

[Index of Archives]     [ALSA Devel]     [Linux Audio Users]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]

  Powered by Linux