#315 Provide Audacity "list of file" for session
This commit is contained in:
parent
ab92abfd63
commit
552b3ba5f3
5 changed files with 91 additions and 45 deletions
|
@ -19,7 +19,7 @@
|
||||||
- bug fix: on MacOS declare an activity to ensure the process doesn't get throttled
|
- bug fix: on MacOS declare an activity to ensure the process doesn't get throttled
|
||||||
by OS level Nap, Sleep, and Thread Priority systems, coded by AronVietti (#23)
|
by OS level Nap, Sleep, and Thread Priority systems, coded by AronVietti (#23)
|
||||||
|
|
||||||
|
- add Audacity "list of files" writer to jam recorder, by pljones (#315)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -32,21 +32,6 @@
|
||||||
|
|
||||||
namespace recorder {
|
namespace recorder {
|
||||||
|
|
||||||
struct STrackItem
|
|
||||||
{
|
|
||||||
STrackItem(int numAudioChannels, qint64 startFrame, qint64 frameCount, QString fileName) :
|
|
||||||
numAudioChannels(numAudioChannels),
|
|
||||||
startFrame(startFrame),
|
|
||||||
frameCount(frameCount),
|
|
||||||
fileName(fileName)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int numAudioChannels;
|
|
||||||
qint64 startFrame;
|
|
||||||
qint64 frameCount;
|
|
||||||
QString fileName;
|
|
||||||
};
|
|
||||||
|
|
||||||
class CReaperItem : public QObject
|
class CReaperItem : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -59,12 +44,6 @@ private:
|
||||||
const QUuid iguid = QUuid::createUuid();
|
const QUuid iguid = QUuid::createUuid();
|
||||||
const QUuid guid = QUuid::createUuid();
|
const QUuid guid = QUuid::createUuid();
|
||||||
QString out;
|
QString out;
|
||||||
|
|
||||||
inline QString secondsAt48K( const qint64 frames,
|
|
||||||
const int frameSize )
|
|
||||||
{
|
|
||||||
return QString::number( static_cast<double>( frames * frameSize ) / 48000, 'f', 14 );
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class CReaperTrack : public QObject
|
class CReaperTrack : public QObject
|
||||||
|
|
|
@ -27,6 +27,31 @@
|
||||||
|
|
||||||
namespace recorder {
|
namespace recorder {
|
||||||
|
|
||||||
|
inline QString secondsAt48K( const qint64 frames,
|
||||||
|
const int frameSize )
|
||||||
|
{
|
||||||
|
return QString::number( static_cast<double>( frames * frameSize ) / 48000, 'f', 14 );
|
||||||
|
}
|
||||||
|
|
||||||
|
struct STrackItem
|
||||||
|
{
|
||||||
|
STrackItem ( int numAudioChannels,
|
||||||
|
qint64 startFrame,
|
||||||
|
qint64 frameCount,
|
||||||
|
QString fileName ) :
|
||||||
|
numAudioChannels ( numAudioChannels ),
|
||||||
|
startFrame ( startFrame ),
|
||||||
|
frameCount ( frameCount ),
|
||||||
|
fileName ( fileName )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int numAudioChannels;
|
||||||
|
qint64 startFrame;
|
||||||
|
qint64 frameCount;
|
||||||
|
QString fileName;
|
||||||
|
};
|
||||||
|
|
||||||
class HdrRiff
|
class HdrRiff
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -381,35 +381,15 @@ void CJamRecorder::OnEnd()
|
||||||
isRecording = false;
|
isRecording = false;
|
||||||
currentSession->End();
|
currentSession->End();
|
||||||
|
|
||||||
QString reaperProjectFileName = currentSession->SessionDir().filePath(currentSession->Name().append(".rpp"));
|
ReaperProjectFromCurrentSession();
|
||||||
const QFileInfo fi(reaperProjectFileName);
|
AudacityLofFromCurrentSession();
|
||||||
|
|
||||||
if (fi.exists())
|
|
||||||
{
|
|
||||||
qWarning() << "CJamRecorder::OnEnd():" << fi.absolutePath() << "exists and will not be overwritten.";
|
|
||||||
reaperProjectFileName = QString::Null();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
QFile outf (reaperProjectFileName);
|
|
||||||
if ( outf.open(QFile::WriteOnly) )
|
|
||||||
{
|
|
||||||
QTextStream out(&outf);
|
|
||||||
out << CReaperProject( currentSession->Tracks(), iServerFrameSizeSamples ).toString() << endl;
|
|
||||||
qDebug() << "Session RPP:" << reaperProjectFileName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qWarning() << "CJamRecorder::OnEnd():" << fi.absolutePath() << "could not be created, no RPP written.";
|
|
||||||
reaperProjectFileName = QString::Null();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
delete currentSession;
|
delete currentSession;
|
||||||
currentSession = nullptr;
|
currentSession = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CJamRecorder::OnTriggerSession End one session and start a new one
|
* @brief CJamRecorder::OnTriggerSession End one session and start a new one
|
||||||
*/
|
*/
|
||||||
|
@ -432,6 +412,66 @@ void CJamRecorder::OnAboutToQuit()
|
||||||
thisThread->exit();
|
thisThread->exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CJamRecorder::ReaperProjectFromCurrentSession()
|
||||||
|
{
|
||||||
|
QString reaperProjectFileName = currentSession->SessionDir().filePath(currentSession->Name().append(".rpp"));
|
||||||
|
const QFileInfo fi(reaperProjectFileName);
|
||||||
|
|
||||||
|
if (fi.exists())
|
||||||
|
{
|
||||||
|
qWarning() << "CJamRecorder::ReaperProjectFromCurrentSession():" << fi.absolutePath() << "exists and will not be overwritten.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFile outf (reaperProjectFileName);
|
||||||
|
if ( outf.open(QFile::WriteOnly) )
|
||||||
|
{
|
||||||
|
QTextStream out(&outf);
|
||||||
|
out << CReaperProject( currentSession->Tracks(), iServerFrameSizeSamples ).toString() << endl;
|
||||||
|
qDebug() << "Session RPP:" << reaperProjectFileName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "CJamRecorder::ReaperProjectFromCurrentSession():" << fi.absolutePath() << "could not be created, no RPP written.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CJamRecorder::AudacityLofFromCurrentSession()
|
||||||
|
{
|
||||||
|
QString audacityLofFileName = currentSession->SessionDir().filePath(currentSession->Name().append(".lof"));
|
||||||
|
const QFileInfo fi(audacityLofFileName);
|
||||||
|
|
||||||
|
if (fi.exists())
|
||||||
|
{
|
||||||
|
qWarning() << "CJamRecorder::AudacityLofFromCurrentSession():" << fi.absolutePath() << "exists and will not be overwritten.";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QFile outf (audacityLofFileName);
|
||||||
|
if ( outf.open(QFile::WriteOnly) )
|
||||||
|
{
|
||||||
|
QTextStream sOut(&outf);
|
||||||
|
|
||||||
|
foreach ( auto trackName, currentSession->Tracks().keys() )
|
||||||
|
{
|
||||||
|
foreach ( auto item, currentSession->Tracks()[trackName] ) {
|
||||||
|
QFileInfo fi ( item.fileName );
|
||||||
|
sOut << "file " << '"' << fi.fileName() << '"';
|
||||||
|
sOut << " offset " << secondsAt48K( item.startFrame, iServerFrameSizeSamples ) << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sOut.flush();
|
||||||
|
qDebug() << "Session LOF:" << audacityLofFileName;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning() << "CJamRecorder::AudacityLofFromCurrentSession():" << fi.absolutePath() << "could not be created, no LOF written.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief CJamRecorder::SessionDirToReaper Replica of CJamRecorder::OnEnd() but using the directory contents to construct the CReaperProject object
|
* @brief CJamRecorder::SessionDirToReaper Replica of CJamRecorder::OnEnd() but using the directory contents to construct the CReaperProject object
|
||||||
* @param strSessionDirName
|
* @param strSessionDirName
|
||||||
|
|
|
@ -159,6 +159,8 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Start();
|
void Start();
|
||||||
|
void ReaperProjectFromCurrentSession();
|
||||||
|
void AudacityLofFromCurrentSession();
|
||||||
|
|
||||||
QDir recordBaseDir;
|
QDir recordBaseDir;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue