Skip to content

natfeats nfapi audio

Thorsten Otto edited this page Jul 24, 2020 · 2 revisions

"AUDIO"

This is an interface that is allows audio playback without direct hardware access. SDL functions are used instead. It is intended to be called from supervisor mode only, eg. by zmagxsnd. It is implemented by ARAnyM.

  sub-ID 0 - supervisor allowed
  int32 nf_audio_version(void);

Returns the interface version number, currently 0x61.

  sub-ID 1 - supervisor allowed
  int32 nf_audio_open(int32 frequency, int32 format, int32 channels, uint32 len, void *buffer);
  • frequency: the frequency (samples-frames-per-second) of the source
  • format: the source format of the audio data; for more info see SDL_AudioFormat
  • channels: the number of channels in the source
  • len: the length of the source buffer
  • buffer: the source data

Initial audio state will be set to paused. Returns the actual format used.

  sub-ID 2 - supervisor allowed
  int32 nf_audio_close(void);

Stops playback.

  sub-ID 3 - supervisor allowed
  int32 nf_audio_pause(int32 pause);

Pauses or resumes audio playback. Returns 1.

  sub-ID 4 - supervisor allowed
  int32 nf_audio_status(void);

Returns the current state of audio playback, either 0 (SDL_AUDIO_STOPPED), 1 (SDL_AUDIO_PLAYING) or 2 (SDL_AUDIO_PAUSED).

  sub-ID 5 - supervisor allowed
  int32 nf_audio_volume(int32 volume);

Sets the volume for playback. Range is 0 (silence) to 128 (SDL_MIX_MAXVOLUME).

  sub-ID 6 - supervisor allowed
  int32 nf_audio_lock(void);

Directly corresponds to the XBIOS locksnd() function.

  sub-ID 7 - supervisor allowed
  int32 nf_audio_unlock(void);

Directly corresponds to the XBIOS unlocksnd() function.

  sub-ID 8 - supervisor allowed
  int32 nf_audio_getfrequency(void);

Returns the current input frequency.

  sub-ID 9 - supervisor allowed
  int32 nf_audio_getlen(void);

Returns the current input buffer size.

  sub-ID >=10 - supervisor allowed

Unknown sub-ids will return an code of -32.

Clone this wiki locally