|
SF2cute
0.1
Modern C++ Library for SoundFont 2
|
The SFSample class represents a sample header and data. More...
#include <sample.hpp>
Public Member Functions | |
| SFSample () | |
| Constructs a new empty SFSample. | |
| SFSample (std::string name) | |
| Constructs a new empty SFSample using the specified name. More... | |
| SFSample (std::string name, std::vector< int16_t > data, uint32_t start_loop, uint32_t end_loop, uint32_t sample_rate, uint8_t original_key, int8_t correction) | |
| Constructs a new SFSample. More... | |
| SFSample (std::string name, std::vector< int16_t > data, uint32_t start_loop, uint32_t end_loop, uint32_t sample_rate, uint8_t original_key, int8_t correction, std::weak_ptr< SFSample > link, SFSampleLink type) | |
| Constructs a new SFSample with a sample link. More... | |
| SFSample (const SFSample &origin) | |
| Constructs a new copy of specified SFSample. More... | |
| SFSample & | operator= (const SFSample &origin) |
| Copy-assigns a new value to the SFSample, replacing its current contents. More... | |
| SFSample (SFSample &&origin)=default | |
| Acquires the contents of specified SFSample. More... | |
| SFSample & | operator= (SFSample &&origin)=default |
| Move-assigns a new value to the SFSample, replacing its current contents. More... | |
| ~SFSample ()=default | |
| Destructs the SFSample. | |
| const std::string & | name () const noexcept |
| Returns the name of this sample. More... | |
| void | set_name (std::string name) |
| Sets the name of this sample. More... | |
| uint32_t | start_loop () const noexcept |
| Returns the starting point of the loop of this sample. More... | |
| void | set_start_loop (uint32_t start_loop) |
| Sets the starting point of the loop of this sample. More... | |
| uint32_t | end_loop () const noexcept |
| Returns the ending point of the loop of this sample. More... | |
| void | set_end_loop (uint32_t end_loop) |
| Sets the ending point of the loop of this sample. More... | |
| uint32_t | sample_rate () const noexcept |
| Returns the sample rate. More... | |
| void | set_sample_rate (uint32_t sample_rate) |
| Sets the sample rate. More... | |
| uint8_t | original_key () const noexcept |
| Returns the original MIDI key number of this sample. More... | |
| void | set_original_key (uint8_t original_key) |
| Sets the original MIDI key number of this sample. More... | |
| int8_t | correction () const noexcept |
| Returns the pitch correction. More... | |
| void | set_correction (int8_t correction) |
| Sets the pitch correction. More... | |
| std::shared_ptr< SFSample > | link () const noexcept |
| Returns the associated right or left stereo sample. More... | |
| bool | has_link () const noexcept |
| Returns true if this sample has an associated sample. More... | |
| void | set_link (std::weak_ptr< SFSample > link) |
| Sets the associated right or left stereo sample. More... | |
| void | reset_link () noexcept |
| Resets the associated right or left stereo sample. | |
| SFSampleLink | type () const noexcept |
| Returns both the type of sample and the whether the sample is located in RAM or ROM memory. More... | |
| void | set_type (SFSampleLink type) |
| Sets both the type of sample and the whether the sample is located in RAM or ROM memory. More... | |
| const std::vector< int16_t > & | data () const noexcept |
| Returns the sample data. More... | |
| bool | has_parent_file () const noexcept |
| Returns true if this sample has a parent file. More... | |
| SoundFont & | parent_file () const noexcept |
| Returns the parent file. More... | |
Static Public Member Functions | |
| template<typename... Args> | |
| static std::shared_ptr< SFSample > | New (Args &&...args) |
| Constructs a new SFSample. More... | |
Static Public Attributes | |
| static constexpr std::string::size_type | kMaxNameLength = 20 - 1 |
| Maximum length of sample name (excluding the terminator byte), in terms of bytes. | |
| static constexpr uint32_t | kTerminatorSampleLength = 46 |
| The length of terminator samples, in sample data points. | |
Friends | |
| class | SoundFont |
| class | SoundFontWriter |
The SFSample class represents a sample header and data.
|
explicit |
Constructs a new empty SFSample using the specified name.
| name | the name of the sample. |
| sf2cute::SFSample::SFSample | ( | std::string | name, |
| std::vector< int16_t > | data, | ||
| uint32_t | start_loop, | ||
| uint32_t | end_loop, | ||
| uint32_t | sample_rate, | ||
| uint8_t | original_key, | ||
| int8_t | correction | ||
| ) |
Constructs a new SFSample.
| name | the name of the sample. |
| data | the sample data |
| start_loop | the beginning index of the loop, in sample data points, inclusive. |
| end_loop | the ending index of the loop, in sample data points, exclusive. |
| sample_rate | the sample rate, in hertz. |
| original_key | the MIDI key number of the recorded pitch of the sample. |
| correction | the pitch correction that should be applied to the sample, in cents. |
| sf2cute::SFSample::SFSample | ( | std::string | name, |
| std::vector< int16_t > | data, | ||
| uint32_t | start_loop, | ||
| uint32_t | end_loop, | ||
| uint32_t | sample_rate, | ||
| uint8_t | original_key, | ||
| int8_t | correction, | ||
| std::weak_ptr< SFSample > | link, | ||
| SFSampleLink | type | ||
| ) |
Constructs a new SFSample with a sample link.
| name | the name of the sample. |
| data | the sample data |
| start_loop | the beginning index of the loop, in sample data points, inclusive. |
| end_loop | the ending index of the loop, in sample data points, exclusive. |
| sample_rate | the sample rate, in hertz. |
| original_key | the MIDI key number of the recorded pitch of the sample. |
| correction | the pitch correction that should be applied to the sample, in cents. |
| link | the associated right or left stereo sample. nullptr is allowed. |
| type | both the type of sample and the whether the sample is located in RAM or ROM memory. |
| sf2cute::SFSample::SFSample | ( | const SFSample & | origin | ) |
|
default |
|
noexcept |
Returns the pitch correction.
|
noexcept |
Returns the sample data.
|
noexcept |
Returns the ending point of the loop of this sample.
|
noexcept |
Returns true if this sample has an associated sample.
|
noexcept |
Returns true if this sample has a parent file.
|
noexcept |
Returns the associated right or left stereo sample.
|
noexcept |
Returns the name of this sample.
|
inlinestatic |
|
noexcept |
Returns the original MIDI key number of this sample.
|
noexcept |
Returns the parent file.
|
noexcept |
Returns the sample rate.
| void sf2cute::SFSample::set_correction | ( | int8_t | correction | ) |
Sets the pitch correction.
| correction | the pitch correction that should be applied to the sample, in cents. |
| void sf2cute::SFSample::set_end_loop | ( | uint32_t | end_loop | ) |
Sets the ending point of the loop of this sample.
| end_loop | the ending index of the loop, in sample data points, exclusive. |
| void sf2cute::SFSample::set_link | ( | std::weak_ptr< SFSample > | link | ) |
Sets the associated right or left stereo sample.
| link | a pointer to the associated right or left stereo sample. |
| void sf2cute::SFSample::set_name | ( | std::string | name | ) |
Sets the name of this sample.
| name | the name of this sample. |
| void sf2cute::SFSample::set_original_key | ( | uint8_t | original_key | ) |
Sets the original MIDI key number of this sample.
| original_key | the MIDI key number of the recorded pitch of the sample. |
| void sf2cute::SFSample::set_sample_rate | ( | uint32_t | sample_rate | ) |
Sets the sample rate.
| sample_rate | the sample rate, in hertz. |
| void sf2cute::SFSample::set_start_loop | ( | uint32_t | start_loop | ) |
Sets the starting point of the loop of this sample.
| start_loop | the beginning index of the loop, in sample data points, inclusive. |
| void sf2cute::SFSample::set_type | ( | SFSampleLink | type | ) |
Sets both the type of sample and the whether the sample is located in RAM or ROM memory.
| type | both the type of sample and the whether the sample is located in RAM or ROM memory. |
|
noexcept |
Returns the starting point of the loop of this sample.
|
noexcept |
Returns both the type of sample and the whether the sample is located in RAM or ROM memory.