Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ LOCAL_SRC_FILES := \
gme/Ym2612_GENS.cpp \
gme/Ym2612_MAME.cpp \
gme/ext/emu2413.c \
gme/ext/panning.c \
gme/gme.cpp

LOCAL_EXPORT_C_INCLUDES = $(LOCAL_PATH)
Expand Down
5 changes: 0 additions & 5 deletions gme/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ if(USE_GME_NSF OR USE_GME_NSFE)
Nes_Vrc7_Apu.h
ext/emu2413.c
ext/emu2413.h
ext/panning.c
ext/panning.h
ext/emutypes.h
ext/2413tone.h
ext/vrc7tone.h
Nsf_Emu.cpp
Nsf_Emu.h
)
Expand Down
19 changes: 6 additions & 13 deletions gme/Nes_Vrc7_Apu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ extern "C" {

#include "blargg_source.h"

static unsigned char vrc7_inst[(16 + 3) * 8] =
{
#include "ext/vrc7tone.h"
};

static int const period = 36; // NES CPU clocks per FM clock

Nes_Vrc7_Apu::Nes_Vrc7_Apu()
Expand All @@ -23,8 +18,8 @@ Nes_Vrc7_Apu::Nes_Vrc7_Apu()
blargg_err_t Nes_Vrc7_Apu::init()
{
CHECK_ALLOC( opll = OPLL_new( 3579545, 3579545 / 72 ) );
OPLL_SetChipMode((OPLL *) opll, 1);
OPLL_setPatch((OPLL *) opll, vrc7_inst);
OPLL_setChipType((OPLL *) opll, 1);
OPLL_resetPatch((OPLL *) opll, 1);

set_output( 0 );
volume( 1.0 );
Expand Down Expand Up @@ -170,14 +165,13 @@ void Nes_Vrc7_Apu::run_until( blip_time_t end_time )
blip_time_t time = next_time;
void* opll = this->opll; // cache
Blip_Buffer* const mono_output = mono.output;
e_int32 buffer [2];
e_int32* buffers[2] = {&buffer[0], &buffer[1]};
int32_t buffer [2];
if ( mono_output )
{
// optimal case
do
{
OPLL_calc_stereo( (OPLL *) opll, buffers, 1, -1 );
OPLL_calc_stereo( (OPLL *) opll, buffer );
int amp = buffer [0] + buffer [1];
int delta = amp - mono.last_amp;
if ( delta )
Expand All @@ -194,14 +188,13 @@ void Nes_Vrc7_Apu::run_until( blip_time_t end_time )
mono.last_amp = 0;
do
{
OPLL_advance( (OPLL *) opll );
OPLL_calc_stereo( (OPLL *) opll, buffer );
for ( int i = 0; i < osc_count; ++i )
{
Vrc7_Osc& osc = oscs [i];
if ( osc.output )
{
OPLL_calc_stereo( (OPLL *) opll, buffers, 1, i );
int amp = buffer [0] + buffer [1];
int amp = ((OPLL *) opll)->ch_out[i];
int delta = amp - osc.last_amp;
if ( delta )
{
Expand Down
20 changes: 0 additions & 20 deletions gme/ext/2413tone.h

This file was deleted.

130 changes: 130 additions & 0 deletions gme/ext/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# v1.5.9 (2022-09-21)
- Fix the envelope threshold for DAMP to ATTACK state transition (Issue #12).

# v1.5.7 (2022-09-14)
- Silence some pedantic warnings.
- Update minimum cmake version to 3.0.
- Fix the problem where min/max function conflict with the Visual C++ macros.

# v1.5.6 (2021-02-28)
- Update YMF281 ROM patches.

# v1.5.5 (2021-02-05)
- Fix the problem where the output sound is broken due to the mixing of integer and floating point types in the process of rate conversion calculation (degraded at v1.5.4).

# <s>v1.5.4 (2021 02-04)</s>
- Fix the problem where the internal sample rate is calculated as int instead of double.
- Replace older "OPLL_dump2patch" to "OPLL_dumpToPatch".

# v1.5.3 (2021 01-31)
- Change min/max macros to inline functions to suppress compiler errors/warnings.

# v1.5.2 (2020 03-04)
- Fix unused constants and variables.
- Fix comments.

# v1.5.1 (2020 02-18)
- Fix piano attack rate.

# v1.5.0 (2020 02-12)
- Fix the modulator decay rate of the acoustic bass patch.
- Fix the modulator's key-off release rate.
- Do not reset carrier's phase when modulator DP finishes.
- Remove deferred rhythm mode switching.
- Improve white noise emulation.

# v1.4.0 (2020 02-08)
- Refactor API and internals.
- Add OPLL_setChipType. OPLL_setChipMode is deprecated.

# v1.3.0 (2020 02-03)
- Add fine-grained panning (OPLL_setPanFine).

# v1.2.7 (2020 01-12)
- Reactivate output array of carrier slot for backward compatibility.

# v1.2.6 (2020 01-11)
- Fix [timing of envelope damping](https://github.com/digital-sound-antiques/emu2413/wiki/Envelope-Damp-and-KeyOn-Noise).

# v1.2.4 (2020 01-07)
- Fix top-cym and hi-hat calculation.

# v1.2.3 (2020 01-07)
- Remove modulator phase delay.

# v1.2.2 (2020 01-06)
- Fix envelope behavior if ARx4+Rks >= 60 is set during attack phase.
- Tweak ROM voice parameters.
- Refactor envelope generator.

# v1.2.0 (2020 01-05)
- Support mirror registers: 0x19-1f, 0x29-1f and 0x39-3f.
- Fix feedback model.

# v1.1.0 (2020 01-03)
Major Update: playback quality and emulation accuracy have been improved drastically.

- Improve [ROM instruments](https://github.com/digital-sound-antiques/emu2413/wiki/YM2413-Estimated-ROM-Instruments).
- Change dB-based sine and exp tables to log2-based.
- Improve damper rate when key-on.
- Improve pitch and amplitude modulator.
- Improve envelope generator.
- Fix the problem where key-on flags are not shared between rhythm and melody slots.
- Improve internal [sample rate converter](https://github.com/digital-sound-antiques/emu2413/wiki/Sample-Rate-Converter).
- Implement test register.
- Both [test mode](https://github.com/digital-sound-antiques/emu2413/wiki/DAC-in-test-mode) and [non-test mode](https://github.com/digital-sound-antiques/emu2413/wiki/Use-FM-channel-as-DAC) DAC patterns are supported.
- There are still very few VGMs using YM2413 DAC on the web. If you would like to test it, try [vgm-conv](https://github.com/digital-sound-antiques/vgm-conv) which is capable to generate DAC stream from YM2612 VGM files.
- Semantic versioning.
- Support VS2010 again.

# v0.74 (2019 10-24)

- Fix broken AM and PM waves.

# v0.73 (2019 10-22)

- Fix top-cym volume.

# v0.72 (2019 10-21)

- Fix critical bug on force damp routine.
- Fix top-cym, hi-hat waveform and white noise freq.

# v0.71 (2019 10-20)

- Fix too strong LPF on rate conversion.
- Improve shape of envelope in attack phase.

# v0.70 (2019 10-13)

- Force to damp before keyon
- Dump size changed from to 8 bytes per voice.
- Replaced snare, hi-hat, top-cym generator.

# v0.65 (2019 05-24)

- Fix YM2413 and VRC7 patches.

# v0.63 (2016 09-06)

- Support per-channel output.

# v0.62 (2015 12-13)

- Changed own integer types to C99 stdint.h types.

# v0.61 (2004 04-10)

- Added YMF281B tone (defined by Chabin).

# v0.30 (2001 01-16)

- 1st beta release.

# v0.20 (2001 01-15)

- 1st alpha release.

# v0.10 (2001 01-08)

- 1st experimental version.
14 changes: 10 additions & 4 deletions gme/ext/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# emu2413

A YM2413 emulator written in C by Mitsutaka Okazaki.
A YM2413 emulator written in C.

This is the version 0.61, tweaked by Chrosipher Snowhill (@kode54).
Audio demos are available at [MSXplay.com](https://msxplay.com)

If you looking latest version of this module, please visit this repository:
https://github.com/digital-sound-antiques/emu2413
# Acknowledgements
emu2413 refers to the following documents. The author would like to thank all the authors who have contributed to the writing of them.

- [YM2413 notes](http://www.smspower.org/Development/YM2413) by andete
- ymf262.c by Jarek Burczynski
- [VRC7 presets](https://siliconpr0n.org/archive/doku.php?id=vendor:yamaha:opl2#opll_vrc7_patch_format) by Nuke.YKT
- YMF281B presets by Chabin
- [plgDavid's YMF281 ROM patches](https://github.com/plgDavid/misc/wiki/Copyright-free-OPLL(x)-ROM-patches)
Loading
Loading