Csound Csound-dev Csound-tekno Search About

[Csnd-dev] Temporary Csound files

Date2016-03-31 13:06
FromTarmo Johannes
Subject[Csnd-dev] Temporary Csound files
Hi,

what do you think, it rose from discussion by issue https://github.com/CsoundQt/CsoundQt/issues/208

- Another option could be to display a warning "Don't forget to save the file with different file if you do any changes" but I think it is less safe.

Felipe suggested: I think the real fix is to have csoundqt save to a temporary file instead of the real file when running a file.



So what do you think, what should happen if a user presses "Open template"

Now a "Save As" dialog is immediately open not to overwrite the template.

From here another thought:

What if, there is a untitled.cd (like after New) in the editor and user presses Run, a Save dialog is opened. But maybe user just wants to try out a snippet and is not interested in keeping the file at all? Should there be perhaps a dialog "Run as temporary file (Press No if you want to save and use later)" -  it would be faster to try out snippets (like copied from e-mail etc).


tarmo



Date2016-03-31 13:32
FromFelipe Sateler
SubjectRe: [Csnd-dev] Temporary Csound files
Hi,

I think the long-term ideal solution would be that:

1. CsoundQT does not save any file (not only templates) on Run.
2. On Run, if the file has been changed, CsoundQT creates a temporary file in the same directory (if at all possible), and runs that file.
2a. Not sure how possible this is, but maybe it would be possible to not actually save any file, and just pass the file contents to csound via the API?
3. If the file is not modifiable (eg, it is a template shipped in /usr from an install package), then CsoundQT should open the file in read-only-mode. The file would only be modifiable after saving on a writable location.

If 2a is possible, that would be the best option.

Saludos




On 31 March 2016 at 09:06, Tarmo Johannes <trmjhnns@gmail.com> wrote:
Hi,

what do you think, it rose from discussion by issue https://github.com/CsoundQt/CsoundQt/issues/208

- Another option could be to display a warning "Don't forget to save the file with different file if you do any changes" but I think it is less safe.

Felipe suggested: I think the real fix is to have csoundqt save to a temporary file instead of the real file when running a file.



So what do you think, what should happen if a user presses "Open template"

Now a "Save As" dialog is immediately open not to overwrite the template.

From here another thought:

What if, there is a untitled.cd (like after New) in the editor and user presses Run, a Save dialog is opened. But maybe user just wants to try out a snippet and is not interested in keeping the file at all? Should there be perhaps a dialog "Run as temporary file (Press No if you want to save and use later)" -  it would be faster to try out snippets (like copied from e-mail etc).


tarmo





--

Saludos,
Felipe Sateler

Date2016-03-31 14:33
FromTarmo Johannes
SubjectRe: [Csnd-dev] Temporary Csound files

Hi,

Thanks for the suggestions!

I am in differekt opinion - I hink the automatic Save on Run is very good since if Csound ceashes, you have the last version saved to debug. Of course you can say that there is somewhere a temporary file saved and there could be use a crash restore feature but this way it is safer. Or if you just forget to press Save, your work is not lost.
So I am definitely for Save on Run.

But there could be a possibility to use a temporary file that you should not worry about.

Sending orchestra and score to running Csound instance without saving is not probably that easy since score needs preprocessing and samplerate etc must be known when Csound is started. So I think using CsoundCompile with the csd file is better that sending orc and sco as strings. As much I understand.

Others, what do you think?

Also I am thinking, I should add Templates and Scripts (if built with PythonQt)  to the make install target, so they get installed to /usr/share/qutecsound. We could have more templates - for live input, for Midi driven instruments etc. Or it is not worth the effort? Perhaps it could be a student or community work to invent and prepare them?

Maybe should discuss it also in users list...

Best!
Tarmo


Date2016-04-07 13:59
FromTarmo Johannes
SubjectRe: [Csnd-dev] Temporary Csound files

Hi,
This is not very democratic - to ask what you think and then do as I want ;)
Anyway, I implemented a feature, when you have untitled (new) file and you run it first time, you dont need to save it separately - you can just click Ok and a temporary file is used. Comfortable way to check out snippets from mailing list for example. There is a save option, too, of course.

Tarmo

31.03.2016 16:33 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,

Thanks for the suggestions!

I am in differekt opinion - I hink the automatic Save on Run is very good since if Csound ceashes, you have the last version saved to debug. Of course you can say that there is somewhere a temporary file saved and there could be use a crash restore feature but this way it is safer. Or if you just forget to press Save, your work is not lost.
So I am definitely for Save on Run.

But there could be a possibility to use a temporary file that you should not worry about.

Sending orchestra and score to running Csound instance without saving is not probably that easy since score needs preprocessing and samplerate etc must be known when Csound is started. So I think using CsoundCompile with the csd file is better that sending orc and sco as strings. As much I understand.

Others, what do you think?

Also I am thinking, I should add Templates and Scripts (if built with PythonQt)  to the make install target, so they get installed to /usr/share/qutecsound. We could have more templates - for live input, for Midi driven instruments etc. Or it is not worth the effort? Perhaps it could be a student or community work to invent and prepare them?

Maybe should discuss it also in users list...

Best!
Tarmo


Date2016-04-07 14:01
FromTarmo Johannes
SubjectRe: [Csnd-dev] Temporary Csound files

Sorry,
I wanted to send the message below to csoundqt-devel list...
Tarmo

07.04.2016 15:59 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,
This is not very democratic - to ask what you think and then do as I want ;)
Anyway, I implemented a feature, when you have untitled (new) file and you run it first time, you dont need to save it separately - you can just click Ok and a temporary file is used. Comfortable way to check out snippets from mailing list for example. There is a save option, too, of course.

Tarmo

31.03.2016 16:33 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,

Thanks for the suggestions!

I am in differekt opinion - I hink the automatic Save on Run is very good since if Csound ceashes, you have the last version saved to debug. Of course you can say that there is somewhere a temporary file saved and there could be use a crash restore feature but this way it is safer. Or if you just forget to press Save, your work is not lost.
So I am definitely for Save on Run.

But there could be a possibility to use a temporary file that you should not worry about.

Sending orchestra and score to running Csound instance without saving is not probably that easy since score needs preprocessing and samplerate etc must be known when Csound is started. So I think using CsoundCompile with the csd file is better that sending orc and sco as strings. As much I understand.

Others, what do you think?

Also I am thinking, I should add Templates and Scripts (if built with PythonQt)  to the make install target, so they get installed to /usr/share/qutecsound. We could have more templates - for live input, for Midi driven instruments etc. Or it is not worth the effort? Perhaps it could be a student or community work to invent and prepare them?

Maybe should discuss it also in users list...

Best!
Tarmo


Date2016-04-07 17:35
FromRory Walsh
SubjectRe: [Csnd-dev] Temporary Csound files
I'm curious have you tried this Windows? It might not be so easy to create the temporary file there. Anyhow, I meant to say that I agreed with you about 'enforcing' save. This feature has saved many a student from losing work when a crash takes place. Saving in Cabbage doubles as the recompile command, so it's impossible to lose any code. It's saved me on occasion too!  

On 7 April 2016 at 14:01, Tarmo Johannes <trmjhnns@gmail.com> wrote:

Sorry,
I wanted to send the message below to csoundqt-devel list...
Tarmo

07.04.2016 15:59 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,
This is not very democratic - to ask what you think and then do as I want ;)
Anyway, I implemented a feature, when you have untitled (new) file and you run it first time, you dont need to save it separately - you can just click Ok and a temporary file is used. Comfortable way to check out snippets from mailing list for example. There is a save option, too, of course.

Tarmo

31.03.2016 16:33 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,

Thanks for the suggestions!

I am in differekt opinion - I hink the automatic Save on Run is very good since if Csound ceashes, you have the last version saved to debug. Of course you can say that there is somewhere a temporary file saved and there could be use a crash restore feature but this way it is safer. Or if you just forget to press Save, your work is not lost.
So I am definitely for Save on Run.

But there could be a possibility to use a temporary file that you should not worry about.

Sending orchestra and score to running Csound instance without saving is not probably that easy since score needs preprocessing and samplerate etc must be known when Csound is started. So I think using CsoundCompile with the csd file is better that sending orc and sco as strings. As much I understand.

Others, what do you think?

Also I am thinking, I should add Templates and Scripts (if built with PythonQt)  to the make install target, so they get installed to /usr/share/qutecsound. We could have more templates - for live input, for Midi driven instruments etc. Or it is not worth the effort? Perhaps it could be a student or community work to invent and prepare them?

Maybe should discuss it also in users list...

Best!
Tarmo



Date2016-04-08 08:27
FromTarmo Johannes
SubjectRe: [Csnd-dev] Temporary Csound files

Yes, it works on Windows. Well it is not strictly speaking a real temporary file but a file in temporary folder that gets overwritten next time the same solution is used.


Luckily Qt takes care for finding the correct folder. All I need to do is to use


QString temporaryPath = QStandardPaths::writableLocation(QStandardPaths::TempLocation);


And Qt finds it for me on every platform.

But the "real" temporary files (used for example for running examples that are embedded in the program binary, Qt resources system) works flawlessly as well:


QTemporaryFile csdFile;

tmpFileName += QString("csound-tmpXXXXXXXX.csd");

csdFile.setFileTemplate(tmpFileName);

// etc


Greetings,

tarmo


2016-04-07 19:35 GMT+03:00 Rory Walsh <rorywalsh@ear.ie>:
I'm curious have you tried this Windows? It might not be so easy to create the temporary file there. Anyhow, I meant to say that I agreed with you about 'enforcing' save. This feature has saved many a student from losing work when a crash takes place. Saving in Cabbage doubles as the recompile command, so it's impossible to lose any code. It's saved me on occasion too!  

On 7 April 2016 at 14:01, Tarmo Johannes <trmjhnns@gmail.com> wrote:

Sorry,
I wanted to send the message below to csoundqt-devel list...
Tarmo

07.04.2016 15:59 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,
This is not very democratic - to ask what you think and then do as I want ;)
Anyway, I implemented a feature, when you have untitled (new) file and you run it first time, you dont need to save it separately - you can just click Ok and a temporary file is used. Comfortable way to check out snippets from mailing list for example. There is a save option, too, of course.

Tarmo

31.03.2016 16:33 kirjutas kuupäeval "Tarmo Johannes" <trmjhnns@gmail.com>:

Hi,

Thanks for the suggestions!

I am in differekt opinion - I hink the automatic Save on Run is very good since if Csound ceashes, you have the last version saved to debug. Of course you can say that there is somewhere a temporary file saved and there could be use a crash restore feature but this way it is safer. Or if you just forget to press Save, your work is not lost.
So I am definitely for Save on Run.

But there could be a possibility to use a temporary file that you should not worry about.

Sending orchestra and score to running Csound instance without saving is not probably that easy since score needs preprocessing and samplerate etc must be known when Csound is started. So I think using CsoundCompile with the csd file is better that sending orc and sco as strings. As much I understand.

Others, what do you think?

Also I am thinking, I should add Templates and Scripts (if built with PythonQt)  to the make install target, so they get installed to /usr/share/qutecsound. We could have more templates - for live input, for Midi driven instruments etc. Or it is not worth the effort? Perhaps it could be a student or community work to invent and prepare them?

Maybe should discuss it also in users list...

Best!
Tarmo