## IpatchSF2Writer IpatchSF2Writer — SoundFont writer object |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IpatchSF2Writer;
    IpatchSF2Writer *   ipatch_sf2_writer_new               (IpatchFileHandle *handle,
                                                             IpatchSF2 *sfont);
    void                ipatch_sf2_writer_set_patch         (IpatchSF2Writer *writer,
                                                             IpatchSF2 *sfont);
    void                ipatch_sf2_writer_set_file_handle   (IpatchSF2Writer *writer,
                                                             IpatchFileHandle *handle);
    gboolean            ipatch_sf2_writer_save              (IpatchSF2Writer *writer,
                                                             GError **err);
    void                ipatch_sf2_write_phdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Phdr *phdr);
    void                ipatch_sf2_write_ihdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Ihdr *ihdr);
    void                ipatch_sf2_write_shdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Shdr *shdr);
    void                ipatch_sf2_write_bag                (IpatchFileHandle *handle,
                                                             const IpatchSF2Bag *bag);
    void                ipatch_sf2_write_mod                (IpatchFileHandle *handle,
                                                             const IpatchSF2Mod *mod);
    void                ipatch_sf2_write_gen                (IpatchFileHandle *handle,
                                                             int genid,
                                                             const IpatchSF2GenAmount *amount);

## Object Hierarchy

      GObject
       +----IpatchRiff
             +----IpatchSF2Writer

## Properties

      "migrate-samples"          gboolean              : Read / Write

## Description

Object for writing a tree of SoundFont objects (IpatchSF2) to a SoundFont file.

## Details

### IpatchSF2Writer

    typedef struct _IpatchSF2Writer IpatchSF2Writer;

### ipatch_sf2_writer_new ()

    IpatchSF2Writer *   ipatch_sf2_writer_new               (IpatchFileHandle *handle,
                                                             IpatchSF2 *sfont);

Create a new SoundFont 2 file writer.

`handle` : | SoundFont file handle to save to or `NULL` to set later
`sfont` : | SoundFont object to save or `NULL` to set later
Returns : | The new SoundFont writer

### ipatch_sf2_writer_set_patch ()

    void                ipatch_sf2_writer_set_patch         (IpatchSF2Writer *writer,
                                                             IpatchSF2 *sfont);

Set the SoundFont patch object to save with a SoundFont writer.

`writer` : | SoundFont writer object
`sfont` : | SoundFont patch to save

### ipatch_sf2_writer_set_file_handle ()

    void                ipatch_sf2_writer_set_file_handle   (IpatchSF2Writer *writer,
                                                             IpatchFileHandle *handle);

### ipatch_sf2_writer_save ()

    gboolean            ipatch_sf2_writer_save              (IpatchSF2Writer *writer,
                                                             GError **err);

Write a SoundFont object to a file.

`writer` : | SoundFont writer object
`err` : | Location to store error info or `NULL`
Returns : | `TRUE` on success, `FALSE` on error

### ipatch_sf2_write_phdr ()

    void                ipatch_sf2_write_phdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Phdr *phdr);

Buffer writes a preset header into `handle` from a `phdr` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`phdr` : | Preset header structure to store

### ipatch_sf2_write_ihdr ()

    void                ipatch_sf2_write_ihdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Ihdr *ihdr);

Writes an instrument header into `handle` from a `ihdr` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`ihdr` : | Instrument header structure to store

### ipatch_sf2_write_shdr ()

    void                ipatch_sf2_write_shdr               (IpatchFileHandle *handle,
                                                             const IpatchSF2Shdr *shdr);

Writes a sample header into `handle` from a `shdr` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`shdr` : | Sample header structure to store

### ipatch_sf2_write_bag ()

    void                ipatch_sf2_write_bag                (IpatchFileHandle *handle,
                                                             const IpatchSF2Bag *bag);

Writes a preset or instrument bag into `handle` from a `bag` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`bag` : | Bag structure to store

### ipatch_sf2_write_mod ()

    void                ipatch_sf2_write_mod                (IpatchFileHandle *handle,
                                                             const IpatchSF2Mod *mod);

Writes a modulator into `handle` from a `mod` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`mod` : | Modulator structure to store

### ipatch_sf2_write_gen ()

    void                ipatch_sf2_write_gen                (IpatchFileHandle *handle,
                                                             int genid,
                                                             const IpatchSF2GenAmount *amount);

Writes a generator into `handle` from a `genid` and `amount` structure.

`handle` : | File handle to buffer writes to, commit after calling this function
`genid` : | ID of generator to store
`amount` : | Generator amount to store

## Property Details

### The `"migrate-samples"` property

      "migrate-samples"          gboolean              : Read / Write

Migrate samples to new file.

Default value: FALSE