AgsAudioSignal

AgsAudioSignal — Contains the audio data and its alignment

Synopsis

#include <ags/audio/ags_audio_signal.h>

                    AgsAttack;
enum                AgsAttackFlags;
struct              AgsAudioSignal;
struct              AgsAudioSignalClass;
enum                AgsAudioSignalFlags;
void                ags_audio_signal_add_stream         (AgsAudioSignal *audio_signal);
void                ags_audio_signal_copy_buffer_to_buffer
                                                        (signed short *destination,
                                                         guint dchannels,
                                                         signed short *source,
                                                         guint schannels,
                                                         guint size);
void                ags_audio_signal_copy_buffer_to_double_buffer
                                                        (double *destination,
                                                         guint dchannels,
                                                         signed short *source,
                                                         guint schannels,
                                                         guint size);
void                ags_audio_signal_copy_double_buffer_to_buffer
                                                        (signed short *destination,
                                                         guint dchannels,
                                                         double *source,
                                                         guint schannels,
                                                         guint size);
void                ags_audio_signal_duplicate_stream   (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template);
GList *             ags_audio_signal_get_by_recall_id   (GList *audio_signal,
                                                         GObject *recall_id);
guint               ags_audio_signal_get_length_till_current
                                                        (AgsAudioSignal *audio_signal);
GList *             ags_audio_signal_get_stream_current (GList *audio_signal,
                                                         GObject *recall_id);
AgsAudioSignal *    ags_audio_signal_get_template       (GList *audio_signal);
void                ags_audio_signal_morph_samplerate   (AgsAudioSignal *audio_signal,
                                                         guint samplerate,
                                                         double k_morph);
AgsAudioSignal *    ags_audio_signal_new                (GObject *devout,
                                                         GObject *recycling,
                                                         GObject *recall_id);
AgsAudioSignal *    ags_audio_signal_new_with_length    (GObject *devout,
                                                         GObject *recycling,
                                                         GObject *recall_id,
                                                         guint length);
void                ags_audio_signal_realloc_buffer_size
                                                        (AgsAudioSignal *audio_signal,
                                                         guint buffer_size);
void                ags_audio_signal_scale              (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template,
                                                         guint length);
void                ags_audio_signal_stream_resize      (AgsAudioSignal *audio_signal,
                                                         guint length);
void                ags_audio_signal_stream_safe_resize (AgsAudioSignal *audio_signal,
                                                         guint length);
void                ags_audio_signal_tile               (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template,
                                                         guint length);
signed short *      ags_stream_alloc                    (guint buffer_size);

Description

AgsAudioSignal organizes audio data within a GList whereby data pointing to the buffer.

Details

AgsAttack

typedef struct _AgsAttack AgsAttack;

enum AgsAttackFlags

typedef enum {
  AGS_ATTACK_INITIAL_RUN  = 1,
  AGS_ATTACK_SWAP         = 1 << 1,
} AgsAttackFlags;

struct AgsAudioSignal

struct AgsAudioSignal {
  GObject object;

  guint flags;

  GObject *devout;

  GObject *recycling;
  GObject *recall_id; // AGS_TYPE_RECALL_ID to identify the AgsAudioSignal

  guint samplerate;
  guint buffer_size;
  guint resolution;

  guint length;
  guint last_frame; // the last frame at stream_end
  guint loop_start;
  guint loop_end;

  gdouble delay;
  guint attack;

  guint lock_attack;
  
  GList *stream_beginning;
  GList *stream_current;
  GList *stream_end;
};

struct AgsAudioSignalClass

struct AgsAudioSignalClass {
  GObjectClass object;

  void (*realloc_buffer_size)(AgsAudioSignal *audio_signal, guint buffer_size);
  void (*morph_samplerate)(AgsAudioSignal *audio_signal, guint samplerate, double k_morph);
};

enum AgsAudioSignalFlags

typedef enum {
  AGS_AUDIO_SIGNAL_TEMPLATE             = 1,
  AGS_AUDIO_SIGNAL_PLAY_DONE            = 1 << 1,
  AGS_AUDIO_SIGNAL_STANDALONE           = 1 << 2,
} AgsAudioSignalFlags;

ags_audio_signal_add_stream ()

void                ags_audio_signal_add_stream         (AgsAudioSignal *audio_signal);

Adds a buffer at the end of the stream.

audio_signal :

an AgsAudioSignal

Since 0.3


ags_audio_signal_copy_buffer_to_buffer ()

void                ags_audio_signal_copy_buffer_to_buffer
                                                        (signed short *destination,
                                                         guint dchannels,
                                                         signed short *source,
                                                         guint schannels,
                                                         guint size);

Copy a buffer to an other buffer.

destination :

destination buffer

dchannels :

destination audio channels

source :

source buffer

schannels :

source audio channels

size :

frame count to copy

Since 0.3


ags_audio_signal_copy_buffer_to_double_buffer ()

void                ags_audio_signal_copy_buffer_to_double_buffer
                                                        (double *destination,
                                                         guint dchannels,
                                                         signed short *source,
                                                         guint schannels,
                                                         guint size);

Copy a buffer to an other buffer.

destination :

destination buffer

dchannels :

destination audio channels

source :

source buffer

schannels :

source audio channels

size :

frame count to copy

Since 0.4


ags_audio_signal_copy_double_buffer_to_buffer ()

void                ags_audio_signal_copy_double_buffer_to_buffer
                                                        (signed short *destination,
                                                         guint dchannels,
                                                         double *source,
                                                         guint schannels,
                                                         guint size);

Copy a buffer to an other buffer.

destination :

destination buffer

dchannels :

destination audio channels

source :

source buffer

schannels :

source audio channels

size :

frame count to copy

Since 0.4


ags_audio_signal_duplicate_stream ()

void                ags_audio_signal_duplicate_stream   (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template);

Copy stream of one audio signal to another

audio_signal :

destination AgsAudioSignal

template :

source AgsAudioSignal

Since 0.3


ags_audio_signal_get_by_recall_id ()

GList *             ags_audio_signal_get_by_recall_id   (GList *audio_signal,
                                                         GObject *recall_id);

Retrieve next audio signal refering to recall_id

audio_signal :

a GList containing AgsAudioSignal

recall_id :

matching AgsRecallID

Returns :

matching AgsAudioSignal

Since 0.3


ags_audio_signal_get_length_till_current ()

guint               ags_audio_signal_get_length_till_current
                                                        (AgsAudioSignal *audio_signal);

Counts the buffers from stream_beginning upto stream_current.

audio_signal :

an AgsAudioSignal

Returns :

the counted length.

Since 0.4


ags_audio_signal_get_stream_current ()

GList *             ags_audio_signal_get_stream_current (GList *audio_signal,
                                                         GObject *recall_id);

Retrieve next current stream of AgsAudioSignal list.

audio_signal :

a GList containing AgsAudioSignal

recall_id :

the matching AgsRecallID

Returns :

next GList matching AgsRecallID

Since 0.4


ags_audio_signal_get_template ()

AgsAudioSignal *    ags_audio_signal_get_template       (GList *audio_signal);

Retrieve the template audio signal.

audio_signal :

a GList containing AgsAudioSignal

Returns :

the template AgsAudioSignal

Since 0.3


ags_audio_signal_morph_samplerate ()

void                ags_audio_signal_morph_samplerate   (AgsAudioSignal *audio_signal,
                                                         guint samplerate,
                                                         double k_morph);

Morph audio quality to new samplerate.

audio_signal :

an AgsAudioSignal

samplerate :

the new samplerate

k_morph :

reserved for future usage

Since 0.4


ags_audio_signal_new ()

AgsAudioSignal *    ags_audio_signal_new                (GObject *devout,
                                                         GObject *recycling,
                                                         GObject *recall_id);

Creates a AgsAudioSignal, with defaults of devout, linking recycling tree and refering to recall_id.

devout :

the assigned AgsDevout

recycling :

the AgsRecycling

recall_id :

the AgsRecallID, it can be NULL if AGS_AUDIO_SIGNAL_TEMPLATE is set

Returns :

a new AgsAudioSignal

Since 0.3


ags_audio_signal_new_with_length ()

AgsAudioSignal *    ags_audio_signal_new_with_length    (GObject *devout,
                                                         GObject *recycling,
                                                         GObject *recall_id,
                                                         guint length);

Creates a AgsAudioSignal, with defaults of devout, linking recycling tree and refering to recall_id. The audio data is tiled to length frame count.

devout :

the assigned AgsDevout

recycling :

the AgsRecycling

recall_id :

the AgsRecallID, it can be NULL if AGS_AUDIO_SIGNAL_TEMPLATE is set

length :

audio data frame count

Returns :

a new AgsAudioSignal

Since 0.4


ags_audio_signal_realloc_buffer_size ()

void                ags_audio_signal_realloc_buffer_size
                                                        (AgsAudioSignal *audio_signal,
                                                         guint buffer_size);

Realloc the stream to the new buffer size.

audio_signal :

an AgsAudioSignal

buffer_size :

the buffer size

Since 0.4


ags_audio_signal_scale ()

void                ags_audio_signal_scale              (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template,
                                                         guint length);

Scale audio signal data.

audio_signal :

an AgsAudioSignal

template :

the source AgsAudioSignal

length :

new frame count

Since 0.4


ags_audio_signal_stream_resize ()

void                ags_audio_signal_stream_resize      (AgsAudioSignal *audio_signal,
                                                         guint length);

Resizes an AgsAudioSignal's stream but be carefull with shrinking. This function may crash the application.

audio_signal :

an AgsAudioSignal to resize.

length :

a guint as the new length.

Since 0.3


ags_audio_signal_stream_safe_resize ()

void                ags_audio_signal_stream_safe_resize (AgsAudioSignal *audio_signal,
                                                         guint length);

Resizes an AgsAudioSignal's stream but doesn't shrink more than the current stream position.

audio_signal :

an AgsAudioSignal

length :

a guint

Since 0.4


ags_audio_signal_tile ()

void                ags_audio_signal_tile               (AgsAudioSignal *audio_signal,
                                                         AgsAudioSignal *template,
                                                         guint length);

Tile audio signal data.

audio_signal :

an AgsAudioSignal

template :

the source AgsAudioSignal

frame_count :

new frame count

Since 0.4


ags_stream_alloc ()

signed short *      ags_stream_alloc                    (guint buffer_size);

Allocs an audio buffer.

buffer_size :

the buffer size

Returns :

the audio data array

Since 0.3