2011-07-14 00:49:52 +02:00
|
|
|
/* Fast sound synthesis buffer for use in real-time emulators of electronic
|
|
|
|
sound generator chips like those in early video game consoles. Uses linear
|
|
|
|
interpolation. Higher-quality versions are available that use sinc-based
|
|
|
|
band-limited synthesis. */
|
|
|
|
|
|
|
|
#ifndef BLIP_H
|
|
|
|
#define BLIP_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Creates a new blip_buffer with specified input clock rate, output
|
|
|
|
sample rate, and size (in samples), or returns NULL if out of memory. */
|
|
|
|
typedef struct blip_buffer_t blip_buffer_t;
|
|
|
|
blip_buffer_t* blip_alloc( double clock_rate, double sample_rate, int size );
|
|
|
|
|
|
|
|
/* Frees memory used by a blip_buffer. No effect if NULL is passed. */
|
|
|
|
void blip_free( blip_buffer_t* );
|
|
|
|
|
|
|
|
/* Removes all samples and clears buffer. */
|
|
|
|
void blip_clear( blip_buffer_t* );
|
|
|
|
|
|
|
|
/* Adds an amplitude transition of delta at specified time in source clocks.
|
|
|
|
Delta can be negative. */
|
|
|
|
void blip_add( blip_buffer_t*, int time, int delta );
|
|
|
|
|
|
|
|
/* Number of additional clocks needed until n samples will be available.
|
|
|
|
If buffer cannot even hold n samples, returns number of clocks until buffer
|
|
|
|
becomes full. */
|
|
|
|
int blip_clocks_needed( const blip_buffer_t*, int samples_needed );
|
|
|
|
|
|
|
|
/* Ends current time frame of specified duration and make its samples available
|
|
|
|
(along with any still-unread samples) for reading with read_samples(), then
|
|
|
|
begins a new time frame at the end of the current frame. */
|
|
|
|
void blip_end_frame( blip_buffer_t*, int duration );
|
|
|
|
|
|
|
|
/* Number of samples available for reading with read(). */
|
|
|
|
int blip_samples_avail( const blip_buffer_t* );
|
|
|
|
|
|
|
|
/* Reads at most n samples out of buffer into out, removing them from from
|
2012-01-15 20:59:13 +01:00
|
|
|
the buffer. */
|
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
[Core/SCD]
----------
* added Mega CD / Sega CD hardware emulation (incl. Sub 68K, CDD, CDC, PCM, GFX
rotation/scaling, etc)
* added .ISO & .BIN CD image file support
* added 512K backup cartridge RAM support
* added savestate support for CD games
NOTES:
~~~~~~
* to play CD games, original BIOS ROM files are required in /genplus/bios/
directory: unzip & rename them to bios_CD_U.bin, bios_CD_E.bin, bios_CD_J.bin
* CD audio tracks (CD-DA) are not supported (yet)
[Core/CPU]
----------
* modified 68k core for Mega CD / Sega CD support
[Core/VDP]
---------------
* improved DMA accuracy
* added support for 8-bit VRAM writes with undocumented code value (verified on
real hardware by Nemesis)
[Gamecube/Wii]
---------------
* modified Master System & Game Gear "BIOS" support (files should be named
bios_U.sms, bios_J.sms, bios_E.sms & bios.gg and copied to /genplus/bios
directory).
* replaced "Hard Reset" button by a Soft Reset for systems having a Reset button
(Mega Drive / Genesis & Master System)
* State & SRAM files are now only compressed when saving to Gamecube Memory
Cards
* various fixes & cleanup.
2012-07-05 21:22:12 +02:00
|
|
|
int blip_read_samples( blip_buffer_t*, short out [], int stereo);
|
2011-07-14 00:49:52 +02:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|