|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.lwjgl.fmod3.FMusic
public class FMusic
Field Summary | |
---|---|
static int |
FMUSIC_TYPE_FSB
FMOD Sample Bank file |
static int |
FMUSIC_TYPE_IT
Impulse Tracker |
static int |
FMUSIC_TYPE_MIDI
MIDI file |
static int |
FMUSIC_TYPE_MOD
Protracker / Fasttracker |
static int |
FMUSIC_TYPE_NONE
No song being played |
static int |
FMUSIC_TYPE_S3M
ScreamTracker 3 |
static int |
FMUSIC_TYPE_XM
FastTracker 2 |
Constructor Summary | |
---|---|
FMusic()
|
Method Summary | |
---|---|
static boolean |
FMUSIC_FreeSong(FMusicModule module)
Frees memory allocated for a song and removes it from the FMUSIC system |
static int |
FMUSIC_GetBPM(FMusicModule module)
Returns the song's current BPM. |
static int |
FMUSIC_GetGlobalVolume(FMusicModule module)
Returns the song's current global volume Remarks GLOBAL volume is not the same as MASTER volume. |
static int |
FMUSIC_GetMasterVolume(FMusicModule module)
Returns the song's current master volume |
static java.lang.String |
FMUSIC_GetName(FMusicModule module)
Returns the name of the song set by the composer. |
static int |
FMUSIC_GetNumChannels(FMusicModule module)
Returns the number of channels within this songs pattern data |
static int |
FMUSIC_GetNumInstruments(FMusicModule module)
Returns the number of instruments contained in this song. |
static int |
FMUSIC_GetNumOrders(FMusicModule module)
Returns the number of orders in this song |
static int |
FMUSIC_GetNumPatterns(FMusicModule module)
Returns the number of patterns contained in this song. |
static int |
FMUSIC_GetNumSamples(FMusicModule module)
Returns the number of samples contained in this song. |
static int |
FMUSIC_GetOpenState(FMusicModule module)
If a mod is opened with FSOUND_NONBLOCKING, this function returns the state of the opening mod. |
static int |
FMUSIC_GetOrder(FMusicModule module)
Returns the song's current order number |
static int |
FMUSIC_GetPattern(FMusicModule module)
Returns the song's current pattern number |
static int |
FMUSIC_GetPatternLength(FMusicModule module,
int orderno)
Returns the the length in rows of the pattern for the specified order number |
static boolean |
FMUSIC_GetPaused(FMusicModule module)
Returns whether song is currently paused or not |
static int |
FMUSIC_GetRealChannel(FMusicModule module,
int modchannel)
Returns the real FSOUND channel playing based on the mod's FMUSIC channel Remarks Note FMUSIC mod playback only allocates a real channel on a mod channel the first time an instrument is played. |
static int |
FMUSIC_GetRow(FMusicModule module)
Returns the song's current row number Remarks This value is latency adjusted by default, and returns the number you are hearing, not the 'mix-time' value. |
static FSoundSample |
FMUSIC_GetSample(FMusicModule module,
int sampno)
Returns a reference to a sample inside a module. |
static int |
FMUSIC_GetSpeed(FMusicModule module)
Returns the song's current speed. |
static int |
FMUSIC_GetTime(FMusicModule module)
Returns the time in milliseconds since the song was started. |
static int |
FMUSIC_GetType(FMusicModule module)
Returns the format type a song |
static java.nio.ByteBuffer |
FMUSIC_GetUserData(FMusicModule module,
int capacity)
Retrieves the data set by FMUSIC_SetUserData |
static boolean |
FMUSIC_IsFinished(FMusicModule module)
Returns whether the song has completed playing, or when the last order has finished playing. |
static boolean |
FMUSIC_IsPlaying(FMusicModule module)
Returns whether the song is currently playing or not. |
static FMusicModule |
FMUSIC_LoadSong(java.lang.String name)
To load a module or bank with a given filename. |
static FMusicModule |
FMUSIC_LoadSongEx(java.nio.ByteBuffer data,
int mode,
java.nio.IntBuffer sampleList)
To load a module or bank with a given filename. |
static FMusicModule |
FMUSIC_LoadSongEx(java.lang.String name,
int offset,
int length,
int mode,
java.nio.IntBuffer sampleList)
|
static boolean |
FMUSIC_OptimizeChannels(FMusicModule module,
int maxchannels,
int minvolume)
This function helps with channel usage. |
static boolean |
FMUSIC_PlaySong(FMusicModule module)
Starts a song playing |
static boolean |
FMUSIC_SetInstCallback(FMusicModule module,
FMusicCallback callback,
int instrument)
Sets a user callback to occur every time a instrument is played, triggered from a MOD, S3M, XM or IT file. |
static boolean |
FMUSIC_SetLooping(FMusicModule module,
boolean looping)
Sets looping mode for midi and mod files Remarks Defaults to TRUE. |
static boolean |
FMUSIC_SetMasterSpeed(FMusicModule module,
float speed)
Sets a songs master speed scale, so that the song can be sped up or slowed down. |
static boolean |
FMUSIC_SetMasterVolume(FMusicModule module,
int volume)
Sets a songs master volume. |
static boolean |
FMUSIC_SetOrder(FMusicModule module,
int order)
Sets a songs order position / current playing position. |
static boolean |
FMUSIC_SetOrderCallback(FMusicModule module,
FMusicCallback callback,
int orderstep)
Sets a user callback to occur on every order divisible by the orderstep parameter, played from a MOD, S3M, XM or IT file Remarks It is important to note that this callback will be called from directly WITHIN the mixer / music update thread, therefore it is imperative that whatever you do from this callback be extremely efficient. |
static boolean |
FMUSIC_SetPanSeperation(FMusicModule module,
float pansep)
Sets the master pan seperation for a module |
static boolean |
FMUSIC_SetPaused(FMusicModule module,
boolean pause)
Pauses a song |
static boolean |
FMUSIC_SetReverb(boolean reverb)
Turns on reverb for MIDI/RMI files. |
static boolean |
FMUSIC_SetRowCallback(FMusicModule module,
FMusicCallback callback,
int rowstep)
Sets a user callback to occur on every row divisible by the rowstep parameter, played from a MOD, S3M, XM or IT file. |
static boolean |
FMUSIC_SetSample(FMusicModule module,
int sampno,
FSoundSample sptr)
Replaces a mod's sample with a sample definition specified. |
static boolean |
FMUSIC_SetUserData(FMusicModule module,
java.nio.ByteBuffer userdata)
Sets a user defined value to store with the music file to be retrieved later. |
static boolean |
FMUSIC_SetZxxCallback(FMusicModule module,
FMusicCallback callback)
Sets a user callback for any Zxx commands encountered in an S3M, XM or IT file. |
static void |
FMUSIC_StopAllSongs()
Stops all songs from playing. |
static boolean |
FMUSIC_StopSong(FMusicModule module)
Stops a song from playing. |
static void |
music_instcallback(long modulehandle,
int param)
This is the callback rutine called by the native implementation whenever a register callback is notified. |
static void |
music_ordercallback(long modulehandle,
int param)
This is the callback rutine called by the native implementation whenever a register callback is notified. |
static void |
music_rowcallback(long modulehandle,
int param)
This is the callback rutine called by the native implementation whenever a register callback is notified. |
static void |
music_zxxcallback(long modulehandle,
int param)
This is the callback rutine called by the native implementation whenever a register callback is notified. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FMUSIC_TYPE_NONE
public static final int FMUSIC_TYPE_MOD
public static final int FMUSIC_TYPE_S3M
public static final int FMUSIC_TYPE_XM
public static final int FMUSIC_TYPE_IT
public static final int FMUSIC_TYPE_MIDI
public static final int FMUSIC_TYPE_FSB
Constructor Detail |
---|
public FMusic()
Method Detail |
---|
public static FMusicModule FMUSIC_LoadSong(java.lang.String name)
name
- Filename of module to load
public static FMusicModule FMUSIC_LoadSongEx(java.nio.ByteBuffer data, int mode, java.nio.IntBuffer sampleList)
Loading a song from a memory handle is dangerous in one respect, if the data is corrupted or truncated, then FMUSIC could crash internally trying to load it. On PlayStation 2 the data and length pointer must be 16 byte aligned for DMA purposes. The samplelist and samplelistnum parameters are useful for limiting the amount of data fmod loads. This feature is for the FSB format only. It is especially useful if you have a bank of sounds and want to randomize the loading a bit by telling which sounds to load with random values, and consequently which not to load. On PlayStation 2, samplelistnum has a limit of 1536 entries.
data
- containing song to load. On PlayStation 2 data must be 16 byte aligned if loading from memorymode
- Mode for opening song. With module files, only FSOUND_LOADMEMORY, FSOUND_NONBLOCKING, FSOUND_LOOP_NORMAL, or FSOUND_LOOP_OFF are supported. For FSB files, FSOUND_2D, FSOUND_HW3D, FSOUND_FORCEMONO also worksampleList
- Optional. Buffer of sample indicies to load. Leave as Null if you want all samples to be loaded (default behaviour). See Remarks for more on this
public static FMusicModule FMUSIC_LoadSongEx(java.lang.String name, int offset, int length, int mode, java.nio.IntBuffer sampleList)
name
- of songoffset
- Optional. 0 by default. If > 0, this value is used to specify an offset in a file, so fmod will seek before openinglength
- Optional. 0 by default. If > 0, this value is used to specify the length of a memory block when using FSOUND_LOADMEMORY, or it is the length of a file or file segment if the offset parameter is used. On PlayStation 2 this must be 16 byte aligned for memory loadingmode
- Mode for opening song. With module files, only FSOUND_LOADMEMORY, FSOUND_NONBLOCKING, FSOUND_LOOP_NORMAL, or FSOUND_LOOP_OFF are supported. For FSB files, FSOUND_2D, FSOUND_HW3D, FSOUND_FORCEMONO also worksampleList
- Optional. Buffer of sample indicies to load. Leave as Null if you want all samples to be loaded (default behaviour). See Remarks for more on this
#FMUSIC_LoadSongEx(ByteBuffer, int, int, int, IntBuffer)
public static int FMUSIC_GetOpenState(FMusicModule module)
module
- Module to get the open state from
public static boolean FMUSIC_FreeSong(FMusicModule module)
module
- Module to be freed
public static boolean FMUSIC_PlaySong(FMusicModule module)
module
- Module to be played
public static boolean FMUSIC_StopSong(FMusicModule module)
module
- Module to be stopped
public static void FMUSIC_StopAllSongs()
public static boolean FMUSIC_SetZxxCallback(FMusicModule module, FMusicCallback callback)
Remarks The value passed into the param parameter of the callback is the xx value specified in the Zxx command by the musician ------------ It is important to note that this callback will be called from directly WITHIN the mixer / music update thread, therefore it is imperative that whatever you do from this callback be extremely efficient. If the routine takes too long then breakups in the sound will occur, or it will basically stop mixing until you return from the function. This sort of function is usually best for just setting a flag, or do some simple variable manipulation, and then exiting, letting your main thread do what it needs to based on these flags or variables. ------------ This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization. Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively. ------------ Note : This function is not supported with the MIDI format.
module
- Module to set the callback forcallback
- The callback function you supply to get called upon execution of a Zxx command
public static boolean FMUSIC_SetRowCallback(FMusicModule module, FMusicCallback callback, int rowstep)
Remarks It is important to note that this callback will be called from directly WITHIN the mixer / music update thread, therefore it is imperative that whatever you do from this callback be extremely efficient. If the routine takes too long then breakups in the sound will occur, or it will basically stop mixing until you return from the function. This sort of function is usually best for just setting a flag, or do some simple variable manipulation, and then exiting, letting your main thread do what it needs to based on these flags or variables. ------------ This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization. Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively. ------------ Note : This function is not supported with the MIDI format.
module
- Module to set the callback forcallback
- The callback function you supply to get calledrowstep
- Call the callback every multiple of this number of rows
public static boolean FMUSIC_SetOrderCallback(FMusicModule module, FMusicCallback callback, int orderstep)
Remarks It is important to note that this callback will be called from directly WITHIN the mixer / music update thread, therefore it is imperative that whatever you do from this callback be extremely efficient. If the routine takes too long then breakups in the sound will occur, or it will basically stop mixing until you return from the function. This sort of function is usually best for just setting a flag, or do some simple variable manipulation, and then exiting, letting your main thread do what it needs to based on these flags or variables. ------------ This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization. Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively. ------------ Note : This function is not supported with the MIDI format.
module
- Module to set the callback forcallback
- The callback function you supply to get calledorderstep
- Call the callback every multiple of this number of orders
public static boolean FMUSIC_SetInstCallback(FMusicModule module, FMusicCallback callback, int instrument)
Remarks It is important to note that this callback will be called from directly WITHIN the mixer / music update thread, therefore it is imperative that whatever you do from this callback be extremely efficient. If the routine takes too long then breakups in the sound will occur, or it will basically stop mixing until you return from the function. This sort of function is usually best for just setting a flag, or do some simple variable manipulation, and then exiting, letting your main thread do what it needs to based on these flags or variables. ------------ This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization. Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively. ------------ Note : This function is not supported with the MIDI format.
module
- Module set the callback forcallback
- The callback function you supply to get calledinstrument
- Call the callback when this instrument number is triggered
public static boolean FMUSIC_SetSample(FMusicModule module, int sampno, FSoundSample sptr)
Remarks Because of the instrument nature of some formats like XM, this function lists all the samples in order of instruments and their subsamples. ie if instrument 1 has 2 samples and instrument 2 contains 3 samples, then sampno in this case would be 0 and 1 for instrument 1's samples, and 2,3 & 4 for instrument 2's samples. ------------ FMOD does not free the existing mod sample that you may be overwriting. If you do overwrite an existing handle, it may be lost, and you may incur a memory leak. It is a good idea to free the existing sample first before overwriting it. ------------ Important: For PlayStation 2, this function has to do a blocking query to the IOP, and can take significantly more time than a standard non blocking fmod function. This means it is best to cache the pointers for samples while loading, and not call this function in realtime. ------------ This function is not supported with the MIDI format.
module
- Module to set the sample for.sampno
- index to sample inside modulesptr
- sample definition to replace mod sample
public static boolean FMUSIC_SetUserData(FMusicModule module, java.nio.ByteBuffer userdata)
module
- Module to set user data foruserdata
- Value to store with music object
public static boolean FMUSIC_OptimizeChannels(FMusicModule module, int maxchannels, int minvolume)
Remarks maxchannels will default to the number of channels allocated by FSOUND, so this will never happen by default. minvolume will default to 0, so it will always succeed by default. To see how many channels are currently being MIXED, use FSOUND_GetChannelsPlaying. As a musician mentioned to me once, most of his default volumes are set fairly high, and any low end volumes are usually echoes etc, and can afford to be dropped. ------------ Note : This function is not supported with the MIDI format.
module
- Module to set channel/volume optimization settingsmaxchannels
- Channel count to be mixed before fmusic starts to drop channels from the songminvolume
- If maxchannels is exceeded, then music channels with volumes below this value will not be played. Range is 0-64. This is the value the tracker displays. All trackers use 0-64
public static boolean FMUSIC_SetReverb(boolean reverb)
Remarks Reverb may be enabled through software emulation in the future for MOD based formats.
reverb
- Set to true to turn MIDI reverb on, false to turn MIDI reverb off
public static boolean FMUSIC_SetLooping(FMusicModule module, boolean looping)
Remarks Defaults to TRUE. To disable looping you must call this function using FALSE as the parameter. For midi files this only takes effect before FMUSIC_PlaySong is called. For mod files this can be called at any time including during playback.
module
- Module to set looping forlooping
- Set to true to make it loop forever, or false to only have it play once
public static boolean FMUSIC_SetOrder(FMusicModule module, int order)
Remarks Note : This function is not supported with the MIDI format.
module
- Module to have its order changedorder
- Order number to jump to
public static boolean FMUSIC_SetPaused(FMusicModule module, boolean pause)
module
- Module to be paused/unpausedpause
- true - song should be PAUSED, false - song should be UNPAUSED
public static boolean FMUSIC_SetMasterVolume(FMusicModule module, int volume)
module
- Module to have its master volume setvolume
- value from 0-256. 0 = silence, 256 = full volume
public static boolean FMUSIC_SetMasterSpeed(FMusicModule module, float speed)
module
- Module to have its speed scale setspeed
- Speed scale for song. 1.0 is default. Minimum is 0 (stopped), maximum is 10.0
public static boolean FMUSIC_SetPanSeperation(FMusicModule module, float pansep)
module
- Module to set pan seperation forpansep
- The pan scale. 1.0 means full pan seperation, 0 means mono
public static java.lang.String FMUSIC_GetName(FMusicModule module)
module
- Module to retrieve name from
public static int FMUSIC_GetType(FMusicModule module)
module
- Module to retrieve type from
public static int FMUSIC_GetNumOrders(FMusicModule module)
module
- Module to retrieve number of orders from
public static int FMUSIC_GetNumPatterns(FMusicModule module)
module
- Module to retrieve number of patterns from
public static int FMUSIC_GetNumInstruments(FMusicModule module)
module
- Module to retrieve number of instruments from
public static int FMUSIC_GetNumSamples(FMusicModule module)
module
- Module to retrieve number of samples
public static int FMUSIC_GetNumChannels(FMusicModule module)
module
- Module to retrieve number of channels from
public static FSoundSample FMUSIC_GetSample(FMusicModule module, int sampno)
Remarks Because of the instrument nature of some formats like XM, this function lists all the samples in order of instruments and their subsamples. ie if instrument 1 has 2 samples and instrument 2 contains 3 samples, then sampno in this case would be 0 and 1 for instrument 1's samples, and 2,3 & 4 for instrument 2's samples.
module
- Module to retrieve a sample handle fromsampno
- index to sample inside module
public static int FMUSIC_GetPatternLength(FMusicModule module, int orderno)
module
- Module to get pattern lenght fromorderno
- pattern at specified order
public static boolean FMUSIC_IsFinished(FMusicModule module)
module
- Module that you want check if finished or not
public static boolean FMUSIC_IsPlaying(FMusicModule module)
module
- Module to retrieve name from
public static int FMUSIC_GetMasterVolume(FMusicModule module)
module
- Module to retrieve song master volume from
public static int FMUSIC_GetGlobalVolume(FMusicModule module)
Remarks GLOBAL volume is not the same as MASTER volume. GLOBAL volume is an internal overall volume which can be altered by the song itself (ie there might be commands to fade in a particular part of the song by scaling all the volumes in the song up slowly from nothing). GLOBAL volume is different to MASTER volume in that the song can modify without your permission, whereas MASTER volume is an overall scalar that you can control. For general use, MASTER volume is more useful, but you may want to reset a song's GLOBAL volume at certain times in the song. (for example the song might have faded out by using GLOBAL volume and you want to reset it)
module
- Module to retrieve song global volume from
public static int FMUSIC_GetOrder(FMusicModule module)
module
- Module to retrieve current order number from
public static int FMUSIC_GetPattern(FMusicModule module)
module
- Module to retrieve current pattern number from
public static int FMUSIC_GetSpeed(FMusicModule module)
module
- Module to retrieve current song speed from
public static int FMUSIC_GetBPM(FMusicModule module)
module
- Module to retrieve current song BPM from
public static int FMUSIC_GetRow(FMusicModule module)
Remarks This value is latency adjusted by default, and returns the number you are hearing, not the 'mix-time' value. Use FSOUND_INIT_DONTLATENCYADJUST if you want the value at mix time, which is useful if you want to control the music interactively, or from a DSP callback.
module
- Module to retrieve current row from
public static boolean FMUSIC_GetPaused(FMusicModule module)
module
- Module to get paused flag from
public static int FMUSIC_GetTime(FMusicModule module)
Remarks This value is latency adjusted by default, and returns the number you are hearing, not the 'mix-time' value. Use FSOUND_INIT_DONTLATENCYADJUST if you want the value at mix time, which is useful if you want to control the music interactively, or from a DSP callback
module
- Module to the song to get time from
public static int FMUSIC_GetRealChannel(FMusicModule module, int modchannel)
Remarks Note FMUSIC mod playback only allocates a real channel on a mod channel the first time an instrument is played. NNA's will not register. This function only returns the primary real channel for the mod channel.
module
- Module to the songmodchannel
- channel index, to query the real channel from
public static java.nio.ByteBuffer FMUSIC_GetUserData(FMusicModule module, int capacity)
module
- Module to get the open state from
public static void music_instcallback(long modulehandle, int param)
handle
- Handle to native object being monitoredparam
- parameter passed to callbackpublic static void music_ordercallback(long modulehandle, int param)
handle
- Handle to native object being monitoredparam
- parameter passed to callbackpublic static void music_rowcallback(long modulehandle, int param)
handle
- Handle to native object being monitoredparam
- parameter passed to callbackpublic static void music_zxxcallback(long modulehandle, int param)
handle
- Handle to native object being monitoredparam
- parameter passed to callback
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |