Package builder.resid

Klasse SIDMixer

java.lang.Object
builder.resid.SIDMixer
Alle implementierten Schnittstellen:
Mixer
Bekannte direkte Unterklassen:
ReSIDBuilder

public class SIDMixer extends Object implements Mixer
Mixer to mix SIDs sample data into the audio buffer.
Autor:
ken
  • Felddetails

    • VOLUME_SCALER

      static final int VOLUME_SCALER
      Scaler to use fast int multiplication while setting volume.
      Siehe auch:
    • context

      protected final EventScheduler context
      System event context.
    • config

      protected final IConfig config
      Configuration
    • cpuClock

      protected final CPUClock cpuClock
      CPU clock.
    • sids

      protected final List<ReSIDBase> sids
      SIDs to mix their sound output.
    • cart

      private Cartridge cart
      Cartridge that could possibly add sound to the mix
    • mixerAudio

      private final SIDMixer.MixerEvent mixerAudio
      Mixer clocking SID chips and producing audio output.
    • audioBufferL

      private IntBuffer audioBufferL
      Audio buffers for two channels (stereo).
    • audioBufferR

      private IntBuffer audioBufferR
      Audio buffers for two channels (stereo).
    • bufferSize

      private int bufferSize
      Capacity of the Audio buffers audioBufferL and audioBufferR.
    • emptyBuffer

      private int[] emptyBuffer
    • resamplerL

      private final Resampler resamplerL
      Resampler of sample output for two channels (stereo).
    • resamplerR

      private final Resampler resamplerR
      Resampler of sample output for two channels (stereo).
    • audioDriver

      private AudioDriver audioDriver
      Audio driver
    • volume

      private final int[] volume
      Volume of all SIDs.
    • positionL

      private final float[] positionL
      SID audibility on the left speaker of all SIDs 0(silent)..1(loud).
    • positionR

      private final float[] positionR
      SID audibility on the right speaker of all SIDs 0(silent)..1(loud).
    • delayInSamples

      private final int[] delayInSamples
      Delay in samples of all SIDs.
    • fadeInFadeOutEnabled

      private final boolean fadeInFadeOutEnabled
      Fade-in/fade-out enabled.
    • whatsSidEnabled

      private boolean whatsSidEnabled
      WhatsSid enabled?
    • whatsSidSupport

      private final WhatsSidSupport whatsSidSupport
      WhatsSID
    • audioProcessors

      private List<AudioProcessor> audioProcessors
      Add some audio post processing.
    • buffer

      private ByteBuffer buffer
      Audio driver buffer.
  • Konstruktordetails

  • Methodendetails

    • setAudioDriver

      public void setAudioDriver(AudioDriver audioDriver)
      Set audio driver for mixing
    • start

      public void start()
      Starts mixing the outputs of several SIDs.
      Angegeben von:
      start in Schnittstelle Mixer
    • fadeIn

      public void fadeIn(double fadeIn)
      Fade-in start time reached, audio volume should be increased to the max.
      Angegeben von:
      fadeIn in Schnittstelle Mixer
      Parameter:
      fadeIn - Fade-in time in seconds
    • fadeOut

      public void fadeOut(double fadeOut)
      Fade-out start time reached, audio volume should be lowered to zero.
      Angegeben von:
      fadeOut in Schnittstelle Mixer
      Parameter:
      fadeOut - Fade-out time in seconds
    • add

      public void add(SidTune tune, int sidNum, ReSIDBase sid)
      Add a SID to the mix.
      Parameter:
      sidNum - SID chip number
      sid - SID to add
    • remove

      public void remove(ReSIDBase sid)
      Remove SID from the mix.
      Parameter:
      sid - SID to remove
    • setVolume

      public void setVolume(int sidNum, float volumeInDB)
      Sets the volume of the SID chip.

      The volume is specified in decibels (dB), which is a logarithmic unit used to describe ratios, typically of power or amplitude.

      For power ratios, decibels are calculated as:
      dB = 10 * log10(P2 / P1)

      For amplitude (voltage, signal, or sample value) ratios — as used here — decibels are calculated as:
      dB = 20 * log10(A2 / A1)

      This function assumes an amplitude-based interpretation, suitable for audio sample scaling.

      Angegeben von:
      setVolume in Schnittstelle Mixer
      Parameter:
      sidNum - SID chip number
      volumeInDB - Volume adjustment in decibels (range: -6 dB to +6 dB)
      Siehe auch:
    • decibelsToCentibels

      public static int decibelsToCentibels(float decibel)
      Decibel to centibel conversion.
      Parameter:
      decibel - decibel value
      Gibt zurück:
      centibel value
    • setBalance

      public void setBalance(int sidNum, float balance)
      Set left/right speaker balance for each SID.
      Angegeben von:
      setBalance in Schnittstelle Mixer
      Parameter:
      sidNum - SID chip number
      balance - balance 0(left speaker)..0.5(centered)..1(right speaker)
    • setDelay

      public void setDelay(int sidNum, int delay)
      Delay feature: Delaying SID chip sound samples by time in milliseconds
      Angegeben von:
      setDelay in Schnittstelle Mixer
      Parameter:
      sidNum - SID chip number
      delay - delay in ms (0..50)
    • createSampleMixer

      private SampleMixer createSampleMixer(IntBuffer intBufferL, IntBuffer intBufferR)
      Create a new sample value mixer.
      Parameter:
      intBufferL - buffer of left speaker
      intBufferR - buffer of right speaker
    • updateSampleMixerVolume

      private void updateSampleMixerVolume()
      Set the sample mixer volume to the calculated balanced volume level.
      Mono output: Use volume.
      Stereo or 3-SID output: Use speaker audibility and volume.
    • isFakeStereo

      private boolean isFakeStereo()
      Gibt zurück:
      is fake stereo enabled?
    • fastForward

      public void fastForward()
      Doubles speed factor.
      Angegeben von:
      fastForward in Schnittstelle Mixer
    • normalSpeed

      public void normalSpeed()
      Use normal speed factor.
      Angegeben von:
      normalSpeed in Schnittstelle Mixer
    • isFastForward

      public boolean isFastForward()
      Angegeben von:
      isFastForward in Schnittstelle Mixer
      Gibt zurück:
      speed factor is used?
    • getFastForwardBitMask

      public int getFastForwardBitMask()
      Angegeben von:
      getFastForwardBitMask in Schnittstelle Mixer
      Gibt zurück:
      bit mask of current speed factor (1 << 0 = 1x, 1 << 1 = 2x, ... , 1 << 5 = 32x) - 1
    • getWhatsSidSupport

      public WhatsSidSupport getWhatsSidSupport()
    • setWhatsSidEnabled

      public void setWhatsSidEnabled(boolean whatsSidEnabled)