AgsAudio.SoundResource

g AgsAudio.SoundResource AgsAudio.SoundResource GObject.GInterface GObject.GInterface GObject.GInterface->AgsAudio.SoundResource

Implementations:
 AgsAudio.IpatchSample, AgsAudio.SFZSample, AgsAudio.Sndfile

Methods

  close ()
  flush ()
  get_presets (channels, samplerate, buffer_size, format)
  info (frame_count, loop_start, loop_end)
  load ()
  open (filename)
  read (dbuffer, daudio_channels, audio_channel, frame_count, format)
  read_audio_signal (soundcard, audio_channel)
  read_wave (soundcard, audio_channel, x_offset, delay, attack)
  rw_open (filename, audio_channels, samplerate, create)
  seek (frame_count, whence)
  set_presets (channels, samplerate, buffer_size, format)
  write (sbuffer, saudio_channels, audio_channel, frame_count, format)

Virtual Methods

  do_close ()
  do_flush ()
  do_get_presets (channels, samplerate, buffer_size, format)
  do_info (frame_count, loop_start, loop_end)
  do_load ()
  do_open (filename)
  do_read (dbuffer, daudio_channels, audio_channel, frame_count, format)
  do_rw_open (filename, audio_channels, samplerate, create)
  do_seek (frame_count, whence)
  do_set_presets (channels, samplerate, buffer_size, format)
  do_write (sbuffer, saudio_channels, audio_channel, frame_count, format)

Properties

None

Signals

None

Fields

None

Class Details

class AgsAudio.SoundResource
Bases:GObject.GInterface
Structure:AgsAudio.SoundResourceInterface
close()

Close self.

New in version 3.0.0.

flush()

Flush self.

New in version 3.0.0.

get_presets(channels, samplerate, buffer_size, format)
Parameters:
  • channels (int) – return location of channels
  • samplerate (int) – return location of samplerate
  • buffer_size (int) – return location of buffer-size
  • format (int) – return location of format

Get presets of self.

New in version 3.0.0.

info(frame_count, loop_start, loop_end)
Parameters:
  • frame_count (int) – return location of frame count
  • loop_start (int) – return location of loop-start
  • loop_end (int) – return location of loop-end

Get information about self.

New in version 3.0.0.

load()

Load audio data of self.

New in version 3.0.0.

open(filename)
Parameters:filename (str) – the filename as string
Returns:True if operation was successful, otherwise False.
Return type:bool

Open self for reading and assign filename.

New in version 3.0.0.

read(dbuffer, daudio_channels, audio_channel, frame_count, format)
Parameters:
  • dbuffer (object or None) – the destination buffer
  • daudio_channels (int) – destination buffer audio channel count
  • audio_channel (int) – the audio channel to read
  • frame_count (int) – the frame count to read
  • format (int) – the format to read
Returns:

the count of frames actually read

Return type:

int

Read frame_count number of frames from self and copy the data to dbuffer using format by skipping daudio_channels.

New in version 3.0.0.

read_audio_signal(soundcard, audio_channel)
Parameters:
Returns:

a GLib.List-struct containing AgsAudio.AudioSignal

Return type:

[AgsAudio.AudioSignal]

Read audio signal from self.

New in version 3.0.0.

read_wave(soundcard, audio_channel, x_offset, delay, attack)
Parameters:
Returns:

a GLib.List-struct containing AgsAudio.Wave

Return type:

[AgsAudio.Wave]

Read wave from self.

New in version 3.0.0.

rw_open(filename, audio_channels, samplerate, create)
Parameters:
  • filename (str) – the filename as string
  • audio_channels (int) – the audio channels count
  • samplerate (int) – the samplerate
  • create (bool) – if True create file, otherwise don’t
Returns:

True if operation was successful, otherwise False.

Return type:

bool

Open self for reading/writing and assign filename. Setting create to True causes to create the file if it doesn’t exist.

New in version 3.0.0.

seek(frame_count, whence)
Parameters:
  • frame_count (int) – the frame count
  • whence (int) – SEEK_SET, SEEK_CUR or SEEK_END

Seek the self frame_count from whence.

New in version 3.0.0.

set_presets(channels, samplerate, buffer_size, format)
Parameters:
  • channels (int) – channels to set
  • samplerate (int) – samplerate to set
  • buffer_size (int) – buffer-size to set
  • format (int) – format to set

Set presets of self.

New in version 3.0.0.

write(sbuffer, saudio_channels, audio_channel, frame_count, format)
Parameters:
  • sbuffer (object or None) – the source buffer
  • saudio_channels (int) – source buffer audio channel count
  • audio_channel (int) – the audio channel
  • frame_count (int) – the frame count to write
  • format (int) – the format to write

Write sbuffer to self frame_count number of frames having format by skipping saudio_channels.

New in version 3.0.0.

do_close() virtual

Close sound_resource.

New in version 3.0.0.

do_flush() virtual

Flush sound_resource.

New in version 3.0.0.

do_get_presets(channels, samplerate, buffer_size, format) virtual
Parameters:
  • channels (int) – return location of channels
  • samplerate (int) – return location of samplerate
  • buffer_size (int) – return location of buffer-size
  • format (int) – return location of format

Get presets of sound_resource.

New in version 3.0.0.

do_info(frame_count, loop_start, loop_end) virtual
Parameters:
  • frame_count (int) – return location of frame count
  • loop_start (int) – return location of loop-start
  • loop_end (int) – return location of loop-end

Get information about sound_resource.

New in version 3.0.0.

do_load() virtual

Load audio data of sound_resource.

New in version 3.0.0.

do_open(filename) virtual
Parameters:filename (str) – the filename as string
Returns:True if operation was successful, otherwise False.
Return type:bool

Open sound_resource for reading and assign filename.

New in version 3.0.0.

do_read(dbuffer, daudio_channels, audio_channel, frame_count, format) virtual
Parameters:
  • dbuffer (object or None) – the destination buffer
  • daudio_channels (int) – destination buffer audio channel count
  • audio_channel (int) – the audio channel to read
  • frame_count (int) – the frame count to read
  • format (int) – the format to read
Returns:

the count of frames actually read

Return type:

int

Read frame_count number of frames from sound_resource and copy the data to dbuffer using format by skipping daudio_channels.

New in version 3.0.0.

do_rw_open(filename, audio_channels, samplerate, create) virtual
Parameters:
  • filename (str) – the filename as string
  • audio_channels (int) – the audio channels count
  • samplerate (int) – the samplerate
  • create (bool) – if True create file, otherwise don’t
Returns:

True if operation was successful, otherwise False.

Return type:

bool

Open sound_resource for reading/writing and assign filename. Setting create to True causes to create the file if it doesn’t exist.

New in version 3.0.0.

do_seek(frame_count, whence) virtual
Parameters:
  • frame_count (int) – the frame count
  • whence (int) – SEEK_SET, SEEK_CUR or SEEK_END

Seek the sound_resource frame_count from whence.

New in version 3.0.0.

do_set_presets(channels, samplerate, buffer_size, format) virtual
Parameters:
  • channels (int) – channels to set
  • samplerate (int) – samplerate to set
  • buffer_size (int) – buffer-size to set
  • format (int) – format to set

Set presets of sound_resource.

New in version 3.0.0.

do_write(sbuffer, saudio_channels, audio_channel, frame_count, format) virtual
Parameters:
  • sbuffer (object or None) – the source buffer
  • saudio_channels (int) – source buffer audio channel count
  • audio_channel (int) – the audio channel
  • frame_count (int) – the frame count to write
  • format (int) – the format to write

Write sbuffer to sound_resource frame_count number of frames having format by skipping saudio_channels.

New in version 3.0.0.