TracktionEngine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
engine::ProjectItem Class Reference

Represents a file-based resource that is used in a project. More...

#include <tracktion_ProjectItem.h>

Inheritance diagram for engine::ProjectItem:

Public Types

enum class  Category {
  none , edit , recorded , exports ,
  archives , imported , rendered , frozen ,
  video
}
 
enum class  RenameMode { always , local , never }
 
enum class  SetNameMode { doDefault , doDefaultSynchronous , forceRenameSynchronous , forceNoRename }
 
enum class  FileMode { absolute , relative , relativeIfWithinProject }
 
using Ptr = juce::ReferenceCountedObjectPtr< ProjectItem >
 
using Array = juce::ReferenceCountedArray< ProjectItem >
 
- Public Types inherited from engine::Selectable
using WeakRef = juce::WeakReference< Selectable >
 

Public Member Functions

 ProjectItem (Engine &, ProjectItemRef, juce::InputStream *)
 Loads a ProjectItem from a stream that was saved using writeToStream().
 
 ProjectItem (Engine &, const juce::String &name, const juce::String &type, const juce::String &desc, const juce::String &file, Category, double length, ProjectItemRef)
 Creates a ProjectItem with some settings.
 
 ProjectItem (Engine &, const juce::File &sourceFile, const juce::String &type, const juce::String &name, Category, Project &ownerProject)
 Creates a folder-backed ProjectItem with an absolute source file path.
 
 ~ProjectItem () override
 
juce::String getSelectableDescription () override
 Subclasses must return a description of what they are.
 
void selectionStatusChanged (bool isNowSelected) override
 Can be overridden to tell this object that it has just been selected or deselected.
 
const ProjectItemRefgetProjectItemRef () const noexcept
 Returns the ProjectItemRef that identifies this item.
 
juce::ReferenceCountedObjectPtr< ProjectgetProject () const
 
bool hasBeenDeleted () const
 
const juce::String & getType () const
 
bool isWave () const noexcept
 
bool isMidi () const noexcept
 
bool isEdit () const noexcept
 
bool isVideo () const noexcept
 
const juce::String & getName () const
 
void setName (const juce::String &name, SetNameMode)
 
Category getCategory () const
 
void setCategory (Category cat)
 
juce::String getNamedProperty (const juce::String &name) const
 
void setNamedProperty (const juce::String &name, const juce::String &value)
 
juce::String getDescription () const
 
void setDescription (const juce::String &newDesc, juce::NotificationType=juce::sendNotification)
 Sets the user-visible description text.
 
juce::Array< TimePositiongetMarkedPoints () const
 optional set of interesting time markers, for wave files
 
void setMarkedPoints (const juce::Array< TimePosition > &points)
 
void copyAllPropertiesFrom (const ProjectItem &other)
 copies the full description, categories, properties, etc.
 
void convertEditFile (std::function< void(bool)> callback)
 
double getLength () const
 
void setLength (double length)
 
juce::String getProjectName () const
 name of the project it's inside.
 
juce::File getSourceFile ()
 
juce::String getRawFileName () const
 
juce::String getFileName () const
 
void setSourceFile (const juce::File &, FileMode mode=FileMode::relativeIfWithinProject)
 
bool isForFile (const juce::File &)
 
bool isAbsolutePath () const
 
void convertToRelativePath ()
 
void convertToAbsolutePath ()
 
void renameSourceFile ()
 lets the user rename the file.
 
Ptr createCopy ()
 Creates a copy of this object and returns the copy.
 
void sendChange ()
 
bool copySectionToNewFile (const juce::File &destFile, juce::File &actualFileCreated, double startTime, double length)
 the actual file created may differ, e.g.
 
bool deleteSourceFile ()
 
void verifyLength (juce::NotificationType=juce::sendNotification)
 Updates the stored length value in this object.
 
void changeProjectId (ProjectID oldID, ProjectID newID)
 used when moving to another project.
 
void writeToStream (juce::OutputStream &) const
 
juce::StringArray getSearchTokens () const
 Returns a list of search strings for this object, by chopping up the name and description into words.
 
- Public Member Functions inherited from engine::Selectable
 Selectable ()
 
virtual ~Selectable ()
 
virtual void changed ()
 This should be called to send a change notification to any SelectableListeners that are registered with this object.
 
virtual void selectableAboutToBeDeleted ()
 Called just before the selectable is about to be deleted so any subclasses should still be valid at this point.
 
void addListener (SelectableListener *)
 
void removeListener (SelectableListener *)
 
void addSelectableListener (SelectableListener *)
 
void removeSelectableListener (SelectableListener *)
 
void cancelAnyPendingUpdates ()
 If changed() has been called, this will cancel any pending async change notificaions.
 
void deselect ()
 
void propertiesChanged ()
 
void notifyListenersOfDeletion ()
 
WeakRef getWeakRef ()
 

Static Public Member Functions

static const charwaveItemType () noexcept
 
static const chareditItemType () noexcept
 
static const charmidiItemType () noexcept
 
static const charvideoItemType () noexcept
 
- Static Public Member Functions inherited from engine::Selectable
static void initialise ()
 
static bool isSelectableValid (const Selectable *) noexcept
 checks whether this object has been deleted.
 

Public Attributes

Engineengine
 The Engine instance this belongs to.
 
- Public Attributes inherited from engine::Selectable
WeakRef::Master masterReference
 

Detailed Description

Represents a file-based resource that is used in a project.

This might be an edit, audio file, midi file, etc.

Member Typedef Documentation

◆ Ptr

using engine::ProjectItem::Ptr = juce::ReferenceCountedObjectPtr<ProjectItem>

◆ Array

using engine::ProjectItem::Array = juce::ReferenceCountedArray<ProjectItem>

Member Enumeration Documentation

◆ Category

Enumerator
none 
edit 
recorded 
exports 
archives 
imported 
rendered 
frozen 
video 

◆ RenameMode

Enumerator
always 
local 
never 

◆ SetNameMode

Enumerator
doDefault 
doDefaultSynchronous 
forceRenameSynchronous 
forceNoRename 

◆ FileMode

Enumerator
absolute 
relative 
relativeIfWithinProject 

Constructor & Destructor Documentation

◆ ProjectItem() [1/3]

engine::ProjectItem::ProjectItem ( Engine ,
ProjectItemRef  ,
juce::InputStream *   
)

Loads a ProjectItem from a stream that was saved using writeToStream().

◆ ProjectItem() [2/3]

engine::ProjectItem::ProjectItem ( Engine ,
const juce::String &  name,
const juce::String &  type,
const juce::String &  desc,
const juce::String &  file,
Category  ,
double  length,
ProjectItemRef   
)

Creates a ProjectItem with some settings.

◆ ProjectItem() [3/3]

engine::ProjectItem::ProjectItem ( Engine ,
const juce::File &  sourceFile,
const juce::String &  type,
const juce::String &  name,
Category  ,
Project ownerProject 
)

Creates a folder-backed ProjectItem with an absolute source file path.

◆ ~ProjectItem()

engine::ProjectItem::~ProjectItem ( )
override

Member Function Documentation

◆ getSelectableDescription()

juce::String engine::ProjectItem::getSelectableDescription ( )
overridevirtual

Subclasses must return a description of what they are.

Implements engine::Selectable.

◆ selectionStatusChanged()

void engine::ProjectItem::selectionStatusChanged ( bool  isNowSelected)
overridevirtual

Can be overridden to tell this object that it has just been selected or deselected.

Reimplemented from engine::Selectable.

◆ getProjectItemRef()

const ProjectItemRef & engine::ProjectItem::getProjectItemRef ( ) const
noexcept

Returns the ProjectItemRef that identifies this item.

◆ getProject()

juce::ReferenceCountedObjectPtr< Project > engine::ProjectItem::getProject ( ) const

◆ hasBeenDeleted()

bool engine::ProjectItem::hasBeenDeleted ( ) const

◆ waveItemType()

static const char * engine::ProjectItem::waveItemType ( )
staticnoexcept

◆ editItemType()

static const char * engine::ProjectItem::editItemType ( )
staticnoexcept

◆ midiItemType()

static const char * engine::ProjectItem::midiItemType ( )
staticnoexcept

◆ videoItemType()

static const char * engine::ProjectItem::videoItemType ( )
staticnoexcept

◆ getType()

const juce::String & engine::ProjectItem::getType ( ) const

◆ isWave()

bool engine::ProjectItem::isWave ( ) const
noexcept

◆ isMidi()

bool engine::ProjectItem::isMidi ( ) const
noexcept

◆ isEdit()

bool engine::ProjectItem::isEdit ( ) const
noexcept

◆ isVideo()

bool engine::ProjectItem::isVideo ( ) const
noexcept

◆ getName()

const juce::String & engine::ProjectItem::getName ( ) const

◆ setName()

void engine::ProjectItem::setName ( const juce::String &  name,
SetNameMode   
)

◆ getCategory()

Category engine::ProjectItem::getCategory ( ) const

◆ setCategory()

void engine::ProjectItem::setCategory ( Category  cat)

◆ getNamedProperty()

juce::String engine::ProjectItem::getNamedProperty ( const juce::String &  name) const

◆ setNamedProperty()

void engine::ProjectItem::setNamedProperty ( const juce::String &  name,
const juce::String &  value 
)

◆ getDescription()

juce::String engine::ProjectItem::getDescription ( ) const

◆ setDescription()

void engine::ProjectItem::setDescription ( const juce::String &  newDesc,
juce::NotificationType  = juce::sendNotification 
)

Sets the user-visible description text.

Pass juce::dontSendNotification to update it without broadcasting a change

  • used when restoring a persisted description during a folder scan, where firing a change would propagate to the owning project and retrigger the scan.

◆ getMarkedPoints()

juce::Array< TimePosition > engine::ProjectItem::getMarkedPoints ( ) const

optional set of interesting time markers, for wave files

◆ setMarkedPoints()

void engine::ProjectItem::setMarkedPoints ( const juce::Array< TimePosition > &  points)

◆ copyAllPropertiesFrom()

void engine::ProjectItem::copyAllPropertiesFrom ( const ProjectItem other)

copies the full description, categories, properties, etc.

◆ convertEditFile()

void engine::ProjectItem::convertEditFile ( std::function< void(bool)>  callback)

◆ getLength()

double engine::ProjectItem::getLength ( ) const

◆ setLength()

void engine::ProjectItem::setLength ( double  length)

◆ getProjectName()

juce::String engine::ProjectItem::getProjectName ( ) const

name of the project it's inside.

◆ getSourceFile()

juce::File engine::ProjectItem::getSourceFile ( )

◆ getRawFileName()

juce::String engine::ProjectItem::getRawFileName ( ) const

◆ getFileName()

juce::String engine::ProjectItem::getFileName ( ) const

◆ setSourceFile()

void engine::ProjectItem::setSourceFile ( const juce::File &  ,
FileMode  mode = FileMode::relativeIfWithinProject 
)

◆ isForFile()

bool engine::ProjectItem::isForFile ( const juce::File &  )

◆ isAbsolutePath()

bool engine::ProjectItem::isAbsolutePath ( ) const

◆ convertToRelativePath()

void engine::ProjectItem::convertToRelativePath ( )

◆ convertToAbsolutePath()

void engine::ProjectItem::convertToAbsolutePath ( )

◆ renameSourceFile()

void engine::ProjectItem::renameSourceFile ( )

lets the user rename the file.

◆ createCopy()

Ptr engine::ProjectItem::createCopy ( )

Creates a copy of this object and returns the copy.

◆ sendChange()

void engine::ProjectItem::sendChange ( )

◆ copySectionToNewFile()

bool engine::ProjectItem::copySectionToNewFile ( const juce::File &  destFile,
juce::File &  actualFileCreated,
double  startTime,
double  length 
)

the actual file created may differ, e.g.

if an ogg file is chopped up and has to become a wav.

◆ deleteSourceFile()

bool engine::ProjectItem::deleteSourceFile ( )

◆ verifyLength()

void engine::ProjectItem::verifyLength ( juce::NotificationType  = juce::sendNotification)

Updates the stored length value in this object.

Pass juce::dontSendNotification to update it without broadcasting a change

  • a change here propagates to the owning project, which makes project list UIs rebuild themselves.

◆ changeProjectId()

void engine::ProjectItem::changeProjectId ( ProjectID  oldID,
ProjectID  newID 
)

used when moving to another project.

◆ writeToStream()

void engine::ProjectItem::writeToStream ( juce::OutputStream &  ) const

◆ getSearchTokens()

juce::StringArray engine::ProjectItem::getSearchTokens ( ) const

Returns a list of search strings for this object, by chopping up the name and description into words.

Member Data Documentation

◆ engine

Engine& engine::ProjectItem::engine

The Engine instance this belongs to.


The documentation for this class was generated from the following file: