This class are allocated and initialized in the APlayer program. There will only be one instance of it all the way in the program. You may not make an instance by yourself. You will get a pointer to this instance to use in your player or add-on. Remember that every time you access the variables in the class, you has to lock it with the Lock() function and unlock it again with the Unlock() function. If you use the registry or module list variables, you don't need to call the Lock() and Unlock() functions, because these are protected by themself. See the PSynchronize classes description in the PolyKit documentation to see how they works.
Derived from: PMutex
Declared in: APlayer.h
APGlobalData(void);
It initialize all the member variables.
virtual ~APGlobalData(void);
Frees allocated memory.
void CallAfterAddingFilesPlugins(void);
You can call this function after you have added a lot of items in the module list. It will call all plug-ins which have plugged-in at the AfterAddingFiles place, including your own if you have plugged-in at that place.
void CallAfterRemovingFilesPlugins(void);
You can call this function after you have removed a lot of items in the module list. It will call all plug-ins which have plugged-in at the AfterRemovingFiles place, including your own if you have plugged-in at that place.
void DeleteConverterInstance(APAddOnConverter *converter);
Call this function to delete the instance you got from the GetConverterInstance() function.
APAddOnConverter *GetConverterInstance(PString name);
Call this function to get an instance to a converter. The argument is the name of the converter. The function will return the pointer ready to use or NULL if the converter couldn't be found. Use the DeleteConverterInstance() function to delete the pointer.
void GetLoaderConverterNames(PList<PString> &names);
If you want a list over all the installed converters that can load samples, you can use this function. You give a list as the argument, and this list will be filled with the converter names.
void GetSaverConverterNames(PList<PString> &names);
If you want a list over all the installed converters that can save samples, you can use this function. You give a list as the argument, and this list will be filled with the converter names.
void InstallModType(PString type, PString extension, PString lDescription, PString sDescription, void *smallIcon, void *largeIcon);
You probably call this function in your player/add-on Load() function. It will check to see if the module type is installed and if not, it will install it. If the module type is installed, it will check to see if APlayer is the associated program and if it is, it will install it again, just in case you have changed something. The arguments are a mime string, e.g. "audio/x-xm", an extension, e.g. "xm", a long description of the player/agent, a short description, a pointer to the small 16 * 16 icon and a pointer to the large 32 * 32 icon. Both the icons has to be in 8-bit color mode using the BeOS color palette. If you want to add more than one extension, you can separate each extension with a '|' character, e.g. "sid|psid".
bool ShowConverterConfig(APAddOnConverter *converter, BView *view);
This function will show the converter configuration window. This function is used when saving a sample. The arguments is the instance to the converter you got from the GetConverterInstance() function + a pointer to the view to show. It's legal to call this function with a NULL pointer in the view argument. The function will return true if the user pressed the ok button, which means you can continue to save the sample. If the function returns false, you should stop the save routine.
PString author;
If there could be found an author of the current playing module, it will be stored here, else it will be an empty string. This can be used by agents which want to show the author, like the module info agent.
PString fileName;
This is the filename with full path of the module currently playing.
uint32 moduleLen;
This is the length of the current playing module in bytes. If no module is in the memory, this is 0.
APModuleList *moduleList;
This is a pointer to the class that handles module lists. See the APModuleList documentation to see how it works.
APAddOnPlayer *player;
This is a pointer to the current player in use or NULL if no player is in use.
uint32 playerIndex;
This is the index number in the player add-on of the current player in use.
PString playerName;
This is the name of the player used to play the module.
PRegistry *saveReg;
If you have some configuration data you want to store, you should store them in this registry. This is the save registry, which means you may only write to this one and it will be saved when APlayer exists.
PRegistry *useReg;
If you have some configuration data you want to store, you should store them in this registry. This is the use registry, which means you can read and write from this one, but they will not be saved when APlayer exists.