Sophie

Sophie

distrib > Mandriva > 8.2 > i586 > by-pkgid > 6282078ae76a671f49c6af38c67b1a07 > files > 2258

kdelibs-devel-2.2.2-49.2mdk.i586.rpm

<HTML>
<HEAD>
<TITLE>class MidiPlayer</TITLE>

<META NAME="Generator" CONTENT="KDOC ">
</HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000099" alink= "#ffffff">
<TABLE WIDTH="100%" BORDER="0">
<TR>
<TD>
	<TABLE BORDER="0">
		<TR><TD valign="top" align="left" cellspacing="10">
		<h1>class MidiPlayer</h1>
		</TD>
		<TD valign="top" align="right" colspan="1">The MIDI file player engine. <small><A HREF="#longdesc">More...</A></small></TD></TR>
	</TABLE>
	<HR>
	<TABLE BORDER="0">
		<TR><TH>Definition</TH><TD><code>#include &lt;<A HREF="player_h.html">player.h</A>&gt;</code></TD></TR>
<TR><TH><A HREF="full-list-MidiPlayer.html">List of all Methods</A></TH></TR>
	</TABLE>
	</TD>
<TD align="right"><TABLE BORDER="0"><TR><TD><small><A HREF="index-long.html">Annotated List</A></small></TD></TR>
<TR><TD><small><A HREF="header-list.html">Files</A></small></TD></TR>
<TR><TD><small><A HREF="all-globals.html">Globals</A></small></TD></TR>
<TR><TD><small><A HREF="hier.html">Hierarchy</A></small></TD></TR>
<TR><TD><small><A HREF="index.html">Index</A></small></TD></TR>
</TABLE></TD></TR></TABLE>
<h4>Public Methods</h4><ul><LI>&nbsp;<b><A HREF="#ref17">MidiPlayer</A></b> (<A HREF="DeviceManager.html">DeviceManager</A> *midi_,<A HREF="PlayerController.html">PlayerController</A> *pctl) 
</LI>
<LI>&nbsp;<b><A HREF="#ref18">~MidiPlayer</A></b> () 
</LI>
<LI>int &nbsp;<b><A HREF="#ref19">loadSong</A></b> (const char *filename) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref20">removeSong</A></b> (void) 
</LI>
<LI>int &nbsp;<b><A HREF="#ref21">isSongLoaded</A></b> (void) 
</LI>
<LI><A HREF="SpecialEvent.html">SpecialEvent</A> *&nbsp;<b><A HREF="#ref22">specialEvents</A></b> () 
</LI>
<LI><A HREF="NoteArray.html">NoteArray</A> *&nbsp;<b><A HREF="#ref23">noteArray</A></b> (void) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref24">play</A></b> (bool calloutput=false,void output(void) = 0) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref25">setParseSong</A></b> (bool b = true) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref26">setGenerateBeats</A></b> (bool b = false) 
</LI>
<LI><A HREF="MidiFileInfo.html">MidiFileInfo</A> *&nbsp;<b><A HREF="#ref27">information</A></b> (void) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref28">setPos</A></b> (<A HREF="#ulong">ulong</A> gotomsec, class <A HREF="MidiStatus.html">MidiStatus</A> *midistat) 
</LI>
<LI>void &nbsp;<b><A HREF="#ref29">setTempoRatio</A></b> (double ratio) 
</LI>
</ul><HR><H2><A NAME="longdesc">Detailed Description</A></H2><p>
 MIDI file player routines . This class reads a MIDI file and
 play it using a <A HREF="DeviceManager.html">DeviceManager</A> object.
</p>
<p> To use it, just call <A HREF="MidiPlayer.html#loadSong">loadSong</A>() with the filename you want to play,
 and then <A HREF="MidiPlayer.html#play">play</A>().
</p>
<p> Please have a look at the note in the <A HREF="MidiPlayer.html#play">play</A>() documentation.
</p>
<p> MidiPlayer will write information about the playing process on a 
 <A HREF="PlayerController.html">PlayerController</A>() structure that you must supply to the constructor
</p>
<p> Alternatively, if everything you want is to play a midi file in a game or
 any other application that doesn't need to fine tune the midi playing, just
 use the kmidplay() function.
</p>
<p></p>
<p></p>
<p><b>See also</b>: <A HREF="KMidSimpleAPI.html">KMidSimpleAPI</A></p>
<A NAME="MidiPlayer"></A><A NAME="ref17"></A><table width="100%"><tr bgcolor="#eeeeee"><td>&nbsp;<strong>MidiPlayer</strong> (<A HREF="DeviceManager.html">DeviceManager</A> *midi_,<A HREF="PlayerController.html">PlayerController</A> *pctl)
<br></td><td align="right"><h3><strong>MidiPlayer</strong></h3></td></tr></table><p></p><p>
 Constructor . You must construct and pass a <A HREF="DeviceManager.html">DeviceManager</A> object and a 
 <A HREF="PlayerController.html">PlayerController</A> structure. None of them will be destroyed by this
 object, so you should do it after destroying the MidiPlayer object.
   </p>
<A NAME="~MidiPlayer"></A><A NAME="ref18"></A><table width="100%"><tr bgcolor="#eeeeee"><td>&nbsp;<strong>~MidiPlayer</strong> ()
<br></td><td align="right"><h3><strong>~MidiPlayer</strong></h3></td></tr></table><p></p><p>
 Destructor.
   </p>
<A NAME="loadSong"></A><A NAME="ref19"></A><table width="100%"><tr bgcolor="#eeeeee"><td>int &nbsp;<strong>loadSong</strong> (const char *filename)
<br></td><td align="right"><h3><strong>loadSong</strong></h3></td></tr></table><p></p><p>
 Loads a Song, and parses it (it the parse wasn't disabled with 
 <A HREF="MidiPlayer.html#setParseSong">setParseSong</A>() ) . It also generates the Beat events (see 
 <A HREF="SpecialEvent.html#type">SpecialEvent::type</A>() ) if you enabled this by using 
 <A HREF="MidiPlayer.html#setGenerateBeats">setGenerateBeats</A>() .
   </p>
<A NAME="removeSong"></A><A NAME="ref20"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>removeSong</strong> (void)
<br></td><td align="right"><h3><strong>removeSong</strong></h3></td></tr></table><p></p><p>
 Unloads the current song, so that every internal variable is empty and clean
 for further usage.
   </p>
<A NAME="isSongLoaded"></A><A NAME="ref21"></A><table width="100%"><tr bgcolor="#eeeeee"><td>int &nbsp;<strong>isSongLoaded</strong> (void)
<br></td><td align="right"><h3><strong>isSongLoaded</strong></h3></td></tr></table><p></p><p>
 Returns true if there's a song already loaded (with a previous call to 
 <A HREF="MidiPlayer.html#loadSong">loadSong</A>() ) and false if not.
   </p>
<A NAME="specialEvents"></A><A NAME="ref22"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="SpecialEvent.html">SpecialEvent</A> *&nbsp;<strong>specialEvents</strong> ()
<br></td><td align="right"><h3><strong>specialEvents</strong></h3></td></tr></table><p></p><p>
 Returns the linked list of SpecialEvents objects . For this to work,
 the parse should be enabled (the default), by using <A HREF="MidiPlayer.html#setParseSong">setParseSong</A>().
   </p>
<A NAME="noteArray"></A><A NAME="ref23"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="NoteArray.html">NoteArray</A> *&nbsp;<strong>noteArray</strong> (void)
<br></td><td align="right"><h3><strong>noteArray</strong></h3></td></tr></table><p></p><p>
 Returns and array with the notes playen through the song . MidiPlayer must
 parse the song to get the notes, so be sure not to disable the parsing of
 the song.
</p>
<p> Returns an array of notes, (just note on and note off events), in the form
 of a <A HREF="NoteArray.html">NoteArray</A> object
   </p>
<A NAME="play"></A><A NAME="ref24"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>play</strong> (bool calloutput=false,void output(void) = 0)
<br></td><td align="right"><h3><strong>play</strong></h3></td></tr></table><p></p><p>
 Plays the song using the <A HREF="DeviceManager.html">DeviceManager</A> object supplied in the
 constructor. It should be already configured, as play doesn't change the
 volume, nor midi mapper, for example.
</p>
<p> Note: Calling this function will block the execution of your application
 until the song finishes playing. The solution for this is simple, fork
 before calling it, and create the <A HREF="PlayerController.html">PlayerController</A> object on shared
 memory.
</p>
<p> As alternative, if everything you want is playing a midi file in a game or
 any other application that doesn't need to fine tune the midi playing, just
 use the <A HREF="KMidSimpleAPI.html#kMidPlay">KMidSimpleAPI::kMidPlay</A>() function. 
</p>
<p></p>
<p><b>See also</b>: <A HREF="KMidSimpleAPI.html#kMidInit">kMidInit</A>, <A HREF="KMidSimpleAPI.html#kMidPlay">kMidPlay</A>, <A HREF="KMidSimpleAPI.html#kMidStop">kMidStop</A>, <A HREF="KMidSimpleAPI.html#kMidDestruct">kMidDestruct</A></p>
<A NAME="setParseSong"></A><A NAME="ref25"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setParseSong</strong> (bool b = true)
<br></td><td align="right"><h3><strong>setParseSong</strong></h3></td></tr></table><p></p><p>
 Enables or disables the parsing of the song when loading it. This affects
 the SpecialEvents (<A HREF="MidiPlayer.html#specialEvents">specialEvents</A>() ) and the NoteArray 
 (<A HREF="MidiPlayer.html#noteArray">noteArray</A>() ).
   </p>
<A NAME="setGenerateBeats"></A><A NAME="ref26"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setGenerateBeats</strong> (bool b = false)
<br></td><td align="right"><h3><strong>setGenerateBeats</strong></h3></td></tr></table><p></p><p>
 Enables or disables the generation of beats event in a song when loading
 it. 
   </p>
<A NAME="information"></A><A NAME="ref27"></A><table width="100%"><tr bgcolor="#eeeeee"><td><A HREF="MidiFileInfo.html">MidiFileInfo</A> *&nbsp;<strong>information</strong> (void)
<br></td><td align="right"><h3><strong>information</strong></h3></td></tr></table><p></p><p>
 Returns information about the current MIDI file.
</p>
<p></p>
<p><b>See also</b>: <A HREF="MidiPlayer.html#loadSong">loadSong</A></p>
<A NAME="setPos"></A><A NAME="ref28"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setPos</strong> (<A HREF="#ulong">ulong</A> gotomsec, class <A HREF="MidiStatus.html">MidiStatus</A> *midistat)
<br></td><td align="right"><h3><strong>setPos</strong></h3></td></tr></table><p></p><p>
 Sets the position in a song. 
</p>
<p><b>Parameters</b>:<TABLE BORDER="0" CELLPADDING="5">
<TR><TD align="left" valign="top"><i>gotomsec</i></TD><TD align="left" valign="top">the number of milliseconds to go to . A subsequent call to
 <A HREF="MidiPlayer.html#play">play</A>() will start playing the song from that moment, instead of the
 beginning.
</TD></TR>
<TR><TD align="left" valign="top"><i>midistat</i></TD><TD align="left" valign="top">a <A HREF="MidiStatus.html">MidiStatus</A> object that will contain the status in
 which the MIDI device would be if it would have arrived to this situation by
 a normal playing of the song.
   </TD></TR>
</TABLE></P>
<A NAME="setTempoRatio"></A><A NAME="ref29"></A><table width="100%"><tr bgcolor="#eeeeee"><td>void &nbsp;<strong>setTempoRatio</strong> (double ratio)
<br></td><td align="right"><h3><strong>setTempoRatio</strong></h3></td></tr></table><p></p><p>
 Changes the speed at which a song is played. The song's tempo is multiplied
 by the specified ratio.
   </p>
<HR><UL><LI><i>Version</i>: 0.9.5 17/01/2000
</LI><LI><i>Author</i>: Antonio Larrosa Jimenez <larrosa@kde.org>
 </LI><LI><i>Generated</i>: qateam on updates.mandrakesoft.com on Mon Dec 30 16:09:46 2002, using kdoc 2.0a53.</LI></UL></BODY></HTML>