AgsSoundResource

AgsSoundResource — read/write audio

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── AgsSoundResource

Known Implementations

AgsSoundResource is implemented by AgsIpatchSample, AgsSFZSample and AgsSndfile.

Includes

#include <ags/audio/file/ags_sound_resource.h>

Description

The AgsSoundResource interface gives you a unique access to file related IO operations.

Functions

ags_sound_resource_open ()

gboolean
ags_sound_resource_open (AgsSoundResource *sound_resource,
                         gchar *filename);

Open sound_resource for reading and assign filename.

Parameters

sound_resource

the AgsSoundResource

 

filename

the filename as string

 

Returns

TRUE if operation was successful, otherwise FALSE.

Since: 3.0.0


ags_sound_resource_rw_open ()

gboolean
ags_sound_resource_rw_open (AgsSoundResource *sound_resource,
                            gchar *filename,
                            guint audio_channels,
                            guint samplerate,
                            gboolean create);

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

Parameters

sound_resource

the AgsSoundResource

 

filename

the filename as string

 

audio_channels

the audio channels count

 

samplerate

the samplerate

 

create

if TRUE create file, otherwise don't

 

Returns

TRUE if operation was successful, otherwise FALSE.

Since: 3.0.0


ags_sound_resource_load ()

void
ags_sound_resource_load (AgsSoundResource *sound_resource);

Load audio data of sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

Since: 3.0.0


ags_sound_resource_info ()

void
ags_sound_resource_info (AgsSoundResource *sound_resource,
                         guint *frame_count,
                         guint *loop_start,
                         guint *loop_end);

Get information about sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

frame_count

return location of frame count

 

loop_start

return location of loop-start

 

loop_end

return location of loop-end

 

Since: 3.0.0


ags_sound_resource_set_presets ()

void
ags_sound_resource_set_presets (AgsSoundResource *sound_resource,
                                guint channels,
                                guint samplerate,
                                guint buffer_size,
                                guint format);

Set presets of sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

channels

channels to set

 

samplerate

samplerate to set

 

buffer_size

buffer-size to set

 

format

format to set

 

Since: 3.0.0


ags_sound_resource_get_presets ()

void
ags_sound_resource_get_presets (AgsSoundResource *sound_resource,
                                guint *channels,
                                guint *samplerate,
                                guint *buffer_size,
                                guint *format);

Get presets of sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

channels

return location of channels

 

samplerate

return location of samplerate

 

buffer_size

return location of buffer-size

 

format

return location of format

 

Since: 3.0.0


ags_sound_resource_read ()

guint
ags_sound_resource_read (AgsSoundResource *sound_resource,
                         void *dbuffer,
                         guint daudio_channels,
                         guint audio_channel,
                         guint frame_count,
                         guint format);

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

Parameters

sound_resource

the AgsSoundResource

 

dbuffer

the destination buffer

 

daudio_channels

destination buffer audio channel count

 

audio_channel

the audio channel to read

 

frame_count

the frame count to read

 

format

the format to read

 

Returns

the count of frames actually read

Since: 3.0.0


ags_sound_resource_write ()

void
ags_sound_resource_write (AgsSoundResource *sound_resource,
                          void *sbuffer,
                          guint saudio_channels,
                          guint audio_channel,
                          guint frame_count,
                          guint format);

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

Parameters

sound_resource

the AgsSoundResource

 

sbuffer

the source buffer

 

saudio_channels

source buffer audio channel count

 

audio_channel

the audio channel

 

frame_count

the frame count to write

 

format

the format to write

 

Since: 3.0.0


ags_sound_resource_flush ()

void
ags_sound_resource_flush (AgsSoundResource *sound_resource);

Flush sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

Since: 3.0.0


ags_sound_resource_seek ()

void
ags_sound_resource_seek (AgsSoundResource *sound_resource,
                         gint64 frame_count,
                         gint whence);

Seek the sound_resource frame_count from whence .

Parameters

sound_resource

the AgsSoundResource

 

frame_count

the frame count

 

whence

SEEK_SET, SEEK_CUR or SEEK_END

 

Since: 3.0.0


ags_sound_resource_read_audio_signal ()

GList *
ags_sound_resource_read_audio_signal (AgsSoundResource *sound_resource,
                                      GObject *soundcard,
                                      gint audio_channel);

Read audio signal from sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

soundcard

the AgsSoundcard

 

audio_channel

the audio channel or -1 for all

 

Returns

a GList containing AgsAudioSignal.

[element-type AgsAudio.AudioSignal][transfer full]

Since: 3.0.0


ags_sound_resource_read_wave ()

GList *
ags_sound_resource_read_wave (AgsSoundResource *sound_resource,
                              GObject *soundcard,
                              gint audio_channel,
                              guint64 x_offset,
                              gdouble delay,
                              guint attack);

Read wave from sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

soundcard

the AgsSoundcard

 

audio_channel

the audio channel or -1 for all

 

x_offset

the x offset

 

delay

the delay

 

attack

the attack

 

Returns

a GList containing AgsWave.

[element-type AgsAudio.Wave][transfer full]

Since: 3.0.0


ags_sound_resource_close ()

void
ags_sound_resource_close (AgsSoundResource *sound_resource);

Close sound_resource .

Parameters

sound_resource

the AgsSoundResource

 

Since: 3.0.0


AGS_IS_SOUND_RESOURCE()

#define AGS_IS_SOUND_RESOURCE(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_SOUND_RESOURCE))

AGS_IS_SOUND_RESOURCE_INTERFACE()

#define AGS_IS_SOUND_RESOURCE_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_SOUND_RESOURCE))

AGS_SOUND_RESOURCE()

#define AGS_SOUND_RESOURCE(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_SOUND_RESOURCE, AgsSoundResource))

AGS_SOUND_RESOURCE_GET_INTERFACE()

#define AGS_SOUND_RESOURCE_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_SOUND_RESOURCE, AgsSoundResourceInterface))

AGS_SOUND_RESOURCE_INTERFACE()

#define AGS_SOUND_RESOURCE_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_SOUND_RESOURCE, AgsSoundResourceInterface))

ags_sound_resource_get_type ()

GType
ags_sound_resource_get_type ();

Types and Values

AGS_TYPE_SOUND_RESOURCE

#define AGS_TYPE_SOUND_RESOURCE                    (ags_sound_resource_get_type())

AgsSoundResource

typedef struct _AgsSoundResource AgsSoundResource;

struct AgsSoundResourceInterface

struct AgsSoundResourceInterface {
  GTypeInterface ginterface;

  gboolean (*open)(AgsSoundResource *sound_resource,
		   gchar *filename);
  gboolean (*rw_open)(AgsSoundResource *sound_resource,
		      gchar *filename,
		      guint audio_channels, guint samplerate,
		      gboolean create);

  void (*load)(AgsSoundResource *sound_resource);

  void (*info)(AgsSoundResource *sound_resource,
	       guint *frame_count,
	       guint *loop_start, guint *loop_end);

  void (*set_presets)(AgsSoundResource *sound_resource,
		      guint channels,
		      guint samplerate,
		      guint buffer_size,
		      guint format);
  void (*get_presets)(AgsSoundResource *sound_resource,
		      guint *channels,
		      guint *samplerate,
		      guint *buffer_size,
		      guint *format);

  /* read sample data */
  guint (*read)(AgsSoundResource *sound_resource,
		void *dbuffer, guint daudio_channels,
		guint audio_channel,
		guint frame_count, guint format);

  /* write sample data */
  void (*write)(AgsSoundResource *sound_resource,
		void *sbuffer, guint saudio_channels,
		guint audio_channel,
		guint frame_count, guint format);
  void (*flush)(AgsSoundResource *sound_resource);

  /* position */
  void (*seek)(AgsSoundResource *sound_resource,
	       gint64 frame_count, gint whence);

  /* close */
  void (*close)(AgsSoundResource *sound_resource);
};