Warning: session_start(): open(/var/lib/php/sessions/sess_0o7beu4uo056reel43nfdkfqim, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
cmodule AudioClip > DynSCP {
File audioFile;
double windowSize = 0.01; // seconds
transient JAmplitudeGraph graph;
transient float[] volumeProfile;
transient short[] fullAudio;
start {
afterVisualize2(r updateGraph);
graph = swingNu JAmplitudeGraph();
}
void updateGraph enter {
if (!isFile(audioFile))
ret with setComponent(jcenteredbutton("Open audio file...", rThread openFile));
setComponent(northCenterAndSouthWithMargin(
jCenteredSection("File", dm_centeredLabel audioFile()),
jCenteredSection("Volume Profile", graph),
withMargin(jrightalignedbuttons(
"Play", rThread play,
"Open...", rThread openFile
))));
if (volumeProfile == null)
volumeProfile = decodeWAVToMonoSamples_floatVolumeProfile(audioFile, windowSize);
graph?.setValues(volumeProfile);
}
void updateProfile enter {
volumeProfile = null;
updateGraph();
}
void openFile enter {
File f = showFileChooser();
if (f != null) loadFile(f);
}
void loadFile(File f) {
setFields(audioFile := f, fullAudio := null);
updateProfile();
}
void loadFullAudio {
if (!isFile(audioFile)) ret;
fullAudio = convertSampleRate_stereoShortArray_simple(
decodeWAVToStereoSamples(audioFile),
wavSampleRate(audioFile), cdSampleRate());
}
void play enter {
if (fullAudio == null) loadFullAudio();
dm_addShortArraySoundSource(fullAudio);
}
}