When you want to play OctaMED music in your program, you'll probably want to take a look at the player routines provided by author Teijo Kinnunen, the package can be found here:
https://aminet.net/package/dev/src/OcSS_src
It contains everything required for the developer, including runtime libraries, but to be able to use these a little preparation is required.
vbcc includes a tool named "fd2pragma" that creates the required C include files in a format that's suitable for vbcc. The source file for operations with "fd2pragma" is an "fd" ("file descriptor") file that describes the library in question to the compiler. The result is one or more new C include files that contains the library's function prototypes, and the actual function addresses of the library.
Here's one way to provide the required information to vbcc:
1. The basic command line to create a prototype include file for "medplayer.library" is:
fd2pragma medplayer_lib.fd 70 clib libproto.h
"medplayer_lib.fd" is the fundamental library file descriptor, provided by OcSS_src package.
"libproto.h" is the "template" prototype file, provided by OcSS_src package.
"70" is fd2pragma's SPECIAL value for "vbcc inline prototype" generation - see fd2pragma docs (click "VBCC").
The result of the above commandline is a new file named "medplayer_protos.h" in your current directory.
(Note that there's a deprecated function named "DimOffPlayer()" for which no function prototype will be created, "fd2pragma" gives a warning that can be ignored.)
2. In your program's C code, include "proplayer.h", as suggested by the example code in OcSS_src package. Do not include "libproto.h", but use your newly created "medplayer_protos.h". (Probably after "proplayer.h".)
3. Put a "struct Library *MEDPlayerBase;" somewhere in your program's code.
Now your program should compile with vbcc, and you can use "medplayer.library" like any other AmigaOS runtime library. There are more options to "fd2pragma" and different ways to make it work - see fd2pragma's docs for more information (e.g. in your vbcc package at doc/fd2pragma.guide).
The procedure is the same with "octaplayer.library" and "octamix.library", only the "fd" file to use is "octaplayer_lib.fd" or "octamix_lib.fd", respectively, and the resulting names ("octaplayer_protos.h", "OctaPlayerBase", etc.) are different.
Note that if you want to play different types of OctaMED music (4-channel, 5-8 channel, multichannel-mixing) you can use function "RequiredPlayRoutine()" (medplayer.library) to find out if your program needs to also open octaplayer.library or octamix.library and use different playback functions ("PlayModule8()", "PlayModuleM()").
No comments:
Post a Comment
Your comment will published after it has been reviewed.