## BtSong BtSong — class of a song project object (contains BtSongInfo, BtSetup, BtSequence and BtWavetable) |

## Functions

gboolean | bt_song_continue ()
BtSong * | bt_song_new ()
gboolean | bt_song_pause ()
gboolean | bt_song_play ()
gboolean | bt_song_stop ()
gboolean | bt_song_update_playback_position ()

## Properties

BtApplication * | app | Read / Write / Construct Only
GstBin * | bin | Read
gboolean | is-idle | Read / Write
gboolean | is-playing | Read
BtSinkMachine * | master | Read / Write
gulong | play-pos | Read / Write
gdouble | play-rate | Read / Write
BtSequence * | sequence | Read
BtSetup * | setup | Read
BtSongInfo * | song-info | Read
BtSongIO * | song-io | Read / Write
BtWavetable * | wavetable | Read

## Types and Values

struct | BtSong
struct | BtSongClass

## Object Hierarchy

        GObject
        ╰── BtSong

## Implemented Interfaces

BtSong implements BtPersistence.

## Includes

    #include <libbtcore/core.h>

## Description

A song is the top-level container object to manage all song-related objects. The BtSetup contains the machines and their connections, the BtSequence contains the overall time-line, the BtWavetable holds a list of audio snippets and the BtSongInfo has a couple of meta-data items for the song.

To load or save a song, use a BtSongIO object. These implement loading and saving for different file-formats.

One can seek in a song by setting the “play-pos” property. Likewise one can watch the property to display the playback position.

The “play-rate” property can be used to change the playback speed and direction.

## Functions

### bt_song_continue ()

    gboolean
    bt_song_continue (const BtSong * const self);

Continues the playback of the specified song instance.

#### Parameters

self | the song that should be paused |

#### Returns

`TRUE` for success

### bt_song_new ()

    BtSong *
    bt_song_new (const BtApplication * const app);

Create a new instance. The new song instance automatically has one instance of BtSetup, BtSequence and BtSongInfo. These instances can be retrieved via the respecting properties.

For example use following code to retrive a BtSequence from the song class:

    1
    2
    3
    BtSequence *sequence;
    ...
    g_object_get(BT_SONG(song), "sequence", &sequence, NULL);

#### Parameters

app | the application object the songs belongs to. |

#### Returns

the new instance or `NULL` in case of an error

### bt_song_pause ()

    gboolean
    bt_song_pause (const BtSong * const self);

Pauses the playback of the specified song instance.

#### Parameters

self | the song that should be paused |

#### Returns

`TRUE` for success

### bt_song_play ()

    gboolean
    bt_song_play (const BtSong * const self);

Starts to play the specified song instance from beginning. This methods toggles the “is-playing” property.

#### Parameters

self | the song that should be played |

#### Returns

`TRUE` for success

### bt_song_stop ()

    gboolean
    bt_song_stop (const BtSong * const self);

Stops the playback of the specified song instance.

#### Parameters

self | the song that should be stopped |

#### Returns

`TRUE` for success

### bt_song_update_playback_position ()

    gboolean
    bt_song_update_playback_position (const BtSong * const self);

Updates the playback-position counter to fire all “play-pos” notify handlers.

#### Parameters

self | the song that should update its playback-pos counter |

#### Returns

`FALSE` if the song is not playing

## Types and Values

### struct BtSong

    struct BtSong;

Song project object (contains BtSongInfo, BtSetup and BtSequence)

### struct BtSongClass

    struct BtSongClass {
      const GObjectClass parent;
    };

Base class for songs

#### Members

const GObjectClass `parent`; | parent class type |

## Property Details

### The `“app”` property

      “app”                      BtApplication *

set application object, the song belongs to.

Flags: Read / Write / Construct Only

### The `“bin”` property

      “bin”                      GstBin *

songs top-level GstElement container.

Flags: Read

### The `“is-idle”` property

      “is-idle”                  gboolean

request that the song should idle-loop if not playing.

Flags: Read / Write

Default value: FALSE

### The `“is-playing”` property

      “is-playing”               gboolean

tell whether the song is playing right now or not.

Flags: Read

Default value: FALSE

### The `“master”` property

      “master”                   BtSinkMachine *

songs audio_sink.

Flags: Read / Write

### The `“play-pos”` property

      “play-pos”                 gulong

position of the play cursor of the sequence in timeline bars.

Flags: Read / Write

Allowed values: <= G_MAXINT64

### The `“play-rate”` property

      “play-rate”                gdouble

playback rate of the sequence.

Flags: Read / Write

Allowed values: [-5,5]

Default value: 1

### The `“sequence”` property

      “sequence”                 BtSequence *

songs sequence sub object.

Flags: Read

### The `“setup”` property

      “setup”                    BtSetup *

songs setup sub object.

Flags: Read

### The `“song-info”` property

      “song-info”                BtSongInfo *

songs metadata sub object.

Flags: Read

### The `“song-io”` property

      “song-io”                  BtSongIO *

the song-io plugin during i/o operations.

Flags: Read / Write

### The `“wavetable”` property

      “wavetable”                BtWavetable *

songs wavetable sub object.

Flags: Read