AgsPlayable

AgsPlayable — read/write audio

Functions

Types and Values

Object Hierarchy

    GInterface
    ╰── AgsPlayable

Known Implementations

AgsPlayable is implemented by AgsIpatch and AgsSndfile.

Includes

#include <ags/audio/ags_playable.h>

Description

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

Functions

ags_playable_error_quark ()

GQuark
ags_playable_error_quark ();

ags_playable_open ()

gboolean
ags_playable_open (AgsPlayable *playable,
                   gchar *name);

Opens a file in read-only mode.

Parameters

playable

the AgsPlayable

 

name

the filename

 

Returns

TRUE on success

Since: 1.0.0


ags_playable_rw_open ()

gboolean
ags_playable_rw_open (AgsPlayable *playable,
                      gchar *name,
                      gboolean create,
                      guint samplerate,
                      guint channels,
                      guint frames,
                      guint format);

Opens a file in read/write mode.

Parameters

playable

the AgsPlayable

 

name

the filename

 

create

if TRUE file is created

 

samplerate

the samplerate of the file

 

channels

the count of audio channels

 

frames

the count of frames

 

format

the audio file's format

 

Returns

TRUE on success.

Since: 1.0.0


ags_playable_level_count ()

guint
ags_playable_level_count (AgsPlayable *playable);

Retrieve the count of levels.

Parameters

playable

the AgsPlayable

 

Returns

level count

Since: 1.0.0


ags_playable_nth_level ()

guint
ags_playable_nth_level (AgsPlayable *playable);

Retrieve the selected level.

Parameters

playable

the AgsPlayable

 

Returns

nth level

Since: 1.0.0


ags_playable_selected_level ()

gchar *
ags_playable_selected_level (AgsPlayable *playable);

Retrieve the selected level's name.

Parameters

playable

the AgsPlayable

 

Returns

nth level name

Since: 1.0.0


ags_playable_sublevel_names ()

gchar **
ags_playable_sublevel_names (AgsPlayable *playable);

Retrieve the all sub-level's name.

Parameters

playable

the AgsPlayable

 

Returns

sub-level names

Since: 1.0.0


ags_playable_level_select ()

void
ags_playable_level_select (AgsPlayable *playable,
                           guint nth_level,
                           gchar *sublevel_name,
                           GError **error);

Select a level in an monolythic file where nth_level and sublevel_name are equivalent. If sublevel_name is NULL nth_level will be chosen.

Parameters

playable

an AgsPlayable

 

nth_level

of type guint

 

sublevel_name

a gchar pointer

 

error

an error that may occure

 

Since: 1.0.0


ags_playable_level_up ()

void
ags_playable_level_up (AgsPlayable *playable,
                       guint levels,
                       GError **error);

Move up in hierarchy.

Parameters

playable

an AgsPlayable

 

levels

n-levels up

 

error

returned error

 

Since: 1.0.0


ags_playable_iter_start ()

void
ags_playable_iter_start (AgsPlayable *playable);

Start iterating current level.

Parameters

playable

an AgsPlayable

 

Since: 1.0.0


ags_playable_iter_next ()

gboolean
ags_playable_iter_next (AgsPlayable *playable);

Iterating next on current level.

Parameters

playable

an AgsPlayable

 

Returns

TRUE if has more, otherwise FALSE

Since: 1.0.0


ags_playable_info ()

void
ags_playable_info (AgsPlayable *playable,
                   guint *channels,
                   guint *frames,
                   guint *loop_start,
                   guint *loop_end,
                   GError **error);

Retrieve information about selected audio data.

Parameters

playable

an AgsPlayable

 

channels

channels

 

frames

frames

 

loop_start

loop start

 

loop_end

loop end

 

error

returned error

 

Since: 1.0.0


ags_playable_get_samplerate ()

guint
ags_playable_get_samplerate (AgsPlayable *playable);

Get samplerate.

Parameters

playable

the AgsPlayable

 

Returns

the samplerate

Since: 1.0.0


ags_playable_get_format ()

guint
ags_playable_get_format (AgsPlayable *playable);

Get format.

Parameters

playable

the AgsPlayable

 

Returns

the format

Since: 1.0.0


ags_playable_read ()

double *
ags_playable_read (AgsPlayable *playable,
                   guint channel,
                   GError **error);

Read audio buffer of playable audio data.

Parameters

playable

an AgsPlayable

 

channel

nth channel

 

error

returned error

 

Returns

audio buffer

Since: 1.0.0


ags_playable_write ()

void
ags_playable_write (AgsPlayable *playable,
                    double *buffer,
                    guint buffer_length);

Write buffer_length of buffer audio data.

Parameters

playable

an AgsPlayable

 

buffer

audio data

 

buffer_length

frame count

 

Since: 1.0.0


ags_playable_flush ()

void
ags_playable_flush (AgsPlayable *playable);

Flush internal audio buffer.

Parameters

playable

an AgsPlayable

 

Since: 1.0.0


ags_playable_seek ()

void
ags_playable_seek (AgsPlayable *playable,
                   guint frames,
                   gint whence);

Seek playable to address.

Parameters

playable

an AgsPlayable

 

frames

n-frames to seek

 

whence

SEEK_SET, SEEK_CUR, or SEEK_END

 

Since: 1.0.0


ags_playable_close ()

void
ags_playable_close (AgsPlayable *playable);

Close audio file.

Parameters

playable

an AgsPlayable

 

Since: 1.0.0


ags_playable_read_audio_signal ()

GList *
ags_playable_read_audio_signal (AgsPlayable *playable,
                                GObject *soundcard,
                                guint start_channel,
                                guint channels_to_read);

Read the audio signal of AgsPlayable .

Parameters

playable

an AgsPlayable

 

soundcard

the AgsSoundcard defaulting to

 

start_channel

read from channel

 

channels_to_read

n-times

 

Returns

a GList of AgsAudioSignal

Since: 1.0.0


AGS_IS_PLAYABLE()

#define AGS_IS_PLAYABLE(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE((obj), AGS_TYPE_PLAYABLE))

AGS_IS_PLAYABLE_INTERFACE()

#define AGS_IS_PLAYABLE_INTERFACE(vtable)    (G_TYPE_CHECK_CLASS_TYPE((vtable), AGS_TYPE_PLAYABLE))

AGS_PLAYABLE()

#define AGS_PLAYABLE(obj)                    (G_TYPE_CHECK_INSTANCE_CAST((obj), AGS_TYPE_PLAYABLE, AgsPlayable))

AGS_PLAYABLE_GET_INTERFACE()

#define AGS_PLAYABLE_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE((obj), AGS_TYPE_PLAYABLE, AgsPlayableInterface))

AGS_PLAYABLE_INTERFACE()

#define AGS_PLAYABLE_INTERFACE(vtable)       (G_TYPE_CHECK_CLASS_CAST((vtable), AGS_TYPE_PLAYABLE, AgsPlayableInterface))

ags_playable_get_type ()

GType
ags_playable_get_type ();

Types and Values

AGS_PLAYABLE_ERROR

#define AGS_PLAYABLE_ERROR (ags_playable_error_quark())

enum AgsPlayableError

Members

AGS_PLAYABLE_ERROR_NO_SUCH_LEVEL

   

AGS_PLAYABLE_ERROR_NO_SAMPLE

   

AGS_TYPE_PLAYABLE

#define AGS_TYPE_PLAYABLE                    (ags_playable_get_type())

AgsPlayable

typedef struct _AgsPlayable AgsPlayable;

struct AgsPlayableInterface

struct AgsPlayableInterface {
  GTypeInterface ginterface;

  gboolean (*open)(AgsPlayable *playable, gchar *name);
  gboolean (*rw_open)(AgsPlayable *playable, gchar *name,
		      gboolean create,
		      guint samplerate, guint channels,
		      guint frames,
		      guint format);

  /* these functions are especially for soundfonts */
  guint (*level_count)(AgsPlayable *playable);
  guint (*nth_level)(AgsPlayable *playable);
  gchar* (*selected_level)(AgsPlayable *playable);

  gchar** (*sublevel_names)(AgsPlayable *playable);
  void (*level_select)(AgsPlayable *playable,
		       guint nth_level, gchar *sublevel_name,
		       GError **error);
  void (*level_up)(AgsPlayable *playable,
		   guint levels,
		   GError **error);

  void (*iter_start)(AgsPlayable *playable);
  gboolean (*iter_next)(AgsPlayable *playable);

  /* read sample data */
  void (*info)(AgsPlayable *playable,
	       guint *channels, guint *frames,
	       guint *loop_start, guint *loop_end,
	       GError **error);
  
  guint (*get_samplerate)(AgsPlayable *playable);
  guint (*get_format)(AgsPlayable *playable);
  
  double* (*read)(AgsPlayable *playable,
		  guint channel,
		  GError **error);

  /* write sample data */
  void (*write)(AgsPlayable *playable,
		double *buffer, guint buffer_length);
  void (*flush)(AgsPlayable *playable);

  /* position */
  void (*seek)(AgsPlayable *playable,
	       guint frames, gint whence);

  /* close */
  void (*close)(AgsPlayable *playable);
};