Arkos Player Functions | |
Constants | |
Arkos Player Compilation Constants | Constants used to control which features are enabled / disabled in the Arkos Tracker Player code. |
Functions | |
cpct_akp_musicPlay | Plays next music cycle of the present song with Arkos Tracker Player. |
cpct_akp_musicInit | Sets up a music into Arkos Tracker Player to be played later on with cpct_akp_musicPlay. |
cpct_akp_stop | Stops playing musing and sound effects on all 3 channels. |
cpct_akp_SFXGetInstrument | Returns the number of the instrument which is playing SFX in the selected channel (0 = Channel free / not playing SFX). |
cpct_akp_SFXInit | Initializes sound effect instruments to be able to play sound effects. |
cpct_akp_SFXStopAll | Stops the reproduction of any sound effect in the 3 channels. |
cpct_akp_SFXPlay | Plays a concrete sound effect, using the instruments of the “SFX song” given to cpct_akp_SFXInit when initializing sound effects. |
cpct_akp_SFXStop | Stops the reproduction sound FX on given channels |
cpct_akp_setFadeVolume | Sets global volumes for creating fade in / out effects. |
Constants used to control which features are enabled / disabled in the Arkos Tracker Player code. Changing them requires recompiling CPCtelera’s library to take effect.
Plays next music cycle of the present song with Arkos Tracker Player. Song has had to be previously established with cpct_akp_musicInit.
void cpct_akp_musicPlay ()
call cpct_akp_musicPlay_asm
This function is to be called to start and continue playing the presently selected song with Arkos Tracker Player. Depending on the frequency at which the song were created, this function should be called 12, 25, 50, 100, 200 or 300 times per second.
Each time you call the function, it plays 1/frequency seconds. This means that you have to manually synchronize your calls to this function to have a stable music playing. If you call too fast or too slow you will either interrupt sound or have sound valleys. Therefore, you are responsible for calling this function with the most accurate timing possible, to get best sound results.
AF, AF’, BC, DE, HL, IX, IY
1794 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
To be done
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Sets up a music into Arkos Tracker Player to be played later on with cpct_akp_musicPlay.
void cpct_akp_musicInit (void* songdata)
(2B DE) songdata | Pointer to the start of the array containing song’s data in AKS binary format |
call cpct_akp_musicInit_asm
This function should be called fist to initialize the song that is to be played. The function reads the song header and sets up the player to start playing it. Once this process is done, cpct_akp_musicPlay should be called at the required frequency to continuously play the song.
AF, AF’, BC, DE, HL, IX, IY
92 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
To be done
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Stops playing musing and sound effects on all 3 channels.
void cpct_akp_stop ()
call cpct_akp_stop_asm
This function stops the music and sound effects playing in the 3 channels. It can be later continued again calling cpct_akp_musicPlay. Please, take into account that sound effects cannot be played while music is stopped, as code for sound effects and music play is integrated.
AF, AF’, BC, DE, HL, IX, IY
19 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
To be done
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Returns the number of the instrument which is playing SFX in the selected channel (0 = Channel free / not playing SFX).
u16 cpct_akp_SFXGetInstrument (u8 channel_bitmask)
call cpct_akp_SFXGetInstrument_asm
This function returns the number of the instrumeent which is playing in the given channel. You may use it to check the status of an FX reproduction. If this function returns a 0 it means that no SFX is playing on the channel (i.e. the channel is free for reproducing new SFXs).
AF, HL
25 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
Case | Cycles | microSecs (us) -------------------------------------- Best | 68 | 17.00 -------------------------------------- Worst | 82 | 20.50 -------------------------------------- Asm saving | -28 | -7.00 --------------------------------------
Initializes sound effect instruments to be able to play sound effects.
void cpct_akp_SFXInit (void* sfx_song_data)
(2B DE) sfx_song_data | Pointer to the start of a song file containing instrument data for SFX |
call cpct_akp_SFXInit_asm
This function initializes instruments that will be used later on to play FX sounds at will using cpct_akp_SFXPlay. In order for the instruments to be initialized, sfx_song_data must point to a song defined in AKS format. For the purpose of this function, the song only requires to have instruments defined in it, as patterns, notes and other information is not used for FX sounds.
You may use instruments from another song or a specific song containing instrument data only. Any song with instruments defined in it is valid to set up SFX with Arkos Tracker Player.
AF, DE, HL
14 bytes (+13 bytes from cpct_akp_SFXStopAll that comes next to this function and is used in initialization)
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
Case | Cycles | microSecs (us) -------------------------------- Any | 146 | 36.50 -------------------------------- Asm saving | -41 | -10.25 -------------------------------
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Stops the reproduction of any sound effect in the 3 channels.
void cpct_akp_SFXStopAll ()
call cpct_akp_SFXStopAll_asm
This function stops all sound FX reproduction on all the 3 sound channels.
HL
13 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
Case | Cycles | microSecs (us) -------------------------------- Any | 68 | 15.50 -------------------------------- Asm saving | 0 | 0 -------------------------------
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Plays a concrete sound effect, using the instruments of the “SFX song” given to cpct_akp_SFXInit when initializing sound effects.
void cpct_akp_SFXPlay (u8 sfx_num, u8 volume, u8 note, u8 speed, u16 inverted_pitch, u8 channel_bitmask)
(1B L ) sfx_num | Number of the instrument in the SFX Song (>0), same as the number given to the instrument in Arkos Tracker. |
(1B H ) volume | Volume [0-15], 0 = off, 15 = maximum volume. |
(1B E ) note | Note to be played with the given instrument [0-143] |
(1B D ) speed | Speed (0 = As original, [1-255] = new Speed (1 is fastest)) |
(2B BC) inverted_pitch | Inverted Pitch (-0xFFFF -> 0xFFFF). 0 is no pitch. The higher the pitch, the lower the sound. |
(1B A ) channel_bitmask | Bitmask representing channels to use for reproducing the sound (Ch.A = 001 (1), Ch.B = 010 (2), Ch.C = 100 (4)) |
call cpct_akp_SFXPlay_asm
Plays a given sound effect, along with the music, in a concrete channel and with some parameters (Volume, Note, Speed, Inverted Pitch). This lets you create lots of different (and potentially complex) sound effects from a set of instruments. In fact, you could play a song made of sound effect calls.
AF, BC, DE, HL,
95 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2089 bytes.
Case | Cycles | microSecs (us) -------------------------------------- Any | To be done -------------------------------------- Asm saving | -141 | -45.25 --------------------------------------
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Stops the reproduction sound FX on given channels
void cpct_akp_SFXStop (u8 stop_bitmask)
(1B A) stop_bitmask | A value where the 3 Least Significant Bits represent which channels to stop (bits enabled = channels to stop) |
call cpct_akp_SFXStop_asm
This function lets you selectively stop sound FX reproduction on one, two or the 3 available channels. A stop_bitmask is given as parameter containing the information about what channels shall be stopped.
AF, HL
30 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2082 bytes.
Case | Cycles | microSecs (us) -------------------------------- Best (0) | 101 | 25.25 -------------------------------- Best (1) | 149 | 37.25 -------------------------------- Asm saving | -28 | -7.00 --------------------------------
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.
Sets global volumes for creating fade in / out effects.
void cpct_akp_setFadeVolume (u8 volume)
(1B A) volume | Global volume for all channels, [0-15]. 0 = max volume, 16 or more = no volume |
call cpct_akp_setFadeVolume_asm
This function controls the global reproduction volume for all channels. This lets you do Fade in / out effects, by making the volume progressively go up or down.
AF, HL
15 bytes
However, take into account that all of Arkos Tracker Player’s functions are linked and included, because they depend on each other. Total memory requirement is around 2082 bytes.
Case | Cycles | microSecs (us) ------------------------------------- Any | 51 | 12.75 ------------------------------------- Asm saving | -28 | 7.00 -------------------------------------
This is a modification of the original Arkos Tracker Player code from Targhan / Arkos. Madram / Overlander and Grim / Arkos have also contributed to this source.