Coder Social home page Coder Social logo

woody-opl's Introduction

"Woody" OPL3 emulator
=====================

this is the so-called woody opl3 emulator, ripped from DOSBOX svn rev 4391
(November 2020), with full commit history and some tiny touch-ups to make
it compile as C instead of C++.

many adlib/OPL-playing programs use some version of this emulator, but with
C++ and CMake crap added to it, because windows users have been brainwashed
into believing C is inferior to C++, particulary because MSVC++ doesn't even
properly support C. what they don't know is that C compiles a lot faster,
is much simpler and has much more widespread toolchain support.
apart from that it has a stable ABI, and allows to produce much slimmer
executables because libstdc++ (the C++ standard library) doesn't need to
be linked against the executable.

Usage:
======

drop files into your project, include opl.h, and use in your code:

    // initialize the chip(s). samplerate is typicallly 44100.
    adlib_init(samplerate);

    // write a value into a register.
    adlib_write(reg, val);

    // get a sample from the chip.
    int16_t sample;
    adlib_getsample(&sample, 1);

then compile it and link opl.c to your code.
that's pretty much all there is to it.

check https://github.com/digital-sound-antiques/emu2413/blob/master/sample2413.c
for a good example of what and how to feed into the chip, and when to read
samples (and how many) from it.
although the example uses a different chip emulator, the strategy is identical.


License
=======
unfortunately, the code is licensed as LGPL 2.1.

TODO
====
currently the code is not library-safe, as it uses global variables.
optimally all global state is put into a "context" struct and a pointer to
the struct passed to all functions that need access to those variables.
also it would be nice to poke the original authors whether they could relicense
the code as MIT.

woody-opl's People

Contributors

rofl0r avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

knpfalcon

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.