haiku-website/static/legacy-docs/bebook/BMidiPort_Overview.html

46 lines
7.6 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - System Overview - The Midi Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheMidiKit_Overview.html" title="The Midi Kit" /><link rel="prev" href="BMidi_Overview.html" title="BMidi" /><link rel="next" href="BMidiStore_Overview.html" title="BMidiStore" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BMidi_Overview.html" title="BMidi"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheMidiKit_Overview.html" title="The Midi Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BMidiStore_Overview.html" title="BMidiStore"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - System Overview - The Midi Kit</div></div><div id="headerB">Prev: <a href="BMidi_Overview.html">BMidi</a>  Up: <a href="TheMidiKit_Overview.html">The Midi Kit</a>  Next: <a href="BMidiStore_Overview.html">BMidiStore</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMidiPort_Overview"></a>BMidiPort</h2></div></div></div><a id="id594609" class="indexterm"></a><p>A <a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object reads and writes MIDI data through a MIDI hardware
port. A MIDI hardware port has an input side (MIDI-In) and an output side
(MIDI-Out); you can use a single
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object to communicate with both sides. Also, you can create and use any number of
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
objects in your application—multiple
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
objects can open and use the same hardware port at the same time.</p><p>You identify a MIDI port by name, passing it to the
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
constructor or
<a class="link" href="BMidiPort.html#BMidiPort_Open" title="Open()"><code class="methodname">Open()</code></a>
function. Use the
<a class="link" href="BMidiPort.html#BMidiPort_GetDeviceName"><code class="methodname">GetDeviceName()</code></a>
function to retrieve the names of the MIDI ports. The ports are closed through
<a class="link" href="BMidiPort.html#BMidiPort_Close" title="Close()"><code class="methodname">Close()</code></a>;
they're automatically closed when the
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object is destroyed.</p><p>On a Macintosh, there are two midi ports:</p><ul class="itemizedlist"><li><p>"midi1" is the modem port.</p></li><li><p>"midi2" is the printer port.</p></li></ul><p>On Intel hardware…</p><p>A
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object can only open one port at a time.</p><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMidiPort_Overview_RunningAndTheMIDIHookFunctions"></a>Running and the MIDI Hook Functions</h3></div></div></div><ul class="itemizedlist"><li><p>Running a
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
corresponds to MIDI-In: When you tell a
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
to run (through the
<a class="link" href="BMidiPort.html#BMidiPort_Start" title="Start(), Stop()"><code class="methodname">Start()</code></a>
function) the object begins reading from
MIDI-In and spraying the MIDI messages to its connected objects.</p></li><li><p>On the other side, the MIDI hook functions
(<a class="link" href="BMidi.html#BMidi_NoteOn" title="NoteOn(), SprayNoteOn()"><code class="methodname">NoteOn()</code></a>,
<a class="link" href="BMidi.html#BMidi_NoteOff" title="NoteOff(), SprayNoteOff()"><code class="methodname">NoteOff()</code></a>,
etc.) send MIDI messages to MIDI-Out.</p></li></ul><p>It's possible to use the same
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object to accept data from
MIDI-In and broadcast different data to MIDI-Out. You can even connect a
<a class="link" href="BMidiPort.html" title="BMidiPort"><code class="classname">BMidiPort</code></a>
object to itself to create a "MIDI through" effect: Anything
that shows up at the MIDI-In port will automatically be sent out the
MIDI-Out port.</p></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BMidi_Overview.html">BMidi</a>  Up: <a href="TheMidiKit_Overview.html">The Midi Kit</a>  Next: <a href="BMidiStore_Overview.html">BMidiStore</a> </div><div id="footerB"><div id="footerBL"><a href="BMidi_Overview.html" title="BMidi"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheMidiKit_Overview.html" title="The Midi Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BMidiStore_Overview.html" title="BMidiStore"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>