Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD

## api
Class Nes::Api::Sound

    Base
       |
       +--Nes::Api::Sound

class Nes::Api::Sound
extends Base

Sound interface.

Inner Classes, Typedefs, and Enums
`enum` | `Nes::Api::Sound::Channel` Sound channel types.
`typedef` | `Nes::Api::Sound::Output` Sound output context.
`enum` | `Nes::Api::Sound::Speaker` Speaker type.

Constructor Summary
`Sound( T& instance )` Interface constructor.

Method Summary
`void` | `EmptyBuffer()` Empties the internal sound buffer.
`uint` | `GetSampleBits() const` Returns the sample bits.
`ulong` | `GetSampleRate() const` Returns the sample rate.
`Nes::Api::Sound::Speaker` | `GetSpeaker() const` Returns the speaker type.
`uint` | `GetSpeed() const` Returns the current speed.
`uint` | `GetVolume( uint channel ) const` Returns the volume of a channel.
`bool` | `IsAudible() const` Checks if sound is audible at all.
`bool` | `IsAutoTransposing() const` Checks if automatic transposing is enabled.
`bool` | `IsMuted() const` Checks if sound is muted.
`void` | `Mute( bool mute )` Mutes all sound.
`void` | `SetAutoTranspose( bool state )` Enables automatic transposition.
`Result` | `SetSampleBits( uint bits )` Sets the sample bits.
`Result` | `SetSampleRate( ulong rate )` Sets the sample rate.
`void` | `SetSpeaker( Nes::Api::Sound::Speaker speaker )` Sets the speaker type.
`Result` | `SetSpeed( uint speed )` Sets the speed.
`Result` | `SetVolume( uint channels, uint volume )` Sets one or more channel volumes.

Constructor Detail

### Sound

    public Sound( T& instance );

  Interface constructor.

Parameters:
  `instance` - emulator instance

Method Detail

### EmptyBuffer

    public void EmptyBuffer() throw();

  Empties the internal sound buffer.

### GetSampleBits

    public uint GetSampleBits() const throw();

  Returns the sample bits.

Returns:
  number

### GetSampleRate

    public ulong GetSampleRate() const throw();

  Returns the sample rate.

Returns:
  sample rate

### GetSpeaker

    public Nes::Api::Sound::Speaker GetSpeaker() const throw();

  Returns the speaker type.

Returns:
  speaker type

### GetSpeed

    public uint GetSpeed() const throw();

  Returns the current speed.

Returns:
  speed

### GetVolume

    public uint GetVolume( uint channel ) const throw();

  Returns the volume of a channel.

Parameters:
  `channel` - channel
Returns:
  volume

### IsAudible

    public bool IsAudible() const throw();

  Checks if sound is audible at all.

Returns:
  true if audible

### IsAutoTransposing

    public bool IsAutoTransposing() const throw();

  Checks if automatic transposing is enabled.

Returns:
  true if enabled

### IsMuted

    public bool IsMuted() const throw();

  Checks if sound is muted.

Returns:
  true if muted

### Mute

    public void Mute( bool mute ) throw();

  Mutes all sound.

Parameters:
  `mute` - true to mute sound

### SetAutoTranspose

    public void SetAutoTranspose( bool state ) throw();

  Enables automatic transposition.

Parameters:
  `state` - true to enable

### SetSampleBits

    public Result SetSampleBits( uint bits ) throw();

  Sets the sample bits.

Parameters:
  `bits` - value of 8 or 16, default is 16
Returns:
  result code

### SetSampleRate

    public Result SetSampleRate( ulong rate ) throw();

  Sets the sample rate.

Parameters:
  `rate` - value in the range 11025 to 96000, default is 44100
Returns:
  result code

### SetSpeaker

    public void SetSpeaker( Nes::Api::Sound::Speaker speaker ) throw();

  Sets the speaker type.

Parameters:
  `speaker` - speaker type, default is SPEAKER_MONO

### SetSpeed

    public Result SetSpeed( uint speed ) throw();

  Sets the speed.

Parameters:
  `speed` - speed in the range 30 to 240, set to DEFAULT_SPEED for automatic adjustment
Returns:
  result code

### SetVolume

    public Result SetVolume( uint channels, uint volume ) throw();

  Sets one or more channel volumes.

Parameters:
  `channels` - OR:ed channels
  `volume` - volume in the range 0 to 100, default is 85
Returns:
  result code

Overview | Project | Class | Tree | Deprecated | Index

Nestopia Core API

FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD