-
Notifications
You must be signed in to change notification settings - Fork 227
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pljones/feature/pljones-audio-stream-saving
Feature/pljones audio stream saving
- Loading branch information
Showing
20 changed files
with
1,128 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
#include "creaperproject.h" | ||
|
||
/** | ||
* @brief operator << Write details of the STrackItem to the QTextStream | ||
* @param os the QTextStream | ||
* @param trackItem the STrackItem | ||
* @return the QTextStream | ||
* | ||
* Note: unused? | ||
*/ | ||
QTextStream& operator<<(QTextStream& os, const recorder::STrackItem& trackItem) | ||
{ | ||
os << "_track( " | ||
<< "numAudioChannels(" << trackItem.numAudioChannels << ")" | ||
<< ", startFrame(" << trackItem.startFrame << ")" | ||
<< ", frameCount(" << trackItem.frameCount << ")" | ||
<< ", fileName(" << trackItem.fileName << ")" | ||
<< " );"; | ||
return os; | ||
} | ||
|
||
/******************************************************************************\ | ||
* recorder methods * | ||
\******************************************************************************/ | ||
using namespace recorder; | ||
|
||
// Reaper Project writer ------------------------------------------------------- | ||
|
||
/** | ||
* @brief CReaperItem::CReaperItem Construct a Reaper RPP "<ITEM>" for a given RIFF WAVE file | ||
* @param name the item name | ||
* @param trackItem the details of where the item is in the track, along with the RIFF WAVE filename | ||
* @param iid the sequential item id | ||
*/ | ||
CReaperItem::CReaperItem(const QString& name, const STrackItem& trackItem, const qint32& iid) | ||
{ | ||
QString wavName = trackItem.fileName; // assume RPP in same location... | ||
|
||
QTextStream sOut(&out); | ||
|
||
sOut << " <ITEM " << endl; | ||
sOut << " FADEIN 0 0 0 0 0 0" << endl; | ||
sOut << " FADEOUT 0 0 0 0 0 0" << endl; | ||
sOut << " POSITION " << secondsAt48K(trackItem.startFrame) << endl; | ||
sOut << " LENGTH " << secondsAt48K(trackItem.frameCount) << endl; | ||
sOut << " IGUID " << iguid.toString() << endl; | ||
sOut << " IID " << iid << endl; | ||
sOut << " NAME " << name << endl; | ||
sOut << " GUID " << guid.toString() << endl; | ||
|
||
sOut << " <SOURCE WAVE" << endl; | ||
sOut << " FILE " << '"' << wavName << '"' << endl; | ||
sOut << " >" << endl; | ||
|
||
sOut << " >"; | ||
|
||
sOut.flush(); | ||
} | ||
|
||
/** | ||
* @brief CReaperTrack::CReaperTrack Construct a Reaper RPP "<TRACK>" for a given list of track items | ||
* @param name the track name | ||
* @param iid the sequential track id | ||
* @param items the list of items in the track | ||
*/ | ||
CReaperTrack::CReaperTrack(QString name, qint32& iid, QList<STrackItem> items) | ||
{ | ||
QTextStream sOut(&out); | ||
|
||
sOut << " <TRACK " << trackId.toString() << endl; | ||
sOut << " NAME " << name << endl; | ||
sOut << " TRACKID " << trackId.toString() << endl; | ||
|
||
int ino = 1; | ||
foreach (auto item, items) { | ||
sOut << CReaperItem(name + " (" + QString::number(ino) + ")", item, iid).toString() << endl; | ||
ino++; | ||
iid++; | ||
} | ||
sOut << " >"; | ||
|
||
sOut.flush(); | ||
} | ||
|
||
/** | ||
* @brief CReaperProject::CReaperProject Construct a Reaper RPP "<REAPER_PROJECT>" for a given list of tracks | ||
* @param tracks the list of tracks | ||
*/ | ||
CReaperProject::CReaperProject(QMap<QString, QList<STrackItem>> tracks) | ||
{ | ||
QTextStream sOut(&out); | ||
|
||
sOut << "<REAPER_PROJECT 0.1 \"5.0\" 1551567848" << endl; | ||
sOut << " RECORD_PATH \"\" \"\"" << endl; | ||
sOut << " SAMPLERATE 48000 0 0" << endl; | ||
sOut << " TEMPO 120 4 4" << endl; | ||
|
||
qint32 iid = 0; | ||
foreach(auto trackName, tracks.keys()) | ||
{ | ||
sOut << CReaperTrack(trackName, iid, tracks[trackName]).toString() << endl; | ||
} | ||
|
||
sOut << ">"; | ||
|
||
sOut.flush(); | ||
} |
Oops, something went wrong.