maug
Quick and dirty C mini-augmentation library.
Loading...
Searching...
No Matches
retrosnd.h File Reference

Abstraction layer header for sound on retro systems. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  RETROSND_CHANNEL
struct  RETROSND_TUNE
 Simple tune designed to be played on the software synthesizer. More...

Macros

#define RETROSND_CHANNEL_CT_MAX   4
#define RETROSND_TRACE_LVL   0
#define RETROSND_REG_TRACE_LVL   0
#define RETROSND_SAMPLES_CT   2048
#define RETROSND_FLAG_INIT   0x01
 Flag in RETROSND_STATE::flags indicating initialization was successful.
#define RETROSND_VOICE_BREATH   122
#define RETROSND_VOICE_SEASHORE   123
#define RETROSND_VOICE_BIRD_TWEET   124
#define RETROSND_VOICE_PHONE_RING   125
#define RETROSND_VOICE_HELICOPTER   126
#define RETROSND_VOICE_APPLAUSE   127
#define RETROSND_VOICE_GUNSHOT   128
 Parameter for retrosnd_set_voice() indicating a gunshot sound effect.
#define RETROSND_CONTROL_VOL   7
#define retrosnd_tune_get_note(tune, channel, idx)
#define RETROSND_TUNE_NOTE_DISABLED   (255)
#define RETROSND_NOTES_START   (36)
#define RETROSND_NOTES_OCTAVE_SZ   (12)
#define RETROSND_NOTES_SZ   (RETROSND_NOTES_OCTAVE_SZ * 3)
#define RETROSND_NOTES_OCTAVE_MIDDLE   (48)
#define RETROSND_NOTES_TABLE(f)
#define RETROSND_NOTES_TABLE_EXT_CONSTS(num, name)

Functions

MERROR_RETVAL retrosnd_init (struct RETROFLAT_ARGS *args)
 Initialize retrosnd engine.
void retrosnd_set_sf_bank (const char *filename_in)
 Set the name of the voice bank filename to use.
void retrosnd_set_voice (uint8_t channel, uint8_t voice)
void retrosnd_set_control (uint8_t channel, uint8_t key, uint8_t val)
void retrosnd_note_on (uint8_t channel, uint8_t pitch, uint8_t vel)
void retrosnd_note_off (uint8_t channel, uint8_t pitch, uint8_t vel)
void retrosnd_shutdown (void)
void retrosnd_pump (void)
void retrosnd_note_on_deadline (uint8_t channel, uint8_t pitch, retroflat_ms_t after)
MERROR_RETVAL retrosnd_tune_init (MAUG_MHANDLE *p_tune_h, size_t notes_ct, uint16_t ms_per_note)
MERROR_RETVAL retrosnd_tune_update (struct RETROSND_TUNE *tune)
 Update the currently playing note in the given tune.
void retrosnd_tune_seek (struct RETROSND_TUNE *tune, int8_t idx)
MERROR_RETVAL retrosnd_tune_set_note (struct RETROSND_TUNE *, int channel, int index, int8_t note)
int16_t _retrosnd_generate_note (struct RETROSND_CHANNEL *channels)
 Increment synthesizer phase based on its instrument and system settings.
MERROR_RETVAL _retrosnd_set_control (struct RETROSND_CHANNEL *channel, uint8_t key, uint8_t val)
 Set controls for the software synthesizer.

Detailed Description

Abstraction layer header for sound on retro systems.

RetroSound is a compatibility layer for making sound on various platforms, including Windows, MS-DOS or Linux.

To use, define RETROSND_C before including this header from your main.c.

You may include this header in other .c files, as well, but RETROSND_C should ONLY be declared ONCE in the entire program.

It is highly advised to use this in conjunction with retroflt.h.

maug.h should also be included before this header.

Special thanks to: "Programming the Adlib/Sound Blaster FM Music Chips" by Jeffrey S. Lee (https://bochs.sourceforge.io/techspec/adlib_sb.txt) and "The Gravis Ultrasound" by neuraldk (http://neuraldk.org/document.php?gus) for DOS platform-specific stuff.

And the MPU-401 interface for being so darn simple!

Macro Definition Documentation

◆ RETROSND_NOTES_TABLE_EXT_CONSTS

#define RETROSND_NOTES_TABLE_EXT_CONSTS ( num,
name )
Value:
extern MAUG_CONST int8_t RSN_ ## name;