TracktionEngine
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
tracktion::engine::dawproject Namespace Reference

DAWproject interchange format support. More...

Namespaces

namespace  xml
 DAWproject XML element and attribute names.
 

Classes

class  DAWprojectExporter
 Internal class for exporting an Edit to DAWproject format. More...
 
class  DAWprojectImporter
 Internal class for importing DAWproject files into an Edit. More...
 
class  IDGenerator
 ID generator for DAWproject XML elements. More...
 
class  IDRefResolver
 ID reference resolver for parsing DAWproject XML. More...
 
struct  ParseOptions
 Options for parsing a DAWproject file. More...
 
struct  WriteOptions
 Options for writing a DAWproject file. More...
 

Functions

std::unique_ptr< EditparseDAWproject (Engine &engine, const juce::File &file, ParseOptions options={})
 Parses a .dawproject file and creates an Edit.
 
tl::expected< std::unique_ptr< juce::XmlElement >, juce::String > createDAWproject (Edit &edit, WriteOptions options={})
 Creates the project.xml content from an Edit.
 
juce::Result writeDAWprojectFile (const juce::File &file, Edit &edit, WriteOptions options={})
 Writes a complete .dawproject file from an Edit.
 
float velocityToNormalized (int velocity)
 Velocity conversion between tracktion (0-127 int) and DAWproject (0.0-1.0 normalized).
 
int normalizedToVelocity (float normalized)
 
float controllerValueToNormalized (int value, int controllerType)
 MIDI controller value conversion.
 
int normalizedToControllerValue (float normalized, int controllerType)
 
const char * controllerTypeToExpression (int type)
 Maps tracktion MidiControllerEvent type to DAWproject expression type string.
 
int expressionToControllerType (const juce::String &expression)
 Maps DAWproject expression type string to tracktion MidiControllerEvent type.
 
double ticksToBeats (int64_t ticks, int ticksPerQuarterNote=defaultTicksPerQuarterNote)
 
int64_t beatsToTicks (double beats, int ticksPerQuarterNote=defaultTicksPerQuarterNote)
 
juce::String colourToDAWprojectString (juce::Colour colour)
 Color conversion between tracktion (juce::Colour) and DAWproject (CSS-style hex string).
 
juce::Colour dawprojectStringToColour (const juce::String &str)
 
double gainToDecibels (float gain)
 Volume conversion between linear gain and decibels.
 
float decibelsToGain (double dB)
 
void setAttributeIfNotEmpty (juce::XmlElement &element, const char *name, const juce::String &value)
 XML helper functions.
 
void setAttributeIfValid (juce::XmlElement &element, const char *name, double value)
 
std::unique_ptr< juce::XmlElement > createXmlElement (const char *tagName)
 
juce::XmlElement * addChildElement (juce::XmlElement &parent, const char *tagName)
 
double parseDouble (const juce::String &str, double defaultValue=0.0)
 Parses a double from a string, handling potential formatting differences.
 
int parseInt (const juce::String &str, int defaultValue=0)
 Parses an int from a string.
 
bool parseBool (const juce::String &str, bool defaultValue=false)
 Parses a bool from a string or attribute value.
 

Detailed Description

DAWproject interchange format support.

DAWproject is an open interchange format for digital audio workstation projects. It stores project data as XML files (project.xml, metadata.xml) bundled in a ZIP archive along with embedded audio files.

See also
https://github.com/bitwig/dawproject

Function Documentation

◆ parseDAWproject()

std::unique_ptr< Edit > tracktion::engine::dawproject::parseDAWproject ( Engine engine,
const juce::File &  file,
ParseOptions  options = {} 
)

Parses a .dawproject file and creates an Edit.

Parameters
engineThe Engine to use for the new Edit
fileThe .dawproject file
optionsOptions controlling the import behavior
Returns
A new Edit if successful, or nullptr on failure

◆ createDAWproject()

tl::expected< std::unique_ptr< juce::XmlElement >, juce::String > tracktion::engine::dawproject::createDAWproject ( Edit edit,
WriteOptions  options = {} 
)

Creates the project.xml content from an Edit.

Parameters
editThe Edit to export
optionsOptions controlling the export behavior
Returns
An XmlElement representing the project, or an error string

◆ writeDAWprojectFile()

juce::Result tracktion::engine::dawproject::writeDAWprojectFile ( const juce::File &  file,
Edit edit,
WriteOptions  options = {} 
)

Writes a complete .dawproject file from an Edit.

This creates a ZIP archive containing:

  • project.xml (the main project data)
  • metadata.xml (project metadata)
  • audio/ subdirectory with embedded audio files (if enabled)
  • plugins/ subdirectory with plugin state files (if enabled)
Parameters
fileThe destination .dawproject file
editThe Edit to export
optionsOptions controlling the export behavior
Returns
A Result indicating success or failure

◆ velocityToNormalized()

float tracktion::engine::dawproject::velocityToNormalized ( int  velocity)

Velocity conversion between tracktion (0-127 int) and DAWproject (0.0-1.0 normalized).

◆ normalizedToVelocity()

int tracktion::engine::dawproject::normalizedToVelocity ( float  normalized)

◆ controllerValueToNormalized()

float tracktion::engine::dawproject::controllerValueToNormalized ( int  value,
int  controllerType 
)

MIDI controller value conversion.

tracktion_engine stores most controller values as 14-bit (value << 7 for 7-bit CCs). DAWproject uses normalized 0.0-1.0 values.

References tracktion::engine::MidiControllerEvent::pitchWheelType.

◆ normalizedToControllerValue()

int tracktion::engine::dawproject::normalizedToControllerValue ( float  normalized,
int  controllerType 
)

◆ controllerTypeToExpression()

const char * tracktion::engine::dawproject::controllerTypeToExpression ( int  type)

◆ expressionToControllerType()

int tracktion::engine::dawproject::expressionToControllerType ( const juce::String &  expression)

Maps DAWproject expression type string to tracktion MidiControllerEvent type.

For channelController, returns -1 (caller should use the controller attribute).

References tracktion::engine::MidiControllerEvent::aftertouchType, tracktion::engine::MidiControllerEvent::channelPressureType, tracktion::engine::MidiControllerEvent::pitchWheelType, and tracktion::engine::MidiControllerEvent::programChangeType.

◆ ticksToBeats()

double tracktion::engine::dawproject::ticksToBeats ( int64_t  ticks,
int  ticksPerQuarterNote = defaultTicksPerQuarterNote 
)

◆ beatsToTicks()

int64_t tracktion::engine::dawproject::beatsToTicks ( double  beats,
int  ticksPerQuarterNote = defaultTicksPerQuarterNote 
)

◆ colourToDAWprojectString()

juce::String tracktion::engine::dawproject::colourToDAWprojectString ( juce::Colour  colour)

Color conversion between tracktion (juce::Colour) and DAWproject (CSS-style hex string).

◆ dawprojectStringToColour()

juce::Colour tracktion::engine::dawproject::dawprojectStringToColour ( const juce::String &  str)

◆ gainToDecibels()

double tracktion::engine::dawproject::gainToDecibels ( float  gain)

Volume conversion between linear gain and decibels.

◆ decibelsToGain()

float tracktion::engine::dawproject::decibelsToGain ( double  dB)

◆ setAttributeIfNotEmpty()

void tracktion::engine::dawproject::setAttributeIfNotEmpty ( juce::XmlElement &  element,
const char *  name,
const juce::String &  value 
)

XML helper functions.

◆ setAttributeIfValid()

void tracktion::engine::dawproject::setAttributeIfValid ( juce::XmlElement &  element,
const char *  name,
double  value 
)

◆ createXmlElement()

std::unique_ptr< juce::XmlElement > tracktion::engine::dawproject::createXmlElement ( const char *  tagName)

◆ addChildElement()

juce::XmlElement * tracktion::engine::dawproject::addChildElement ( juce::XmlElement &  parent,
const char *  tagName 
)

◆ parseDouble()

double tracktion::engine::dawproject::parseDouble ( const juce::String &  str,
double  defaultValue = 0.0 
)

Parses a double from a string, handling potential formatting differences.

◆ parseInt()

int tracktion::engine::dawproject::parseInt ( const juce::String &  str,
int  defaultValue = 0 
)

Parses an int from a string.

◆ parseBool()

bool tracktion::engine::dawproject::parseBool ( const juce::String &  str,
bool  defaultValue = false 
)

Parses a bool from a string or attribute value.