Skip to content

Latest commit

 

History

History
178 lines (115 loc) · 5.82 KB

HOWTO.md

File metadata and controls

178 lines (115 loc) · 5.82 KB

How to use the PSG ayFX Player MSX SDCC Library


Index



1 Description

Library for launch sound effects for the PSG AY-3-8910 or compatible.

It is an adaptation of ayFX REPLAYER Fixed Volume v1.31 made by SapphiRe.

The names of the functions have been changed to adapt it to the nomenclature of the sound libraries of the fR3eL project.

To function it requires the AY38910BF library. The function that dumps the registers buffer to the sound processor (PlayAY), has been moved to AY38910BF library because it is applicable to other music libraries (such as PT3player). You also get the possibility of selecting to which sound processor the data processed by the players should be directed (internal or external AY).

Use them for developing MSX applications using Small Device C Compiler (SDCC).

This project is an Open Source library. You can add part or all of this code in your application development or include it in other libraries/engines.

This library is part of the MSX fR3eL Project.

Enjoy it!



2 Features

  • Designed for developing MSX applications using Small Device C Compiler (SDCC).
  • It does not use the BIOS so it can be used to program both ROMs or MSX-DOS executables.
  • Up to 256 effects per bank. Multiple banks can be defined and changed from the initialization function.
  • Priority parameter. The effects with the highest priority will be executed on the ones with the lowest.
  • 2 modes of operation:
    • Fixed. They will be heard on the indicated channel.
    • Cyclical. The ayFX sample will be mixed on a different PSG channel in each frame.


3 Requirements

3.1 For compile:

3.2 For create a FXs bank



4 AY Sound System

The AY38910BF, PT3player and ayFXplayer libraries are designed to work together, so you will have a system to provide music and effects in game development.

AY Sound System



5 Definitions

5.1 ayFX Operating modes

This parameter can be changed from the ayFX_Setup function or directly by writing in the static variable ayFX_MODE.

Label Value
ayFX_FIXED 0
ayFX_CYCLE 1


6 Functions

6.1 ayFX_Setup

ayFX_Setup
ayFX player setup
FunctionayFX_Setup(unsigned int BANKaddr, char mode, char channel)
Input[unsigned int]Samples Bank memory address
[char]mode (0=Fixed channel;0=Cycle channel)
[char]Channel number (0=A;1=B;2=C)
Output ---
Example:
ayFX_Setup((unsigned int) BANK00, ayFX_FIXED ,AY_Channel_C);

6.2 ayFX_SetChannel

ayFX_SetChannel
Change output channel (useful only in Fixed channel mode).
FunctionayFX_SetChannel(char channel)
Input[char]Channel number (0=A;1=B;2=C)
Output ---
Example:
VPRINTN("Alea iacta est",10);

6.3 ayFX_Play

ayFX_Play
Play FX
FunctionayFX_Play(char FXnumber, char FXpriority)
Input[char]FX to be played (0 to 255)
[char]FX priority (0 to 15)
Output[char]0: no errors, the new sample has been correctly initialized
1: priority error, there's a sample with higher priority being played
2: index error, the current bank don't have a sample with such index
Example:
ayFX_Play(5,0);

6.4 ayFX_Decode

ayFX_Decode
Generates the values of registers of a frame of the ayFX in progress.
It has to be executed in every frame, not necessarily in the interrupt routine.
FunctionayFX_Decode()
Input ---
Output ---
Examples:
ayFX_Decode();


7 How to use

coming soon...



Creative Commons License
This document is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.