Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support compiling as DLL on Windows #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions opl3.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define OPL_SHARED_LIB_SRC
#include "opl3.h"

#if OPL_ENABLE_STEREOEXT && !defined OPL_SIN
Expand Down
32 changes: 23 additions & 9 deletions opl3.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,20 @@
#ifndef OPL_OPL3_H
#define OPL_OPL3_H

#if defined(OPL_SHARED_LIB) && defined(WIN32)

#ifdef OPL_SHARED_LIB_SRC
#define OPL_API __declspec(dllexport)
#else
#define OPL_API __declspec(dllimport)
#endif

#else

#define OPL_API

#endif

#ifdef __cplusplus
extern "C" {
#endif
Expand Down Expand Up @@ -154,16 +168,16 @@ struct _opl3_chip {
opl3_writebuf writebuf[OPL_WRITEBUF_SIZE];
};

void OPL3_Generate(opl3_chip *chip, int16_t *buf);
void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf);
void OPL3_Reset(opl3_chip *chip, uint32_t samplerate);
void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v);
void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v);
void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples);
OPL_API void OPL3_Generate(opl3_chip *chip, int16_t *buf);
OPL_API void OPL3_GenerateResampled(opl3_chip *chip, int16_t *buf);
OPL_API void OPL3_Reset(opl3_chip *chip, uint32_t samplerate);
OPL_API void OPL3_WriteReg(opl3_chip *chip, uint16_t reg, uint8_t v);
OPL_API void OPL3_WriteRegBuffered(opl3_chip *chip, uint16_t reg, uint8_t v);
OPL_API void OPL3_GenerateStream(opl3_chip *chip, int16_t *sndptr, uint32_t numsamples);

void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4);
void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4);
void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples);
OPL_API void OPL3_Generate4Ch(opl3_chip *chip, int16_t *buf4);
OPL_API void OPL3_Generate4ChResampled(opl3_chip *chip, int16_t *buf4);
OPL_API void OPL3_Generate4ChStream(opl3_chip *chip, int16_t *sndptr1, int16_t *sndptr2, uint32_t numsamples);

#ifdef __cplusplus
}
Expand Down