## IpatchSF2Reader IpatchSF2Reader — SoundFont file reader |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

                        IpatchSF2Reader;
    IpatchSF2Reader *   ipatch_sf2_reader_new               (IpatchFileHandle *handle);
    void                ipatch_sf2_reader_set_file_handle   (IpatchSF2Reader *reader,
                                                             IpatchFileHandle *handle);
    IpatchSF2 *         ipatch_sf2_reader_load              (IpatchSF2Reader *reader,
                                                             GError **err);
    void                ipatch_sf2_load_phdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Phdr *phdr);
    void                ipatch_sf2_load_ihdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Ihdr *ihdr);
    void                ipatch_sf2_load_shdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Shdr *shdr);
    void                ipatch_sf2_load_bag                 (IpatchFileHandle *handle,
                                                             IpatchSF2Bag *bag);
    void                ipatch_sf2_load_mod                 (IpatchFileHandle *handle,
                                                             IpatchSF2Mod *mod);
    void                ipatch_sf2_load_gen                 (IpatchFileHandle *handle,
                                                             int *genid,
                                                             IpatchSF2GenAmount *amount);

## Object Hierarchy

      GObject
       +----IpatchRiff
             +----IpatchSF2Reader

## Description

Reads a SoundFont file and loads it into a object tree (IpatchSF2).

## Details

### IpatchSF2Reader

    typedef struct _IpatchSF2Reader IpatchSF2Reader;

### ipatch_sf2_reader_new ()

    IpatchSF2Reader *   ipatch_sf2_reader_new               (IpatchFileHandle *handle);

Create a new SoundFont file reader

`handle` : | SoundFont 2 file handle to parse or `NULL` to set later
Returns : | The new SoundFont file reader

### ipatch_sf2_reader_set_file_handle ()

    void                ipatch_sf2_reader_set_file_handle   (IpatchSF2Reader *reader,
                                                             IpatchFileHandle *handle);

Set the SoundFont file handle of a SoundFont reader. A convenience function, since `ipatch_riff_set_file_handle()` could also be used, albeit without stricter type casting.

`reader` : | SoundFont reader object
`handle` : | SoundFont 2 file handle

### ipatch_sf2_reader_load ()

    IpatchSF2 *         ipatch_sf2_reader_load              (IpatchSF2Reader *reader,
                                                             GError **err);

Load an SF2 file.

`reader` : | SF2 reader object
`err` : | Location to store error info or `NULL`
Returns : | New SF2 object with refcount of 1.

### ipatch_sf2_load_phdr ()

    void                ipatch_sf2_load_phdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Phdr *phdr);

Parses a raw preset header in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`phdr` : | Pointer to a user supplied preset header structure

### ipatch_sf2_load_ihdr ()

    void                ipatch_sf2_load_ihdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Ihdr *ihdr);

Parses a raw instrument header in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`ihdr` : | Pointer to a user supplied instrument header structure

### ipatch_sf2_load_shdr ()

    void                ipatch_sf2_load_shdr                (IpatchFileHandle *handle,
                                                             IpatchSF2Shdr *shdr);

Parses a raw sample header in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`shdr` : | Pointer to a user supplied sample header structure

### ipatch_sf2_load_bag ()

    void                ipatch_sf2_load_bag                 (IpatchFileHandle *handle,
                                                             IpatchSF2Bag *bag);

Parses a raw preset or instrument bag in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`bag` : | Pointer to a user supplied bag structure

### ipatch_sf2_load_mod ()

    void                ipatch_sf2_load_mod                 (IpatchFileHandle *handle,
                                                             IpatchSF2Mod *mod);

Parses a raw modulator in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`mod` : | Pointer to a user supplied modulator structure

### ipatch_sf2_load_gen ()

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

Parses a raw generator in file `handle` with buffered data.

`handle` : | File handle containing buffered data
`genid` : | Pointer to store the generator ID in
`amount` : | Pointer to a generator amount to store the amount in