![]() |
MD_YM2413 Library
1.0
Library for Yahama YM2413 sound synthesizer
|
YM2413 emulator which provdes the methods from the emulator and which implements an Arduino Stream so that the generated sound can be read via readBytes(). More...
#include <YM2413Emulator.h>
Public Member Functions | |
YM2413Emulator (uint32_t sampleRate=SAMPLERATE, uint64_t clock=MSX_CLK) | |
void | begin () |
void | send (uint8_t addr, uint8_t data) |
uint8_t | channels () |
uint32_t | bitsPerSample () |
Bits per sample of audio result. | |
uint32_t | sampleRate () |
Sample Rate audo audio output result. | |
void | reset () |
void | resetPatch (uint8_t p) |
void | setSampleRate (uint32_t rate) |
void | setQuality (uint8_t q) |
void | setPan (uint32_t ch, uint8_t pan) |
void | setPanFine (uint32_t ch, float pan[2]) |
void | setChipType (uint8_t type) |
void | writeIO (uint32_t reg, uint8_t val) |
void | writeReg (uint32_t reg, uint8_t val) |
void | setPatch (const uint8_t *dump) |
void | forceRefresh () |
uint32_t | setMask (uint32_t mask) |
uint32_t | toggleMask (uint32_t mask) |
int16_t | getSampleMono () |
Calculates the next mono sample. More... | |
void | getSamplesStereo (int32_t *out) |
Calculates the next stereo samples () More... | |
OPLL * | opll () |
Provides a pointer to the OPLL object. | |
void | setBoost (uint8_t multiplier) |
The default volume might be too low, we allow to boost the volume by a defined factor. More... | |
int | available () |
size_t | readBytes (uint8_t *buffer, size_t len) |
bool | hasSound () |
int | availableForWrite () |
Write is not supported! | |
size_t | write (uint8_t) |
Write is not supported! | |
int | read () |
Read of single bytes is not supported! | |
int | peek () |
Read of single bytes is not supported! | |
![]() | |
MD_IODriver (const pin_t *D, pin_t we, pin_t a0) | |
Protected Types | |
enum | Functions { D0 =0 , D1 , D2 , D3 , P4 , D5 , D7 , WE , A0 } |
Friends | |
class | MD_YM2413 |
Additional Inherited Members | |
![]() | |
pin_t * | D = nullptr |
pin_t | we |
pin_t | a0 |
YM2413 emulator which provdes the methods from the emulator and which implements an Arduino Stream so that the generated sound can be read via readBytes().
It implements the MD_IODriver interface, so that it can be passed as argument to the constructor of MD_YM2413 API class.
void YM2413Emulator::forceRefresh | ( | ) |
Force to refresh. External program should call this function after updating patch parameters.
int16_t YM2413Emulator::getSampleMono | ( | ) |
Calculates the next mono sample.
void YM2413Emulator::getSamplesStereo | ( | int32_t * | out | ) |
Calculates the next stereo samples ()
out |
size_t YM2413Emulator::readBytes | ( | uint8_t * | buffer, |
size_t | len | ||
) |
Returns the audio data as byte stream
void YM2413Emulator::setBoost | ( | uint8_t | multiplier | ) |
The default volume might be too low, we allow to boost the volume by a defined factor.
multiplier |
void YM2413Emulator::setChipType | ( | uint8_t | type | ) |
Set chip type. If vrc7 is selected, r#14 is ignored. This method not change the current ROM patch set. To change ROM patch set, use OPLL_resetPatch.
type | 0:YM2413 1:VRC7 |
uint32_t YM2413Emulator::setMask | ( | uint32_t | mask | ) |
Set channel mask
mask | mask flag: OPLL_MASK_* can be used.
|
void YM2413Emulator::setPan | ( | uint32_t | ch, |
uint8_t | pan | ||
) |
Set pan pot (extra function - not YM2413 chip feature)
ch | 0..8:tone 9:bd 10:hh 11:sd 12:tom 13:cym 14,15:reserved |
pan | 0:mute 1:right 2:left 3:center pan: 76543210
|+- bit 1: enable Left output
+-- bit 0: enable Right output
|
void YM2413Emulator::setPanFine | ( | uint32_t | ch, |
float | pan[2] | ||
) |
Set fine-grained panning
ch | 0..8:tone 9:bd 10:hh 11:sd 12:tom 13:cym 14,15:reserved |
pan | output strength of left/right channel. pan[0]: left, pan[1]: right. pan[0]=pan[1]=1.0f for center. |
void YM2413Emulator::setPatch | ( | const uint8_t * | dump | ) |
Defines the actual patch
void YM2413Emulator::setQuality | ( | uint8_t | q | ) |
Set internal calcuration quality. Currently no effects, just for compatibility. >= v1.0.0 always synthesizes internal output at clock/72 Hz.
void YM2413Emulator::setSampleRate | ( | uint32_t | rate | ) |
Set output wave sampling rate.
rate | sampling rate. If clock / 72 (typically 49716 or 49715 at 3.58MHz) is set, the internal rate converter is disabled. |
uint32_t YM2413Emulator::toggleMask | ( | uint32_t | mask | ) |
Toggler channel mask flag
void YM2413Emulator::writeIO | ( | uint32_t | reg, |
uint8_t | val | ||
) |
Writes a register or value
void YM2413Emulator::writeReg | ( | uint32_t | reg, |
uint8_t | val | ||
) |
Updates a register with the indicated value