MCPcopy Create free account
hub / github.com/Tracktion/tracktion_engine / loadAudioFileAsClip

Function loadAudioFileAsClip

examples/common/Utilities.h:150–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

148 }
149
150 inline te::WaveAudioClip::Ptr loadAudioFileAsClip (te::Edit& edit, const File& file)
151 {
152 // Find the first track and delete all clips from it
153 if (auto track = getOrInsertAudioTrackAt (edit, 0))
154 {
155 removeAllClips (*track);
156
157 // Add a new clip to this track
158 te::AudioFile audioFile (edit.engine, file);
159
160 if (audioFile.isValid())
161 if (auto newClip = track->insertWaveClip (file.getFileNameWithoutExtension(), file,
162 { { {}, te::TimeDuration::fromSeconds (audioFile.getLength()) }, {} }, false))
163 return newClip;
164 }
165
166 return {};
167 }
168
169 template<typename ClipType>
170 typename ClipType::Ptr loopAroundClip (ClipType& clip)

Callers 4

SimplePluginDemoMethod · 0.85
PlaybackDemoMethod · 0.85
setFileMethod · 0.85
setFileMethod · 0.85

Calls 5

getOrInsertAudioTrackAtFunction · 0.85
removeAllClipsFunction · 0.85
insertWaveClipMethod · 0.80
isValidMethod · 0.45
getLengthMethod · 0.45

Tested by

no test coverage detected