AgsWave

AgsWave — Wave class supporting selection and clipboard.

Stability Level

Stable, unless otherwise indicated

Functions

Types and Values

Includes

#include <ags/audio/ags_wave.h>

Description

AgsWave acts as a container of AgsBuffer.

Functions

AGS_WAVE_GET_OBJ_MUTEX()

#define AGS_WAVE_GET_OBJ_MUTEX(obj) (&(((AgsWave *) obj)->obj_mutex))

ags_wave_get_obj_mutex ()

GRecMutex *
ags_wave_get_obj_mutex (AgsWave *wave);

Get object mutex.

Parameters

wave

the AgsWave

 

Returns

the GRecMutex to lock wave

Since: 3.1.0


ags_wave_test_flags ()

gboolean
ags_wave_test_flags (AgsWave *wave,
                     guint flags);

Test flags to be set on wave .

Parameters

wave

the AgsWave

 

flags

the flags

 

Returns

TRUE if flags are set, else FALSE

Since: 3.0.0


ags_wave_set_flags ()

void
ags_wave_set_flags (AgsWave *wave,
                    guint flags);

Set flags on wave .

Parameters

wave

the AgsWave

 

flags

the flags

 

Since: 3.0.0


ags_wave_unset_flags ()

void
ags_wave_unset_flags (AgsWave *wave,
                      guint flags);

Unset flags on wave .

Parameters

wave

the AgsWave

 

flags

the flags

 

Since: 3.0.0


ags_wave_find_near_timestamp ()

GList *
ags_wave_find_near_timestamp (GList *wave,
                              guint line,
                              AgsTimestamp *timestamp);

Retrieve appropriate wave for timestamp.

Parameters

wave

the GList containing AgsWave.

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

line

the matching audio channel

 

timestamp

the matching AgsTimestamp, or NULL to match any timestamp

 

Returns

Next matching GList or NULL if not found.

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

Since: 3.0.0


ags_wave_sort_func ()

gint
ags_wave_sort_func (gconstpointer a,
                    gconstpointer b);

Compare a and b .

Parameters

a

the AgsWave

 

b

another AgsWave

 

Returns

0 if equal, -1 if smaller and 1 if bigger timestamp

Since: 3.0.0


ags_wave_get_audio ()

GObject *
ags_wave_get_audio (AgsWave *wave);

Get audio.

Parameters

wave

the AgsWave

 

Returns

the AgsAudio.

[transfer full]

Since: 3.1.0


ags_wave_set_audio ()

void
ags_wave_set_audio (AgsWave *wave,
                    GObject *audio);

Set audio.

Parameters

wave

the AgsWave

 

audio

the AgsAudio

 

Since: 3.1.0


ags_wave_get_line ()

guint
ags_wave_get_line (AgsWave *wave);

Gets line.

Parameters

wave

the AgsWave

 

Returns

the line

Since: 3.1.0


ags_wave_set_line ()

void
ags_wave_set_line (AgsWave *wave,
                   guint line);

Sets line.

Parameters

wave

the AgsWave

 

line

the line

 

Since: 3.1.0


ags_wave_get_samplerate ()

guint
ags_wave_get_samplerate (AgsWave *wave);

Gets samplerate.

Parameters

wave

the AgsWave

 

Returns

the samplerate

Since: 3.1.0


ags_wave_set_samplerate ()

void
ags_wave_set_samplerate (AgsWave *wave,
                         guint samplerate);

Set samplerate.

Parameters

wave

the AgsWave

 

samplerate

the samplerate

 

Since: 3.0.0


ags_wave_get_buffer_size ()

guint
ags_wave_get_buffer_size (AgsWave *wave);

Gets buffer size.

Parameters

wave

the AgsWave

 

Returns

the buffer size

Since: 3.1.0


ags_wave_set_buffer_size ()

void
ags_wave_set_buffer_size (AgsWave *wave,
                          guint buffer_size);

Set buffer size.

Parameters

wave

the AgsWave

 

buffer_size

the buffer size

 

Since: 3.0.0


ags_wave_get_format ()

guint
ags_wave_get_format (AgsWave *wave);

Gets format.

Parameters

wave

the AgsWave

 

Returns

the format

Since: 3.1.0


ags_wave_set_format ()

void
ags_wave_set_format (AgsWave *wave,
                     guint format);

Set format.

Parameters

wave

the AgsWave

 

format

the format

 

Since: 3.0.0


ags_wave_get_timestamp ()

AgsTimestamp *
ags_wave_get_timestamp (AgsWave *wave);

Get timestamp.

Parameters

wave

the AgsWave

 

Returns

the AgsTimestamp.

[transfer full]

Since: 3.1.0


ags_wave_set_timestamp ()

void
ags_wave_set_timestamp (AgsWave *wave,
                        AgsTimestamp *timestamp);

Set timestamp.

Parameters

wave

the AgsWave

 

timestamp

the AgsTimestamp

 

Since: 3.1.0


ags_wave_get_buffer ()

GList *
ags_wave_get_buffer (AgsWave *wave);

Get buffer.

Parameters

wave

the AgsWave

 

Returns

the GList containig AgsBuffer.

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

Since: 3.1.0


ags_wave_set_buffer ()

void
ags_wave_set_buffer (AgsWave *wave,
                     GList *buffer);

Set buffer by replacing existing.

Parameters

wave

the AgsWave

 

buffer

the GList containing AgsBuffer.

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

Since: 3.1.0


ags_wave_add ()

GList *
ags_wave_add (GList *wave,
              AgsWave *new_wave);

Add new_wave sorted to wave

Parameters

wave

the GList containing AgsWave.

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

new_wave

the AgsWave to add

 

Returns

the new beginning of wave .

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

Since: 3.0.0


ags_wave_add_buffer ()

void
ags_wave_add_buffer (AgsWave *wave,
                     AgsBuffer *buffer,
                     gboolean use_selection_list);

Add buffer to wave .

Parameters

wave

the AgsWave

 

buffer

the AgsBuffer to add

 

use_selection_list

if TRUE add to selection, else to default wave

 

Since: 3.0.0


ags_wave_remove_buffer ()

void
ags_wave_remove_buffer (AgsWave *wave,
                        AgsBuffer *buffer,
                        gboolean use_selection_list);

Removes buffer from wave .

Parameters

wave

the AgsWave

 

buffer

the AgsBuffer to remove

 

use_selection_list

if TRUE remove from selection, else from default wave

 

Since: 3.0.0


ags_wave_get_selection ()

GList *
ags_wave_get_selection (AgsWave *wave);

Retrieve selection.

Parameters

wave

the AgsWave

 

Returns

the selection.

[element-type AgsAudio.Buffer][transfer none]

Since: 3.0.0


ags_wave_is_buffer_selected ()

gboolean
ags_wave_is_buffer_selected (AgsWave *wave,
                             AgsBuffer *buffer);

Check selection for buffer.

Parameters

wave

the AgsWave

 

buffer

the AgsBuffer to check for

 

Returns

TRUE if selected otherwise FALSE

Since: 3.0.0


ags_wave_find_point ()

AgsBuffer *
ags_wave_find_point (AgsWave *wave,
                     guint64 x,
                     gboolean use_selection_list);

Find buffers by offset.

Parameters

wave

the AgsWave

 

x

offset

 

use_selection_list

if TRUE selection is searched

 

Returns

the matching buffer as AgsBuffer.

[transfer none]

Since: 3.0.0


ags_wave_find_region ()

GList *
ags_wave_find_region (AgsWave *wave,
                      guint64 x0,
                      guint64 x1,
                      gboolean use_selection_list);

Find buffers by offset and region.

Parameters

wave

the AgsWave

 

x0

x start offset

 

x1

x end offset

 

use_selection_list

if TRUE selection is searched

 

Returns

the matching buffers as GList.

[element-type AgsAudio.Buffer][transfer container]

Since: 3.0.0


ags_wave_free_selection ()

void
ags_wave_free_selection (AgsWave *wave);

Clear selection.

Parameters

wave

the AgsWave

 

Since: 3.0.0


ags_wave_add_region_to_selection ()

void
ags_wave_add_region_to_selection (AgsWave *wave,
                                  guint64 x0,
                                  guint64 x1,
                                  gboolean replace_current_selection);

Add buffer within region to selection.

Parameters

wave

the AgsWave

 

x0

x start offset

 

x1

x end offset

 

replace_current_selection

if TRUE selection is replaced

 

Since: 3.0.0


ags_wave_remove_region_from_selection ()

void
ags_wave_remove_region_from_selection (AgsWave *wave,
                                       guint64 x0,
                                       guint64 x1);

Remove buffers within region of selection.

Parameters

wave

the AgsWave

 

x0

x start offset

 

x1

x end offset

 

Since: 3.0.0


ags_wave_add_all_to_selection ()

void
ags_wave_add_all_to_selection (AgsWave *wave);

Select all buffer to selection.

Parameters

wave

the AgsWave

 

Since: 3.0.0


ags_wave_copy_selection ()

xmlNode *
ags_wave_copy_selection (AgsWave *wave);

Copy selection to clipboard.

Parameters

wave

the AgsWave

 

Returns

the selection as XML.

[transfer none]

Since: 3.0.0


ags_wave_cut_selection ()

xmlNode *
ags_wave_cut_selection (AgsWave *wave);

Cut selection to clipboard.

Parameters

wave

the AgsWave

 

Returns

the selection as xmlNode.

[transfer none]

Since: 3.0.0


ags_wave_insert_from_clipboard ()

void
ags_wave_insert_from_clipboard (AgsWave *wave,
                                xmlNode *wave_node,
                                gboolean reset_x_offset,
                                guint64 x_offset,
                                gdouble delay,
                                guint attack);

Paste previously copied buffers.

Parameters

wave

the AgsWave

 

wave_node

the clipboard XML data

 

reset_x_offset

if TRUE x_offset used as cursor

 

x_offset

region start cursor offset

 

delay

the delay to be used

 

attack

the attack to be used

 

Since: 3.0.0


ags_wave_insert_from_clipboard_extended ()

void
ags_wave_insert_from_clipboard_extended
                               (AgsWave *wave,
                                xmlNode *wave_node,
                                gboolean reset_x_offset,
                                guint64 x_offset,
                                gdouble delay,
                                guint attack,
                                gboolean match_line,
                                gboolean do_replace);

Paste previously copied buffers.

Parameters

wave

the AgsWave

 

wave_node

the clipboard XML data

 

reset_x_offset

if TRUE x_offset used as cursor

 

x_offset

region start cursor offset

 

delay

the delay to be used

 

attack

the attack to be used

 

match_line

only paste if channel matches

 

do_replace

if TRUE current data is replaced, otherwise additive mixing is performed

 

Since: 3.0.0


ags_wave_new ()

AgsWave *
ags_wave_new (GObject *audio,
              guint line);

Creates a new instance of AgsWave.

Parameters

audio

the assigned AgsAudio

 

line

the line to be used

 

Returns

a new AgsWave

Since: 3.0.0

Types and Values

AGS_WAVE_DEFAULT_BPM

#define AGS_WAVE_DEFAULT_BPM (120.0)

AGS_WAVE_TICS_PER_BEAT

#define AGS_WAVE_TICS_PER_BEAT (1.0)

AGS_WAVE_MINIMUM_BUFFER_LENGTH

#define AGS_WAVE_MINIMUM_BUFFER_LENGTH (1.0 / 16.0)

AGS_WAVE_DEFAULT_BUFFER_LENGTH

#define AGS_WAVE_DEFAULT_BUFFER_LENGTH (64.0)

AGS_WAVE_DEFAULT_LENGTH

#define AGS_WAVE_DEFAULT_LENGTH (65535.0 / AGS_WAVE_TICS_PER_BEAT - AGS_WAVE_MINIMUM_BUFFER_LENGTH)

AGS_WAVE_DEFAULT_JIFFIE

#define AGS_WAVE_DEFAULT_JIFFIE (60.0 / AGS_WAVE_DEFAULT_BPM / AGS_WAVE_TICS_PER_BEAT)

AGS_WAVE_DEFAULT_DURATION

#define AGS_WAVE_DEFAULT_DURATION (AGS_WAVE_DEFAULT_LENGTH * AGS_WAVE_DEFAULT_JIFFIE * AGS_USEC_PER_SEC)

AGS_WAVE_DEFAULT_OFFSET

#define AGS_WAVE_DEFAULT_OFFSET (AGS_WAVE_DEFAULT_BUFFER_LENGTH * AGS_SOUNDCARD_DEFAULT_SAMPLERATE)

AGS_WAVE_CLIPBOARD_VERSION

#define AGS_WAVE_CLIPBOARD_VERSION "1.4.0"

AGS_WAVE_CLIPBOARD_TYPE

#define AGS_WAVE_CLIPBOARD_TYPE "AgsWaveClipboardXml"

AGS_WAVE_CLIPBOARD_FORMAT

#define AGS_WAVE_CLIPBOARD_FORMAT "AgsWaveNativeLevel"

enum AgsWaveFlags

Enum values to control the behavior or indicate internal state of AgsWave by enable/disable as flags.

Members

AGS_WAVE_BYPASS

ignore any wave data