mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-05 13:15:44 +01:00
Create export temporary files in the export directory
git-svn-id: svn://localhost/ardour2/branches/3.0@13371 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
b5c5fc7a08
commit
c8a4bdc4a4
2 changed files with 31 additions and 4 deletions
|
|
@ -1,6 +1,9 @@
|
|||
#ifndef AUDIOGRAPHER_TMP_FILE_H
|
||||
#define AUDIOGRAPHER_TMP_FILE_H
|
||||
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
|
||||
#include "sndfile_writer.h"
|
||||
#include "sndfile_reader.h"
|
||||
|
||||
|
|
@ -12,14 +15,29 @@ template<typename T = DefaultSampleType>
|
|||
class TmpFile : public SndfileWriter<T>, public SndfileReader<T>
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
/// \a filename_template must match the requirements for mkstemp, i.e. end in "XXXXXX"
|
||||
TmpFile (char * filename_template, int format, ChannelCount channels, framecnt_t samplerate)
|
||||
: SndfileHandle (mkstemp(filename_template), true, SndfileBase::ReadWrite, format, channels, samplerate)
|
||||
, filename (filename_template)
|
||||
{}
|
||||
|
||||
TmpFile (int format, ChannelCount channels, framecnt_t samplerate)
|
||||
: SndfileHandle (fileno (tmpfile()), true, SndfileBase::ReadWrite, format, channels, samplerate)
|
||||
{}
|
||||
|
||||
|
||||
TmpFile (TmpFile const & other) : SndfileHandle (other) {}
|
||||
using SndfileHandle::operator=;
|
||||
|
||||
|
||||
~TmpFile()
|
||||
{
|
||||
if (!filename.empty()) {
|
||||
std::remove(filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::string filename;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue