home *** CD-ROM | disk | FTP | other *** search
/ Large Pack of OldSkool DOS MOD Trackers / goattracker_2.73.zip / src / resid-fp / voicefp.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2014-07-23  |  3.2 KB  |  89 lines

  1. //  ---------------------------------------------------------------------------
  2. //  This file is part of reSID, a MOS6581 SID emulator engine.
  3. //  Copyright (C) 2004  Dag Lem <resid@nimrod.no>
  4. //
  5. //  This program is free software; you can redistribute it and/or modify
  6. //  it under the terms of the GNU General Public License as published by
  7. //  the Free Software Foundation; either version 2 of the License, or
  8. //  (at your option) any later version.
  9. //
  10. //  This program 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
  13. //  GNU General Public License for more details.
  14. //
  15. //  You should have received a copy of the GNU General Public License
  16. //  along with this program; if not, write to the Free Software
  17. //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18. //  ---------------------------------------------------------------------------
  19.  
  20. #include "voicefp.h"
  21.  
  22. // ----------------------------------------------------------------------------
  23. // Constructor.
  24. // ----------------------------------------------------------------------------
  25. VoiceFP::VoiceFP()
  26. {
  27.   set_chip_model(MOS6581);
  28. }
  29.  
  30. // ----------------------------------------------------------------------------
  31. // Set chip model.
  32. // ----------------------------------------------------------------------------
  33. void VoiceFP::set_chip_model(chip_model model)
  34. {
  35.   wave.set_chip_model(model);
  36.  
  37.   if (model == MOS6581) {
  38.     /* there is some level from each voice even if the env is down and osc
  39.      * is stopped. You can hear this by routing a voice into filter (filter
  40.      * should be kept disabled for this) as the master level changes. This
  41.      * tunable affects the volume of digis. */
  42.     voice_DC = static_cast<float>(0x800 * 0xff);
  43.     /* In 8580 the waveforms seem well centered, but on the 6581 there is some
  44.      * offset change as envelope grows, indicating that the waveforms are not
  45.      * perfectly centered. The likely cause for this is the follows:
  46.      *
  47.      * The waveform DAC generates a voltage between 5 and 12 V corresponding
  48.      * to oscillator state 0 .. 4095.
  49.      *
  50.      * The envelope DAC generates a voltage between waveform gen output and
  51.      * the 5V level.
  52.      *
  53.      * The outputs are amplified against the 12V voltage and sent to the
  54.      * mixer.
  55.      *
  56.      * The SID virtual ground is around 6.5 V. */
  57.   }
  58.   else {
  59.     voice_DC = 0.f;
  60.   }
  61. }
  62.  
  63. // ----------------------------------------------------------------------------
  64. // Register functions.
  65. // ----------------------------------------------------------------------------
  66. void VoiceFP::writeCONTROL_REG(WaveformGeneratorFP& source, reg8 control)
  67. {
  68.   wave.writeCONTROL_REG(source, control);
  69.   envelope.writeCONTROL_REG(control);
  70. }
  71.  
  72. // ----------------------------------------------------------------------------
  73. // SID reset.
  74. // ----------------------------------------------------------------------------
  75. void VoiceFP::reset()
  76. {
  77.   wave.reset();
  78.   envelope.reset();
  79. }
  80.  
  81.  
  82. // ----------------------------------------------------------------------------
  83. // VoiceFP mute.
  84. // ----------------------------------------------------------------------------
  85. void VoiceFP::mute(bool enable)
  86. {
  87.   envelope.mute(enable);
  88. }
  89.