Package ui.sound

Class SoundDevice

java.lang.Object
ui.sound.SoundDevice

public class SoundDevice extends Object
A SOUND device to play sampled sound according to SMSQ/E's SSS specification. SMSQmulator's implementation of the SSSS only allows 20Kz stereo. This device allows some other sampling rates.

There are 9 "devices", SOUND1 to SOUND9:

  • 1 - 20 khz mono (default)
  • 2 - 20 khz stereo
  • 3 - 10 khz mono, with averaging
  • 4 - 10 khz stereo, with averaging
  • 5 - 40 khz mono, with averaging
  • 6 - 40 khz stereo, with averaging
  • 7 - 40 khz mono, every second byte is skipped
  • 8 - 40 khz stereo, every second byte pair is skipped
  • 9 - 40 Khz mono send alternate bytes left/right (crazy stuff)
"SOUND" defaults to SOUND1.

The sound itself is played via an independent thread.

This device only allow ONE channel to be open to it at a time.

The actual playback is handled by an independent thread from the SampledSound device

  • Constructor Details

    • SoundDevice

      public SoundDevice(SampledSound sam)
      Creates this object, a DataLine object and an independent thread for filling the DataLine.
      Parameters:
      sam - used for actual playback.
  • Method Details

    • openChannel

      public void openChannel(MC68000Cpu cpu)
      A new channel was opened to this device, start thread, but only if no channel is still open to this device.
      Parameters:
      cpu - the cpu used.
    • closeChannel

      public void closeChannel()
      Called when the sound channel is closed.
    • doIO

      public void doIO(MC68000Cpu cpu)
      Handle the IO calls. Only IOB.SBYT and IOB.SMUL are allowed.
      Parameters:
      cpu - the cpu used.
    • addBytes

      public void addBytes(MC68000Cpu cpu)
      Called to add bytes to the queue. on first call, D3 = 0, D2 = nbr of bytes on subsequent calls : D3 = -1; D1 = nbr of bytes A1 points to the data, updated on return D1 contains nbr of bytes on return
      Parameters:
      cpu - the cpu pointing to the data.