libmsx
C library for MSX
Loading...
Searching...
No Matches

#include <audio_efx_amp.h> More...

+ Collaboration diagram for The AMP effector.:

Functions

void audio_efx_amp (void)
 MSX The AMP effector for the libmsx audio replayer.
 
void audio_efx_amp_set_volume (uint8_t volume)
 MSX Sets the main volume level to the AMP effector.
 
uint8_t audio_efx_amp_get_volume (void)
 MSX Gets the current main volume level from the AMP effector.
 
void audio_efx_amp_fadeout (uint8_t ticks)
 MSX Decrease the main volume level by one for each specified period of time.
 
void audio_efx_amp_fadein (uint8_t ticks)
 MSX Increase the main volume level by one for each specified period of time.
 
int8_t audio_efx_amp_get_fade (void)
 MSX Return the status of fade-in/out.
 

Detailed Description

#include <audio_efx_amp.h>

The AMP effector controls / attenuate the main-volume for all channels.

c
#include <msx.h>
#include <audio.h>
#include <audio_efx_amp.h>
// Custom VSYNC interrupt handler.
void play(void) {
// To use AMP effector, call `audio_efx_amp()` every after `audio_play()`.
}
void main(void) {
for (;;) {
// Get the current main-volume level.
uint8_t vol = audio_efx_amp_get_volume();
// ...
// Set the main-volume level to 10.
// ...
// Decrease the main-volume level every 3 ticks.
// (`0` means every ticks)
// ...
// Increase the main-volume level every 3 ticks.
// (`0` means every ticks)
// ...
}
}
The libmsx audio replayer.
The AMP effector.
void audio_efx_amp_fadein(uint8_t ticks)
MSX Increase the main volume level by one for each specified period of time.
void audio_efx_amp_fadeout(uint8_t ticks)
MSX Decrease the main volume level by one for each specified period of time.
void audio_efx_amp_set_volume(uint8_t volume)
MSX Sets the main volume level to the AMP effector.
uint8_t audio_efx_amp_get_volume(void)
MSX Gets the current main volume level from the AMP effector.
void audio_efx_amp(void)
MSX The AMP effector for the libmsx audio replayer.
void audio_init(void)
MSX Initialize the libmsx audio replayer.
void audio_play(void)
MSX Main routine of the libmsx audio replayer.
void await_vsync(void)
MSX Waits for next VSYNC interrupt.
void set_vsync_handler(void(*handler)(void))
MSX Register user defined VSYNC interrupt handler.
Using #include <msx.h> includes almost all C header files in libmsx, for ease to use.

Function Documentation

◆ audio_efx_amp()

void audio_efx_amp ( void  )

MSX The AMP effector for the libmsx audio replayer.

Calling this function each time after audio_play() will control or attenuate the main volume of all PSG, SCC/SCC+, and OPLL channels.

◆ audio_efx_amp_set_volume()

void audio_efx_amp_set_volume ( uint8_t  volume)

MSX Sets the main volume level to the AMP effector.

Parameters
volumeThe main volume level. (0..15)

◆ audio_efx_amp_get_volume()

uint8_t audio_efx_amp_get_volume ( void  )

MSX Gets the current main volume level from the AMP effector.

Returns
The current main volume level. (0..15)

◆ audio_efx_amp_fadeout()

void audio_efx_amp_fadeout ( uint8_t  ticks)

MSX Decrease the main volume level by one for each specified period of time.

(Fade out)

Fade out every ticks+1 VSYNC counts.

Parameters
ticksPeriod (VSYNC counts ; wait counts)

◆ audio_efx_amp_fadein()

void audio_efx_amp_fadein ( uint8_t  ticks)

MSX Increase the main volume level by one for each specified period of time.

(Fade in)

Fade in every ticks+1 VSYNC counts.

Parameters
ticksPeriod (VSYNC counts ; wait counts)

◆ audio_efx_amp_get_fade()

int8_t audio_efx_amp_get_fade ( void  )

MSX Return the status of fade-in/out.

Returns
The status of fade-in/out:
  • 0 if the main volume is constant,
  • negative during fade-out, and
  • positive during fade-in.