-Updated DiskWriter to use filename in session file
parent
b60d99e756
commit
8493a85cb9
|
@ -34,22 +34,23 @@ void DiskWriter::initialize(std::string path, std::string name )
|
||||||
|
|
||||||
void DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab )
|
void DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab )
|
||||||
{
|
{
|
||||||
|
// get the filename
|
||||||
|
stringstream filename;
|
||||||
|
filename << "t_" << track << "_s_" << scene << ".wav";
|
||||||
|
|
||||||
// add the track / scene / name combo to session JSON node
|
// add the track / scene / name combo to session JSON node
|
||||||
cJSON* clip = cJSON_CreateObject();
|
cJSON* clip = cJSON_CreateObject();
|
||||||
cJSON_AddItemToObject(session, "clip", clip );
|
cJSON_AddItemToObject(session, "clip", clip );
|
||||||
|
|
||||||
cJSON_AddNumberToObject(clip,"track", track);
|
cJSON_AddNumberToObject(clip,"track", track);
|
||||||
cJSON_AddNumberToObject(clip,"scene", scene);
|
cJSON_AddNumberToObject(clip,"scene", scene);
|
||||||
cJSON_AddStringToObject(clip,"file", "filenameHere.wav");
|
cJSON_AddStringToObject(clip,"file", filename.str().c_str());
|
||||||
|
|
||||||
|
|
||||||
// add the AudioBuffer metadata to the sample JSON node
|
// add the AudioBuffer metadata to the sample JSON node
|
||||||
cJSON* sampleClip = cJSON_CreateObject();
|
cJSON* sampleClip = cJSON_CreateObject();
|
||||||
cJSON_AddItemToObject(sample, "sample", sampleClip );
|
cJSON_AddItemToObject(sample, "sample", sampleClip );
|
||||||
|
|
||||||
stringstream filename;
|
|
||||||
filename << "t_" << track << "_s_" << scene << ".wav";
|
|
||||||
|
|
||||||
cJSON_AddStringToObject(sampleClip,"file", filename.str().c_str() );
|
cJSON_AddStringToObject(sampleClip,"file", filename.str().c_str() );
|
||||||
cJSON_AddNumberToObject(sampleClip,"beats", ab->getBeats() );
|
cJSON_AddNumberToObject(sampleClip,"beats", ab->getBeats() );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue