SF2cute  0.1
Modern C++ Library for SoundFont 2
sf2cute::SoundFont Class Reference

The SoundFont class represents a SoundFont file. More...

#include <file.hpp>

Public Member Functions

 SoundFont ()
 Constructs a new empty SoundFont.
 
 SoundFont (const SoundFont &origin)
 Constructs a new copy of specified SoundFont. More...
 
SoundFontoperator= (const SoundFont &origin)
 Copy-assigns a new value to the SoundFont, replacing its current contents. More...
 
 SoundFont (SoundFont &&origin) noexcept
 Acquires the contents of specified SoundFont. More...
 
SoundFontoperator= (SoundFont &&origin) noexcept
 Move-assigns a new value to the SoundFont, replacing its current contents. More...
 
 ~SoundFont ()=default
 Destructs the SoundFont.
 
const std::vector< std::shared_ptr< SFPreset > > & presets () const noexcept
 Returns the list of presets. More...
 
template<typename... Args>
std::shared_ptr< SFPresetNewPreset (Args &&...args)
 Adds a new preset to the SoundFont. More...
 
void AddPreset (std::shared_ptr< SFPreset > preset)
 Adds a preset to the SoundFont. More...
 
void RemovePreset (std::vector< std::shared_ptr< SFPreset >>::const_iterator position)
 Removes a preset from the SoundFont. More...
 
void RemovePreset (std::vector< std::shared_ptr< SFPreset >>::const_iterator first, std::vector< std::shared_ptr< SFPreset >>::const_iterator last)
 Removes presets from the SoundFont. More...
 
void RemovePresetIf (std::function< bool(const std::shared_ptr< SFPreset > &)> predicate)
 Removes presets from the SoundFont. More...
 
void ClearPresets () noexcept
 Removes all of the presets.
 
const std::vector< std::shared_ptr< SFInstrument > > & instruments () const noexcept
 Returns the list of instruments. More...
 
template<typename... Args>
std::shared_ptr< SFInstrumentNewInstrument (Args &&...args)
 Adds a new instrument to the SoundFont. More...
 
void AddInstrument (std::shared_ptr< SFInstrument > instrument)
 Adds an instrument to the SoundFont. More...
 
void RemoveInstrument (std::vector< std::shared_ptr< SFInstrument >>::const_iterator position)
 Removes an instrument from the SoundFont. More...
 
void RemoveInstrument (std::vector< std::shared_ptr< SFInstrument >>::const_iterator first, std::vector< std::shared_ptr< SFInstrument >>::const_iterator last)
 Removes instruments from the SoundFont. More...
 
void RemoveInstrumentIf (std::function< bool(const std::shared_ptr< SFInstrument > &)> predicate)
 Removes instruments from the SoundFont. More...
 
void ClearInstruments () noexcept
 Removes all of the instruments.
 
const std::vector< std::shared_ptr< SFSample > > & samples () const noexcept
 Returns the list of samples. More...
 
template<typename... Args>
std::shared_ptr< SFSampleNewSample (Args &&...args)
 Adds a new sample to the SoundFont. More...
 
void AddSample (std::shared_ptr< SFSample > sample)
 Adds a sample to the SoundFont. More...
 
void RemoveSample (std::vector< std::shared_ptr< SFSample >>::const_iterator position)
 Removes a sample from the SoundFont. More...
 
void RemoveSample (std::vector< std::shared_ptr< SFSample >>::const_iterator first, std::vector< std::shared_ptr< SFSample >>::const_iterator last)
 Removes samples from the SoundFont. More...
 
void RemoveSampleIf (std::function< bool(const std::shared_ptr< SFSample > &)> predicate)
 Removes samples from the SoundFont. More...
 
void ClearSamples () noexcept
 Removes all of the samples.
 
const std::string & sound_engine () const noexcept
 Returns the target sound engine. More...
 
void set_sound_engine (std::string sound_engine)
 Sets the target sound engine. More...
 
const std::string & bank_name () const noexcept
 Returns the SoundFont bank name. More...
 
void set_bank_name (std::string bank_name)
 Sets the SoundFont bank name. More...
 
bool has_rom_name () const noexcept
 Returns true if the SoundFont has a Sound ROM name. More...
 
const std::string & rom_name () const noexcept
 Returns the Sound ROM name. More...
 
void set_rom_name (std::string rom_name)
 Sets the Sound ROM name. More...
 
void reset_rom_name () noexcept
 Resets the Sound ROM name.
 
bool has_rom_version () const noexcept
 Returns true if the SoundFont has a Sound ROM version. More...
 
SFVersionTag rom_version () const noexcept
 Returns the Sound ROM version. More...
 
void set_rom_version (SFVersionTag rom_version)
 Sets the Sound ROM version. More...
 
void reset_rom_version () noexcept
 Resets the Sound ROM version.
 
bool has_creation_date () const noexcept
 Returns true if the SoundFont has a date of creation of the bank. More...
 
const std::string & creation_date () const noexcept
 Returns the date of creation of the bank. More...
 
void set_creation_date (std::string creation_date)
 Sets the date of creation of the bank. More...
 
void reset_creation_date () noexcept
 Resets the date of creation of the bank.
 
bool has_engineers () const noexcept
 Returns true if the SoundFont has the sound designers and engineers information for the bank. More...
 
const std::string & engineers () const noexcept
 Returns the sound designers and engineers for the bank. More...
 
void set_engineers (std::string engineers)
 Sets the sound designers and engineers for the bank. More...
 
void reset_engineers () noexcept
 Resets the sound designers and engineers for the bank.
 
bool has_product () const noexcept
 Returns true if the SoundFont has a product name for which the bank was intended. More...
 
const std::string & product () const noexcept
 Returns the product name for which the bank was intended. More...
 
void set_product (std::string product)
 Sets the product name for which the bank was intended. More...
 
void reset_product () noexcept
 Resets the product name for which the bank was intended.
 
bool has_copyright () const noexcept
 Returns true if the SoundFont has any copyright message. More...
 
const std::string & copyright () const noexcept
 Returns the copyright message. More...
 
void set_copyright (std::string copyright)
 Sets the copyright message. More...
 
void reset_copyright () noexcept
 Resets the copyright message.
 
bool has_comment () const noexcept
 Returns true if the SoundFont has any comments on the bank. More...
 
const std::string & comment () const noexcept
 Returns the comments on the bank. More...
 
void set_comment (std::string comment)
 Sets the comments on the bank. More...
 
void reset_comment () noexcept
 Resets the comments on the bank.
 
bool has_software () const noexcept
 Returns true if the SoundFont the information of SoundFont tools used to create and alter the bank. More...
 
const std::string & software () const noexcept
 Returns the SoundFont tools used to create and alter the bank. More...
 
void set_software (std::string software)
 Sets the SoundFont tools used to create and alter the bank. More...
 
void reset_software () noexcept
 Resets the SoundFont tools used to create and alter the bank.
 
void Write (const std::string &filename)
 Writes the SoundFont to a file. More...
 
void Write (std::ostream &out)
 Writes the SoundFont to an output stream. More...
 
void Write (std::ostream &&out)
 Writes the SoundFont to an output stream. More...
 

Static Public Attributes

static constexpr std::string::size_type kInfoTextMaxLength = 256 - 1
 Maximum length of text fields of INFO chunk (excluding the terminator byte), in terms of bytes.
 

Detailed Description

The SoundFont class represents a SoundFont file.

Constructor & Destructor Documentation

sf2cute::SoundFont::SoundFont ( const SoundFont origin)

Constructs a new copy of specified SoundFont.

Parameters
origina SoundFont object.
sf2cute::SoundFont::SoundFont ( SoundFont &&  origin)
noexcept

Acquires the contents of specified SoundFont.

Parameters
origina SoundFont object.

Member Function Documentation

void sf2cute::SoundFont::AddInstrument ( std::shared_ptr< SFInstrument instrument)

Adds an instrument to the SoundFont.

Parameters
instrumentan instrument to be assigned to the SoundFont.
Exceptions
std::invalid_argumentInstrument has already been owned by another file.
void sf2cute::SoundFont::AddPreset ( std::shared_ptr< SFPreset preset)

Adds a preset to the SoundFont.

Parameters
preseta preset to be assigned to the SoundFont.
Exceptions
std::invalid_argumentPreset has already been owned by another file.
void sf2cute::SoundFont::AddSample ( std::shared_ptr< SFSample sample)

Adds a sample to the SoundFont.

Parameters
samplea sample to be assigned to the SoundFont.
Exceptions
std::invalid_argumentSample has already been owned by another file.
const std::string& sf2cute::SoundFont::bank_name ( ) const
noexcept

Returns the SoundFont bank name.

Returns
the SoundFont bank name.
const std::string& sf2cute::SoundFont::comment ( ) const
noexcept

Returns the comments on the bank.

Returns
the comments on the bank.
const std::string& sf2cute::SoundFont::copyright ( ) const
noexcept

Returns the copyright message.

Returns
the copyright message.
const std::string& sf2cute::SoundFont::creation_date ( ) const
noexcept

Returns the date of creation of the bank.

Returns
the date of creation of the bank.
const std::string& sf2cute::SoundFont::engineers ( ) const
noexcept

Returns the sound designers and engineers for the bank.

Returns
the sound designers and engineers for the bank.
bool sf2cute::SoundFont::has_comment ( ) const
noexcept

Returns true if the SoundFont has any comments on the bank.

Returns
true if the SoundFont has any comments on the bank.
bool sf2cute::SoundFont::has_copyright ( ) const
noexcept

Returns true if the SoundFont has any copyright message.

Returns
true if the SoundFont has any copyright message.
bool sf2cute::SoundFont::has_creation_date ( ) const
noexcept

Returns true if the SoundFont has a date of creation of the bank.

Returns
true if the SoundFont has a date of creation of the bank.
bool sf2cute::SoundFont::has_engineers ( ) const
noexcept

Returns true if the SoundFont has the sound designers and engineers information for the bank.

Returns
true if the SoundFont has the sound designers and engineers information for the bank.
bool sf2cute::SoundFont::has_product ( ) const
noexcept

Returns true if the SoundFont has a product name for which the bank was intended.

Returns
true if the SoundFont has a product name for which the bank was intended.
bool sf2cute::SoundFont::has_rom_name ( ) const
noexcept

Returns true if the SoundFont has a Sound ROM name.

Returns
true if the SoundFont has a Sound ROM name.
bool sf2cute::SoundFont::has_rom_version ( ) const
noexcept

Returns true if the SoundFont has a Sound ROM version.

Returns
true if the SoundFont has a Sound ROM version.
bool sf2cute::SoundFont::has_software ( ) const
noexcept

Returns true if the SoundFont the information of SoundFont tools used to create and alter the bank.

Returns
true if the SoundFont the information of SoundFont tools used to create and alter the bank.
const std::vector<std::shared_ptr<SFInstrument> >& sf2cute::SoundFont::instruments ( ) const
noexcept

Returns the list of instruments.

Returns
the list of instruments assigned to the SoundFont.
template<typename... Args>
std::shared_ptr<SFInstrument> sf2cute::SoundFont::NewInstrument ( Args &&...  args)
inline

Adds a new instrument to the SoundFont.

Parameters
argsthe arguments for the SFInstrument constructor.
Returns
the new SFInstrument object.
Exceptions
std::invalid_argumentInstrument has already been owned by another file.
template<typename... Args>
std::shared_ptr<SFPreset> sf2cute::SoundFont::NewPreset ( Args &&...  args)
inline

Adds a new preset to the SoundFont.

Parameters
argsthe arguments for the SFPreset constructor.
Returns
the new SFPreset object.
Exceptions
std::invalid_argumentPreset has already been owned by another file.
template<typename... Args>
std::shared_ptr<SFSample> sf2cute::SoundFont::NewSample ( Args &&...  args)
inline

Adds a new sample to the SoundFont.

Parameters
argsthe arguments for the SFSample constructor.
Returns
the new SFSample object.
Exceptions
std::invalid_argumentSample has already been owned by another file.
SoundFont& sf2cute::SoundFont::operator= ( const SoundFont origin)

Copy-assigns a new value to the SoundFont, replacing its current contents.

Parameters
origina SoundFont object.
SoundFont& sf2cute::SoundFont::operator= ( SoundFont &&  origin)
noexcept

Move-assigns a new value to the SoundFont, replacing its current contents.

Parameters
origina SoundFont object.
const std::vector<std::shared_ptr<SFPreset> >& sf2cute::SoundFont::presets ( ) const
noexcept

Returns the list of presets.

Returns
the list of presets assigned to the SoundFont.
const std::string& sf2cute::SoundFont::product ( ) const
noexcept

Returns the product name for which the bank was intended.

Returns
the product name for which the bank was intended.
void sf2cute::SoundFont::RemoveInstrument ( std::vector< std::shared_ptr< SFInstrument >>::const_iterator  position)

Removes an instrument from the SoundFont.

Parameters
positionthe instrument to remove.
void sf2cute::SoundFont::RemoveInstrument ( std::vector< std::shared_ptr< SFInstrument >>::const_iterator  first,
std::vector< std::shared_ptr< SFInstrument >>::const_iterator  last 
)

Removes instruments from the SoundFont.

Parameters
firstthe first instrument to remove.
lastthe last instrument to remove.
void sf2cute::SoundFont::RemoveInstrumentIf ( std::function< bool(const std::shared_ptr< SFInstrument > &)>  predicate)

Removes instruments from the SoundFont.

Parameters
predicateunary predicate which returns true if the instrument should be removed.
void sf2cute::SoundFont::RemovePreset ( std::vector< std::shared_ptr< SFPreset >>::const_iterator  position)

Removes a preset from the SoundFont.

Parameters
positionthe preset to remove.
void sf2cute::SoundFont::RemovePreset ( std::vector< std::shared_ptr< SFPreset >>::const_iterator  first,
std::vector< std::shared_ptr< SFPreset >>::const_iterator  last 
)

Removes presets from the SoundFont.

Parameters
firstthe first preset to remove.
lastthe last preset to remove.
void sf2cute::SoundFont::RemovePresetIf ( std::function< bool(const std::shared_ptr< SFPreset > &)>  predicate)

Removes presets from the SoundFont.

Parameters
predicateunary predicate which returns true if the preset should be removed.
void sf2cute::SoundFont::RemoveSample ( std::vector< std::shared_ptr< SFSample >>::const_iterator  position)

Removes a sample from the SoundFont.

Parameters
positionthe sample to remove.
void sf2cute::SoundFont::RemoveSample ( std::vector< std::shared_ptr< SFSample >>::const_iterator  first,
std::vector< std::shared_ptr< SFSample >>::const_iterator  last 
)

Removes samples from the SoundFont.

Parameters
firstthe first sample to remove.
lastthe last sample to remove.
void sf2cute::SoundFont::RemoveSampleIf ( std::function< bool(const std::shared_ptr< SFSample > &)>  predicate)

Removes samples from the SoundFont.

Parameters
predicateunary predicate which returns true if the sample should be removed.
const std::string& sf2cute::SoundFont::rom_name ( ) const
noexcept

Returns the Sound ROM name.

Returns
the Sound ROM name.
SFVersionTag sf2cute::SoundFont::rom_version ( ) const
noexcept

Returns the Sound ROM version.

Returns
the Sound ROM version.
const std::vector<std::shared_ptr<SFSample> >& sf2cute::SoundFont::samples ( ) const
noexcept

Returns the list of samples.

Returns
the list of samples assigned to the SoundFont.
void sf2cute::SoundFont::set_bank_name ( std::string  bank_name)

Sets the SoundFont bank name.

Parameters
bank_namethe SoundFont bank name.
void sf2cute::SoundFont::set_comment ( std::string  comment)

Sets the comments on the bank.

Parameters
commentthe comments on the bank.
void sf2cute::SoundFont::set_copyright ( std::string  copyright)

Sets the copyright message.

Parameters
copyrightthe copyright message.
void sf2cute::SoundFont::set_creation_date ( std::string  creation_date)

Sets the date of creation of the bank.

Parameters
creation_datethe date of creation of the bank.
void sf2cute::SoundFont::set_engineers ( std::string  engineers)

Sets the sound designers and engineers for the bank.

Parameters
engineersthe sound designers and engineers for the bank.
void sf2cute::SoundFont::set_product ( std::string  product)

Sets the product name for which the bank was intended.

Parameters
productthe product name for which the bank was intended.
void sf2cute::SoundFont::set_rom_name ( std::string  rom_name)

Sets the Sound ROM name.

Parameters
rom_namethe Sound ROM name.
void sf2cute::SoundFont::set_rom_version ( SFVersionTag  rom_version)

Sets the Sound ROM version.

Parameters
rom_versionthe Sound ROM version.
void sf2cute::SoundFont::set_software ( std::string  software)

Sets the SoundFont tools used to create and alter the bank.

Parameters
softwarethe SoundFont tools used to create and alter the bank.
void sf2cute::SoundFont::set_sound_engine ( std::string  sound_engine)

Sets the target sound engine.

Parameters
sound_enginethe target sound engine name.
const std::string& sf2cute::SoundFont::software ( ) const
noexcept

Returns the SoundFont tools used to create and alter the bank.

Returns
the SoundFont tools used to create and alter the bank.
const std::string& sf2cute::SoundFont::sound_engine ( ) const
noexcept

Returns the target sound engine.

Returns
the target sound engine name.
void sf2cute::SoundFont::Write ( const std::string &  filename)

Writes the SoundFont to a file.

Parameters
filenamethe name of the file to write to.
Exceptions
std::logic_errorThe SoundFont has a structural error.
std::ios_base::failureAn I/O error occurred.
void sf2cute::SoundFont::Write ( std::ostream &  out)

Writes the SoundFont to an output stream.

Parameters
outthe output stream to write to.
void sf2cute::SoundFont::Write ( std::ostream &&  out)

Writes the SoundFont to an output stream.

Parameters
outthe output stream to write to.

The documentation for this class was generated from the following file: