]> 4ch.mooo.com Git - 16.git/blobdiff - 16/16/opl2.h
refresh wwww
[16.git] / 16 / 16 / opl2.h
diff --git a/16/16/opl2.h b/16/16/opl2.h
new file mode 100755 (executable)
index 0000000..5c0a1cf
--- /dev/null
@@ -0,0 +1,101 @@
+#ifndef _DOSLIB_SND_H_\r
+#define _DOSLIB_SND_H_\r
+/* C Header File: ADLIB *****************************************************\r
+\r
+Author:   Kevin A. Lee\r
+\r
+Last Amended: 27th April, 1993\r
+\r
+Description:    Low-level interface to the Adlib (or compatible)\r
+    FM sound card. All information gleaned from\r
+    Jeffrey S. Lee's "Programming the Adlib/Sound\r
+    Blaster FM Music Chips". See Lee's document for\r
+    further information.\r
+\r
+Compiled succesfully under Turbo C, Borland C++,\r
+and Microsoft Quick C (all latest versions).\r
+\r
+****************************************************************************/\r
+#include "src\lib\lib_com.h"\r
+\r
+#define NUMVOICE 11\r
+#define FACTOR  1193180\r
+#define OCTAVE  4
+\r
+#define MIN_REGISTER                   0x01\r
+#define MAX_REGISTER                   0xF5\r
+#define ADLIB_FM_ADDRESS       0x388   /* adlib address/status register */\r
+#define ADLIB_FM_DATA          0x389   /* adlib data register           */\r
+\r
+/*\r
+static int percussiveMode = 0,currentBDContents = 0;\r
+//static int opTable[18] = {0,1,2,3,4,5,8,9,10,11,12,13,16,17,18,19,20,21};\r
+static int voiceModulator[11] = {0,1,2,6,7,8,12,16,14,17,13};\r
+static int voiceCarrier[9] = {3,4,5,9,10,11,15,16,17};\r
+*/\r
+\r
+/*\r
+* FM Instrument definition for .SBI files - SoundBlaster instrument\r
+* - these are the important parts - we will skip the header, but since\r
+*   I am not sure where it starts and ends so I have had to guess.\r
+*   However it SEEMS! to work. Each array has two values, one for\r
+*   each operator.\r
+*/\r
+typedef struct{\r
+       byte SoundCharacteristic[2];    /* modulator frequency multiple...  */\r
+       byte Level[2];                  /* modulator frequency level...     */\r
+       byte AttackDecay[2];            /* modulator attack/decay...        */\r
+       byte SustainRelease[2];         /* modulator sustain/release...     */\r
+       byte WaveSelect[2];             /* output waveform distortion       */\r
+       byte Feedback;                  /* feedback algorithm and strength  */\r
+} FMInstrument;\r
+\r
+/*\r
+* Enumerated F-Numbers (in octave 4) for the chromatic scale.\r
+*/\r
+/*enum oct{\r
+       B4 = 493.88,\r
+       B4b = 466.16,\r
+       A4 = 440,\r
+       A4b = 415.3,\r
+       G4 = 392,\r
+       G4b = 369.99,\r
+       F4 = 349.23,\r
+       E4 = 329.63,\r
+       E4b = 311.13,\r
+       D4 = 293.66,\r
+       D4b = 277.18,\r
+       C4 = 261.63,\r
+       A0 = 27.50\r
+};*/\r
+enum SCALE{\r
+       B4  = 0x1EE,\r
+       B4b = 0x1D2,\r
+       A4  = 440,\r
+       A4b = 0x19F,\r
+       G4 = 0x188,\r
+       G4b  = 0x172,\r
+       F4  = 0x15D,\r
+       E4  = 0x14A,\r
+       E4b  = 0x137,\r
+       D4  = 0x126,\r
+       D4b = 0x115,\r
+       C4  = 0x106,\r
+       A0 = 0x7F2\r
+};
+\r
+/* function prototyping */\r
+void WriteFM(int reg, int value);\r
+int ReadFM(void);\r
+int AdlibExists(void);\r
+void FMReset(/*int percusiveMode*/);   /* Resets the card, quiets all voices, sets the percussive mode state */\r
+void FMKeyOff(int voice);\r
+void FMKeyOn(int voice, int freq, int octave);\r
+void FMVoiceVolume(int voice, int vol);\r
+void FMSetVoice(int voiceNum, FMInstrument *ins);\r
+/* Remember: percussion instruments must be assigned only to the correct voice number. */\r
+//void FMSetPercusiveMode(int state);\r
+//int  LoadSBI(char filename[], FMInstrument *ins);\r
+void fmtest(void);
+int soundtest();\r
+#endif/*_DOSLIB_SND_H_*/
\ No newline at end of file