| 1 | // ---------------------------------------------------------------------------cxx . . $ `<file>/src/resid/voice.h`/ |
| 2 | // This file is part of reSID, a MOS6581 SID emulator engine. |
| 3 | // Copyright (C) 2004 Dag Lem <[email protected]> |
| 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 | #ifndef __VOICE_H__ |
| 21 | #define __VOICE_H__cxx . . $ `src/resid/voice.h:21:9`! |
| 22 | |
| 23 | #include "siddefs.h"cxx . . $ `<file>/src/resid/siddefs.h`/ |
| 24 | #include "wave.h"cxx . . $ `<file>/src/resid/wave.h`/ |
| 25 | #include "envelope.h"cxx . . $ `<file>/src/resid/envelope.h`/ |
| 26 | |
| 27 | class Voicecxx . . $ Voice# |
| 28 | { |
| 29 | public: |
| 30 | Voicecxx . . $ Voice#Voice(49f6e7a06ebc5aa8).(); |
| 31 | |
| 32 | void set_chip_modelcxx . . $ Voice#set_chip_model(cea143c94d31b99f).(chip_modelcxx . . $ chip_model# model); |
| 33 | void set_sync_sourcecxx . . $ Voice#set_sync_source(8857d55290c79f8).(Voicecxx . . $ Voice#*); |
| 34 | void resetcxx . . $ Voice#reset(49f6e7a06ebc5aa8).(); |
| 35 | |
| 36 | void writeCONTROL_REGcxx . . $ Voice#writeCONTROL_REG(cb2f890c2fdad230).(reg8cxx . . $ reg8#); |
| 37 | |
| 38 | // Amplitude modulated waveform output. |
| 39 | // Range [-2048*255, 2047*255]. |
| 40 | RESID_INLINEcxx . . $ `src/resid/siddefs.h:70:9`! sound_samplecxx . . $ sound_sample# outputcxx . . $ Voice#output(b126dc7c1de90089).(); |
| 41 | |
| 42 | protected: |
| 43 | WaveformGeneratorcxx . . $ WaveformGenerator# wavecxx . . $ Voice#wave.; |
| 44 | EnvelopeGeneratorcxx . . $ EnvelopeGenerator# envelopecxx . . $ Voice#envelope.; |
| 45 | |
| 46 | // Waveform D/A zero level. |
| 47 | sound_samplecxx . . $ sound_sample# wave_zerocxx . . $ Voice#wave_zero.; |
| 48 | |
| 49 | // Multiplying D/A DC offset. |
| 50 | sound_samplecxx . . $ sound_sample# voice_DCcxx . . $ Voice#voice_DC.; |
| 51 | |
| 52 | friend class SIDcxx . . $ SID#; |
| 53 | }; |
| 54 | |
| 55 | |
| 56 | // ---------------------------------------------------------------------------- |
| 57 | // Inline functions. |
| 58 | // The following function is defined inline because it is called every |
| 59 | // time a sample is calculated. |
| 60 | // ---------------------------------------------------------------------------- |
| 61 | |
| 62 | #if RESID_INLININGcxx . . $ `src/resid/siddefs.h:69:9`! || defined(__VOICE_CC__cxx . . $ `src/resid/voice.cpp:20:9`!) |
| 63 | |
| 64 | // ---------------------------------------------------------------------------- |
| 65 | // Amplitude modulated waveform output. |
| 66 | // Ideal range [-2048*255, 2047*255]. |
| 67 | // ---------------------------------------------------------------------------- |
| 68 | RESID_INLINEcxx . . $ `src/resid/siddefs.h:70:9`! |
| 69 | sound_samplecxx . . $ sound_sample# Voicecxx . . $ Voice#::outputcxx . . $ Voice#output(b126dc7c1de90089).() |
| 70 | { |
| 71 | // Multiply oscillator output with envelope output. |
| 72 | return (wavecxx . . $ Voice#wave..outputcxx . . $ WaveformGenerator#output(db52760e79bf9054).() - wave_zerocxx . . $ Voice#wave_zero.)*envelopecxx . . $ Voice#envelope..outputcxx . . $ EnvelopeGenerator#output(db52760e79bf9054).() + voice_DCcxx . . $ Voice#voice_DC.; |
| 73 | } |
| 74 | |
| 75 | #endif // RESID_INLINING || defined(__VOICE_CC__) |
| 76 | |
| 77 | #endif // not __VOICE_H__ |