19 std::vector<unsigned char> m_mem;
20 std::vector<void *> m_malloc_mem;
22 static constexpr
size_t initial_size = 1024 * 1024;
23 static constexpr
size_t grow_size = 32 * 1024;
32 n = ((n + 63) / 64) * 64;
35 if (m_used + n > m_mem.size())
39 m_malloc_mem.push_back (result);
43 result = m_mem.data() + m_used;
51 for (
auto ptr : m_malloc_mem)
55 if (m_used > m_mem.size())
63 m_mem.resize (m_used + grow_size);
73 SPECTMORPH_CLASS_NON_COPYABLE (
RTVector);
78 size_t m_capacity = 0;
81 m_memory_area (memory_area)
85 assign (
const std::vector<T>& vec)
87 assert (m_size == 0 && m_capacity == 0);
89 set_capacity (vec.size());
90 std::copy (vec.begin(), vec.end(), m_start);
96 assert (m_size == 0 && m_capacity == 0);
98 set_capacity (vec.size());
99 std::copy (vec.m_start, vec.m_start + vec.m_size, m_start);
108 set_capacity (
size_t capacity)
110 assert (m_size == 0 && m_capacity == 0);
112 m_start = (T *) m_memory_area->alloc (sizeof (T) * capacity);
113 m_capacity = capacity;
116 push_back (
const T& t)
118 assert (m_size < m_capacity);
119 m_start[m_size++] = t;
124 return m_start[m_size - 1];
127 operator[] (
size_t idx)
132 operator[] (
size_t idx)
const
150 freqs.assign (audio_block.freqs);
151 mags.assign (audio_block.mags);
152 noise.assign (audio_block.noise);
157 freqs.assign (audio_block.
freqs);
158 mags.assign (audio_block.
mags);
159 noise.assign (audio_block.
noise);
166 freqs_f (
size_t i)
const
168 return sm_ifreq2freq (freqs[i]);
172 mags_f (
size_t i)
const
174 return sm_idb2factor (mags[i]);
178 noise_f (
size_t i)
const
180 return sm_idb2factor (noise[i]);
Block of audio data, encoded in SpectMorph parametric format.
Definition: smaudio.hh:28
std::vector< uint16_t > noise
noise envelope, representing the original signal minus sine components
Definition: smaudio.hh:30
std::vector< uint16_t > freqs
frequencies of the sine components of this frame
Definition: smaudio.hh:31
std::vector< uint16_t > mags
magnitudes of the sine components
Definition: smaudio.hh:32
Definition: smrtmemory.hh:139
Definition: smrtmemory.hh:16
Definition: smrtmemory.hh:72