Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Pieter Palmers <pieterp@joow.be>
To: "M. Gagnon" <fire_void@hotmail.com>
Cc: alsa-devel@lists.sourceforge.net
Subject: Re: Development Question
Date: Sat, 17 Mar 2007 22:36:31 +0100	[thread overview]
Message-ID: <45FC5F5F.4090104@joow.be> (raw)
In-Reply-To: <BAY120-F3AD6DD98410316B330D259C700@phx.gbl>

M. Gagnon wrote:
> Hi, i am now trying to port an application to linux using Alsa. At some 
> point, i have midi bytes as char* and i have to play them. This is exactly 
> the same data you'd find in a file, expect that it's in memory instead. How 
> is that possible?
> 
> If this is not possible, i could always take any help on playing midi using 
> sequencers I looked at the docs, i found a few samples, but they seemed to 
> be outdated and the one that could interest me segfaulted. After i debugged 
> it and fixed the segfault, it played nothing... (and i'm sure my midi is 
> configured correctly BTW, pmidi works and i also succeeded in getting single 
> notes to play)
This is how I do playback in the freebob backend for jack:

for (s=0;s<samples_read;s++) {
   signed int *byte=(buff+s);
   snd_seq_event_t ev;
   if ((snd_midi_event_encode_byte(
          port->parser,(*byte) & 0xFF, &ev)
        ) > 0) {
       // a midi message is complete, send it out to ALSA
       snd_seq_ev_set_subs(&ev);
       snd_seq_ev_set_direct(&ev);
       snd_seq_ev_set_source(&ev, port->seq_port_nr);
       snd_seq_event_output_direct(port->seq_handle, &ev);			   }
}

you can check the freebob_driver_midi_* functions in the freebob jack 
backend for more detail.

Pieter


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

  reply	other threads:[~2007-03-17 21:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.0.1174159191.971.alsa-devel@lists.sourceforge.net>
2007-03-17 19:27 ` Development Question M. Gagnon
2007-03-17 21:36   ` Pieter Palmers [this message]
2007-03-18  1:19     ` M. Gagnon
2007-03-18 10:29       ` Pieter Palmers
2007-03-18 18:08         ` M. Gagnon
2007-03-19  8:33           ` Clemens Ladisch
2007-03-20  0:27             ` M. Gagnon
2007-03-20  1:58               ` raghvendra misra
2007-03-20  8:12               ` Clemens Ladisch
2007-03-21  1:02 M. Gagnon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45FC5F5F.4090104@joow.be \
    --to=pieterp@joow.be \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=fire_void@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox