.TH "KMidSimpleAPI" 3 "28 Jan 2004" "libkmid Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KMidSimpleAPI \- Simple API covering most of the uses of libkmid. A very simple API around the rest of libkmid.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <libkmid.h>\fP
.PP
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "int \fBkMidInit\fP (void)"
.br
.RI "\fIInitializes libkmid. \fP"
.ti -1c
.RI "int \fBkMidLoad\fP (const  char *filename)"
.br
.RI "\fILoads a song that will be played with the next call to \fBkMidPlay\fP(). \fP"
.ti -1c
.RI "int \fBkMidPlay\fP (int loop=0)"
.br
.RI "\fIPlays the song currently loaded with \fBkMidLoad\fP(). \fP"
.ti -1c
.RI "int \fBkMidStop\fP (void)"
.br
.RI "\fIStops playing a song inmediatly. \fP"
.ti -1c
.RI "void \fBkMidDestruct\fP (void)"
.br
.RI "\fIReleases the memory allocated by libkmid. \fP"
.ti -1c
.RI "int \fBkMidIsPlaying\fP (void)"
.br
.RI "\fIReturns 1 if the library is playing a song, and 0 if it's not. \fP"
.ti -1c
.RI "int \fBkMidDevices\fP (void)"
.br
.RI "\fIReturns the number of MIDI devices ( MIDI ports + synthesizers ). \fP"
.ti -1c
.RI "const  char * \fBkMidName\fP (int i)"
.br
.RI "\fIReturns the name of the i-th device . \fP"
.ti -1c
.RI "const  char * \fBkMidType\fP (int i)"
.br
.RI "\fIReturns the type of the i-th device . \fP"
.ti -1c
.RI "void \fBkMidSetDevice\fP (int i)"
.br
.RI "\fISets the MIDI device to use when playing a song. \fP"
.ti -1c
.RI "void \fBkMidSetMidiMapper\fP (const  char *mapfilename)"
.br
.RI "\fISets the Midi Mapper to use. \fP"
.ti -1c
.RI "const  char * \fBkMidVersion\fP (void)"
.br
.RI "\fIReturns the version number of libkmid, i.e. \fP"
.ti -1c
.RI "const  char * \fBkMidCopyright\fP (void)"
.br
.RI "\fIReturns the copyright notice that applications using libkmid should print to the user in an about box or somewhere visible. \fP"
.in -1c
.SH "Detailed Description"
.PP 
Simple API covering most of the uses of libkmid. A very simple API around the rest of libkmid. 

You can use the members of this class in pure C applications, just by using the same name as the corresponding function member.
.PP
Suppose you're developing a game and you want to play some background music while the user is playing. You only have to call :
.PP
.IP "\(bu" 2
\fBkMidInit\fP(); 
.IP "\(bu" 2
\fBkMidLoad\fP('RideOfTheValkyries.mid'); 
.IP "\(bu" 2
\fBkMidPlay\fP();
.PP
When the user decides to quit the game, use
.PP
.IP "\(bu" 2
\fBkMidStop\fP(); 
.IP "\(bu" 2
\fBkMidDestruct\fP();
.PP
to stop the music and release the memory allocated by libkmid.
.PP
\fBVersion:\fP
.RS 4
0.9.5 17/01/2000 
.RE
.PP
\fBAuthor:\fP
.RS 4
Antonio Larrosa Jimenez <larrosa@kde.org> 
.RE
.PP

.PP
Definition at line 54 of file libkmid.h.
.SH "Member Function Documentation"
.PP 
.SS "int KMidSimpleAPI::kMidInit (void)\fC [static]\fP"
.PP
Initializes libkmid. Creates the \fBDeviceManager\fP object, and initializes some variables that will be used later.
.PP
\fBReturns:\fP
.RS 4
0 if OK, and a positive number when there's any error (for example, because the /dev/sequencer device couldn't be opened, be it because it was already opened by another application, or because the sound card wasn't configured) 
.RE
.PP
Definition at line 42 of file libkmid.cc.
.SS "int KMidSimpleAPI::kMidLoad (const char * filename)\fC [static]\fP"
.PP
Loads a song that will be played with the next call to \fBkMidPlay\fP(). Definition at line 78 of file libkmid.cc.
.PP
References kMidDevices().
.SS "int KMidSimpleAPI::kMidPlay (int loop = 0)\fC [static]\fP"
.PP
Plays the song currently loaded with \fBkMidLoad\fP(). kMidPlay forks in order to play the song in a different process, it exits inmediately, so that the application can follow the normal execution flow while the sone is played.
.PP
If loop is 0 the song is played once and then the child process finishes. If loop is 1, the song is played repeatedly until \fBkMidStop\fP() is called. You can call \fBkMidStop\fP() anytime you want (also if loop is 0) to stop the song and kill the child process.
.PP
\fBSee also:\fP
.RS 4
\fBkMidStop\fP 
.PP
\fBkMidIsPlaying\fP 
.RE
.PP
Definition at line 84 of file libkmid.cc.
.PP
References kMidDevices().
.SS "int KMidSimpleAPI::kMidStop (void)\fC [static]\fP"
.PP
Stops playing a song inmediatly. It doesn't return until the child process that is playing the song is terminated.
.PP
\fBSee also:\fP
.RS 4
\fBkMidPlay\fP 
.RE
.PP
Definition at line 123 of file libkmid.cc.
.PP
References kMidDevices().
.SS "void KMidSimpleAPI::kMidDestruct (void)\fC [static]\fP"
.PP
Releases the memory allocated by libkmid. To continue playing, you must first make a(nother) call to \fBkMidInit\fP(). Definition at line 138 of file libkmid.cc.
.SS "int KMidSimpleAPI::kMidIsPlaying (void)\fC [static]\fP"
.PP
Returns 1 if the library is playing a song, and 0 if it's not. \fBSee also:\fP
.RS 4
\fBkMidPlay\fP 
.RE
.PP
Definition at line 149 of file libkmid.cc.
.SS "int KMidSimpleAPI::kMidDevices (void)\fC [static]\fP"
.PP
Returns the number of MIDI devices ( MIDI ports + synthesizers ). \fBSee also:\fP
.RS 4
\fBDeviceManager::midiPorts\fP 
.PP
\fBDeviceManager::synthDevices\fP 
.PP
\fBkMidName\fP 
.PP
\fBkMidType\fP 
.RE
.PP
Definition at line 154 of file libkmid.cc.
.PP
Referenced by kMidLoad(), kMidPlay(), kMidSetMidiMapper(), and kMidStop().
.SS "const  char * KMidSimpleAPI::kMidName (int i)\fC [static]\fP"
.PP
Returns the name of the i-th device . In case libkmid wasn't yet initialized ( see \fBkMidInit\fP() ), the return value is NULL, and in case the parameter has a value out of the valid range ( see \fBkMidDevices\fP() ) it returns an empty string.
.PP
\fBSee also:\fP
.RS 4
\fBkMidDevices\fP 
.PP
\fBkMidType\fP 
.RE
.PP
Definition at line 159 of file libkmid.cc.
.SS "const  char * KMidSimpleAPI::kMidType (int i)\fC [static]\fP"
.PP
Returns the type of the i-th device . In case libkmid wasn't yet initialized ( see \fBkMidInit\fP() ), the return value is NULL, and in case the parameter has a value out of the valid range ( see \fBkMidDevices\fP() ) it returns an empty string.
.PP
\fBSee also:\fP
.RS 4
\fBkMidDevices\fP 
.PP
\fBkMidName\fP 
.RE
.PP
Definition at line 164 of file libkmid.cc.
.SS "void KMidSimpleAPI::kMidSetDevice (int i)\fC [static]\fP"
.PP
Sets the MIDI device to use when playing a song. \fBSee also:\fP
.RS 4
\fBkMidDevices\fP 
.PP
\fBkMidName\fP 
.PP
\fBDeviceManager\fP 
.RE
.PP
Definition at line 169 of file libkmid.cc.
.SS "void KMidSimpleAPI::kMidSetMidiMapper (const char * mapfilename)\fC [static]\fP"
.PP
Sets the Midi Mapper to use. Most of the users won't need a midi mapper, but there're still non-General Midi synthesizers out there, and people with one of those will get much better sound quality by using a MIDI mapper.
.PP
Please have a look at KMid's documentation for more information about MIDI mappers and how to write a MIDI mapper for your keyboard. Definition at line 174 of file libkmid.cc.
.PP
References kMidDevices().
.SS "const  char * KMidSimpleAPI::kMidVersion (void)\fC [static]\fP"
.PP
Returns the version number of libkmid, i.e. '0.9.5' or '1.0 Beta' Definition at line 182 of file libkmid.cc.
.SS "const  char * KMidSimpleAPI::kMidCopyright (void)\fC [static]\fP"
.PP
Returns the copyright notice that applications using libkmid should print to the user in an about box or somewhere visible. I.e.
.PP
'LibKMid 0.9.5 (C) 1997-2000 Antonio Larrosa Jimenez <larrosa@kde.org>. Spain' Definition at line 187 of file libkmid.cc.

.SH "Author"
.PP 
Generated automatically by Doxygen for libkmid Library from the source code.
