Hi !
what are the options to save datas to a file with SDK ? seems to me it is only possible to save a wavefile
maybe it is possible to use sdkSaveToDiskAudioFile (AudioFilePtr audiofile, AnsiCharPtr name, int nbChannels)
with a different extention (for exemple .dhh)
and make a special reader
TPrecision only tho, so not good for timestamps...
any idea ?
cheers
store data to file
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
not that an expert in file hanling, but i now you can use C++ standard files functions, already did read write some stuff.
read/write binary or classic text files mainly, there are several methods. i don't recall all but can check c++ reference, filestream for ex
found back in kinda preset manager that stored datas as text lines i used something like this for ex:
void Preset::SaveToFile(string Path)
{
ofstream outfile;
outfile.open(Path);
// do your lines stuff here ie float to string
outfile << "blablastring" << endl; //line0
outfile << "second line txt" << endl; //line 1 ect, or use a loop
outfile.close();
}
///////////////////////////////
void Preset::ReadFromFile(string Path)
{
fstream infile;
infile.open(Path);
string line;
float F_value = 0;
while (getline(infile, line))
{
getline(infile, line);
F_value = atof(line.c_str()); //string to F value line after line
}
infile.close();
}
//////////////////////////////////////////
or used a different binary one on in other project, among those lines to read wav floats that where saved in a raw binary file, so easier as had no header to mess with
but maybe could start the 'effective' reading after the number of bytes of header if plan using wave files
myfile = fopen(input_file_name, "rb"); //read binary mode
fseek(myfile, 0L, SEEK_END); //scrub all the file
nb_elements = ftell(myfile); // retrieve nb of elements
nb_elements /= 4; // as floats are 4 bytes
rewind(myfile); //returns back at start
values = new float[nb_elements]; // array of float that will get values
fread(values, sizeof(float), nb_elements, myfile); // read file bytes and store to values array
fclose(myfile);
// do stuff with the retrieved array then
//////////
read/write binary or classic text files mainly, there are several methods. i don't recall all but can check c++ reference, filestream for ex
found back in kinda preset manager that stored datas as text lines i used something like this for ex:
void Preset::SaveToFile(string Path)
{
ofstream outfile;
outfile.open(Path);
// do your lines stuff here ie float to string
outfile << "blablastring" << endl; //line0
outfile << "second line txt" << endl; //line 1 ect, or use a loop
outfile.close();
}
///////////////////////////////
void Preset::ReadFromFile(string Path)
{
fstream infile;
infile.open(Path);
string line;
float F_value = 0;
while (getline(infile, line))
{
getline(infile, line);
F_value = atof(line.c_str()); //string to F value line after line
}
infile.close();
}
//////////////////////////////////////////
or used a different binary one on in other project, among those lines to read wav floats that where saved in a raw binary file, so easier as had no header to mess with
but maybe could start the 'effective' reading after the number of bytes of header if plan using wave files
myfile = fopen(input_file_name, "rb"); //read binary mode
fseek(myfile, 0L, SEEK_END); //scrub all the file
nb_elements = ftell(myfile); // retrieve nb of elements
nb_elements /= 4; // as floats are 4 bytes
rewind(myfile); //returns back at start
values = new float[nb_elements]; // array of float that will get values
fread(values, sizeof(float), nb_elements, myfile); // read file bytes and store to values array
fclose(myfile);
// do stuff with the retrieved array then
//////////
Thanks 23fx23 , I'll try that.
So far I managed to save in the patch with the chunk system. But definitly will complete the module with a save /load to file option.
Also made a 128x128 for crazy midi stuff
Cheers
So far I managed to save in the patch with the chunk system. But definitly will complete the module with a save /load to file option.
Also made a 128x128 for crazy midi stuff
Cheers
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
-
sm_jamieson
- Member
- Posts: 551
- Contact:
I used the "pugixml" C++ library for reading and writing XML files (used to save my module's own data settings).
thanks all, that will help !
XML is brilliant as it can organize data and we can make query and mad stuff.
filestream is more straight forwards and is a good candidate for plain array data.
time vs ideas...
cheers
Olivar
XML is brilliant as it can organize data and we can make query and mad stuff.
filestream is more straight forwards and is a good candidate for plain array data.
time vs ideas...
cheers
Olivar
http://oli-lab.org
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Win11 Ryzen9/32GB RAM - RME MADIFACE - SSL alpha link 4-16 - OSC capable interfaces
follow OLI_LAB adventures on Mastodon
@olivar_premier@mastodon.social
Who is online
Users browsing this forum: No registered users and 60 guests
