mirror of
https://github.com/vale981/openAV-Luppp
synced 2025-03-05 17:11:40 -05:00
-Updated DiskWriter, saves in any dir now
This commit is contained in:
parent
3757f40414
commit
487926d5a7
5 changed files with 14 additions and 16 deletions
|
@ -28,6 +28,11 @@ IF(BUILD_TESTS)
|
|||
SET(CMAKE_EXE_LINKER_FLAGS "-fprofile-arcs -ftest-coverage")
|
||||
ENDIF(BUILD_TESTS)
|
||||
|
||||
IF(RELEASE_BUILD)
|
||||
SET(CMAKE_CXX_FLAGS "-g -O2 -Wall -ffast-math")
|
||||
SET(CMAKE_C_FLAGS "-g -O2 -Wall -W -ffast-math")
|
||||
ENDIF(RELEASE_BUILD)
|
||||
|
||||
|
||||
# Add all files
|
||||
FILE(GLOB sources *.cxx avtk/*.cxx cjson/*.c controller/*.cxx dsp/*.cxx observer/*.cxx state/*.cxx tests/*.cxx)
|
||||
|
|
|
@ -36,12 +36,5 @@ void luppp_debug( int warnLevel, const char* name, const char* file, const char*
|
|||
}
|
||||
printf( "\n" );
|
||||
|
||||
#ifdef DEBUG_KILL_ON_ERR
|
||||
if ( warnLevel == DEBUG_LEVEL_KILL )
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,15 +20,14 @@ using namespace std;
|
|||
|
||||
DiskWriter::DiskWriter()
|
||||
{
|
||||
session = cJSON_CreateObject();
|
||||
sample = cJSON_CreateObject();
|
||||
};
|
||||
|
||||
void DiskWriter::initialize(std::string path, std::string name )
|
||||
{
|
||||
sessionPath = getenv("HOME");
|
||||
sessionName = "lupppSession";
|
||||
|
||||
session = cJSON_CreateObject();
|
||||
sample = cJSON_CreateObject();
|
||||
sessionName = name;
|
||||
}
|
||||
|
||||
int DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab )
|
||||
|
@ -51,7 +50,7 @@ int DiskWriter::writeAudioBuffer(int track, int scene, AudioBuffer* ab )
|
|||
// FIXME: trim trailing / sessionPath from session path if its there
|
||||
|
||||
stringstream path;
|
||||
path << sessionPath << sessionName << "/samples/" << filename.str();
|
||||
path << sessionPath << "/" << sessionName << "/samples/" << filename.str();
|
||||
|
||||
SndfileHandle outfile( path.str(), SFM_WRITE, SF_FORMAT_WAV | SF_FORMAT_FLOAT, 1, 44100);
|
||||
cout << "Worker::writeSample() " << path.str() << " size: " << ab->getAudioFrames() << endl;
|
||||
|
@ -92,7 +91,7 @@ void DiskWriter::writeMaster()
|
|||
|
||||
}
|
||||
|
||||
int DiskWriter::writeSession( std::string path, std::string sessionName )
|
||||
int DiskWriter::writeSession()
|
||||
{
|
||||
// add session metadata
|
||||
cJSON_AddItemToObject ( session, "session", cJSON_CreateString( sessionName.c_str() ));
|
||||
|
@ -154,7 +153,7 @@ int DiskWriter::writeSession( std::string path, std::string sessionName )
|
|||
|
||||
// write session.luppp JSON node to <path>/<sessionName>.luppp
|
||||
stringstream sessionDir;
|
||||
sessionDir << getenv("HOME") << "/" << sessionName;
|
||||
sessionDir << sessionPath << "/" << sessionName;
|
||||
int sessionDirError = mkdir( sessionDir.str().c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH );
|
||||
if ( sessionDirError )
|
||||
{
|
||||
|
|
|
@ -35,7 +35,8 @@ class DiskWriter
|
|||
/// writes a single audio buffer to disk
|
||||
int writeAudioBuffer(int track, int scene, AudioBuffer* ab );
|
||||
|
||||
int writeSession( std::string path, std::string sessionName );
|
||||
/// flush the JSON to disk, finalizing the save
|
||||
int writeSession();
|
||||
|
||||
#ifdef BUILD_TESTS
|
||||
int runTests();
|
||||
|
|
|
@ -123,7 +123,7 @@ void handleGuiEvents()
|
|||
#ifdef DEBUG_SAVE
|
||||
cout << "EventSaveFinish!" << endl;
|
||||
#endif
|
||||
gui->getDiskWriter()->writeSession("path", "sessionName");
|
||||
gui->getDiskWriter()->writeSession();
|
||||
} break; }
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue