Hello everybody !

I'm french, so I'll **TRY** to speak english correctly...

I'm new in C programming (in programming, in fact...) and I work on a 
soft for speaking with an effect rack (alesis microverb IV) with sysex 
trough rawmidi for saving my patches, remote control this unit, etc...

So, this is my problem  : I don't know how to send sysex through 
rawmidi !! I'm using the snd_rawmidi_open and snd_rawmidi_write, but I 
can't send anything !! Even the rawmidi.c test program from alsa-utils 
don't work...

My soundcard is an Sound Blaster Live ! 1024 Player...

This is a piece of my source code :

/* START OF SOURCE */

#include <sys/asoundlib.h>
#include <stdio.h>
#include <stdlib.h>

typedef struct {
        int prog;       //num of program
        int a;          //A parameter
        int b;          //B parameter
        int bank;       //bank number (0 = preset, 1 = user)
} pdb;

void affiche(unsigned char a[]) {
        int i=-1;
         
        printf("The next SySex have been sent trough RawMidi\n");
         
         
        while (a[i++] != 0xF7) {
                printf("%x",a[i]);
                printf(" ");
        }
        printf("\n");
        printf("\n");
         
        return;
}

void entete(unsigned char mess[]) {

        /* start of SySex */
        mess[0]=0xf0;
        /* identification Alesis */
        mess[1]=0x00;
        mess[2]=0x00;
        mess[3]=0x0e;
        /*identification microverb IV*/
        mess[4]=0x12;
        /* MIDI channel (0x00 = omni) */
        mess[5]=0x00;
}

void sysex_store(unsigned char a[]) {

        // head of SySex
        entete(a);
         
        //SySex definition STORE
        a[6]=0x03;
         
        // EOX
        a[7]=0xF7;
}

void dump_store(snd_rawmidi_t *handle) {
        unsigned char sysex[8];
        ssize_t taille; //### VARIABLE A DECOMMENTER QUAND ON REACTIVE 
L'ENVOIE DU SYSEX ###
         
        //creation du unsigned char
        sysex_store(sysex);
         
        //envoie du unsigned char
        snd_rawmidi_write(handle,sysex,taille);
        affiche(sysex);
}

int main (void) {
         
        snd_rawmidi_t *handle;

        snd_rawmidi_open(&handle, 0, 0, SND_RAWMIDI_OPEN_DUPLEX);        

        dump_store(handle);
         
        snd_rawmidi_close(handle);

        return 0;
}

/* END OF SOURCE */

Normally, this code create a "store the current program" message and 
send it trough rawmidi... But it don't...

So, where is my error ?

Another small question : how can I force a pause in a program ? Is 
there a function like [delay(10);] who make a pause of 10 miliseconds 
in a execution ? I'll need to make a pause between to sysex later in 
program...

Thanx for help a newbie !!

Charles Flèche

_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

Reply via email to