opl.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * Adplug - Replayer for many OPL2/OPL3 audio file formats.
  3. * Copyright (C) 1999 - 2007 Simon Peter, <dn.tlp@gmx.net>, et al.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2.1 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. *
  19. * opl.h - OPL base class, by Simon Peter <dn.tlp@gmx.net>
  20. */
  21. #ifndef H_ADPLUG_OPL
  22. #define H_ADPLUG_OPL
  23. class Copl {
  24. public:
  25. typedef enum {
  26. TYPE_OPL2, TYPE_OPL3, TYPE_DUAL_OPL2
  27. } ChipType;
  28. Copl()
  29. : currChip(0), currType(TYPE_OPL2) {
  30. }
  31. virtual ~Copl() {
  32. }
  33. virtual void write(int reg, int val) {} // combined register select + data write
  34. virtual void setchip(int n) { // select OPL chip
  35. if (n < 2)
  36. currChip = n;
  37. }
  38. virtual int getchip() { // returns current OPL chip
  39. return currChip;
  40. }
  41. virtual void init(void) {} // reinitialize OPL chip(s)
  42. // return this OPL chip's type
  43. ChipType gettype() {
  44. return currType;
  45. }
  46. // Emulation only: fill buffer
  47. virtual void update(short *buf, int samples) {}
  48. protected:
  49. int currChip; // currently selected OPL chip number
  50. ChipType currType; // this OPL chip's type
  51. };
  52. #endif