libdcp
Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
dcp::SoundAssetWriter Class Reference

A helper class for writing to SoundAssets. More...

#include <sound_asset_writer.h>

Inheritance diagram for dcp::SoundAssetWriter:
dcp::AssetWriter

Classes

struct  ASDCPState
 

Public Member Functions

void write (float const *const *data, int channels, int frames)
 
void write (int32_t const *const *data, int channels, int frames)
 
bool finalize () override
 
- Public Member Functions inherited from dcp::AssetWriter
 AssetWriter (AssetWriter const &)=delete
 
AssetWriteroperator= (AssetWriter const &)=delete
 
int64_t frames_written () const
 

Private Member Functions

byte_t * frame_buffer_data () const
 
int frame_buffer_capacity () const
 
template<class T >
void do_write (T const *const *data, int data_channels, int frames)
 
 SoundAssetWriter (SoundAsset *, boost::filesystem::path, std::vector< dcp::Channel > extra_active_channels, bool sync, bool include_mca_subdescriptors)
 
void start ()
 
void write_current_frame ()
 
std::vector< bool > create_sync_packets ()
 

Private Attributes

std::shared_ptr< ASDCPState > _state
 
SoundAsset_asset = nullptr
 
int _frame_buffer_offset = 0
 
std::vector< dcp::Channel_extra_active_channels
 
bool _sync = false
 
int _sync_packet = 0
 
FSK _fsk
 
bool _include_mca_subdescriptors = true
 

Friends

class SoundAsset
 
struct ::sync_test1
 

Additional Inherited Members

- Protected Member Functions inherited from dcp::AssetWriter
 AssetWriter (MXF *mxf, boost::filesystem::path file)
 
- Protected Attributes inherited from dcp::AssetWriter
MXF_mxf = nullptr
 
boost::filesystem::path _file
 
int64_t _frames_written = 0
 
bool _finalized = false
 
bool _started = false
 
std::shared_ptr< EncryptionContext_crypto_context
 

Detailed Description

A helper class for writing to SoundAssets.

Objects of this class can only be created with SoundAsset::start_write().

Sound samples can be written to the SoundAsset by calling write() with a buffer of float values. finalize() must be called after the last samples have been written.

Definition at line 92 of file sound_asset_writer.h.

Member Function Documentation

◆ create_sync_packets()

vector< bool > SoundAssetWriter::create_sync_packets ( )
private

Calculate and return the sync packets required for this edit unit (aka "frame")

Definition at line 296 of file sound_asset_writer.cc.

◆ finalize()

bool SoundAssetWriter::finalize ( )
overridevirtual
Returns
true if anything was written by this writer

Reimplemented from dcp::AssetWriter.

Definition at line 276 of file sound_asset_writer.cc.

◆ write() [1/2]

void SoundAssetWriter::write ( float const *const *  data,
int  channels,
int  frames 
)
Parameters
dataPointer an array of float pointers, one for each channel.
channelsNumber of channels in data; if this is less than the channels in the asset the remaining asset channels will be padded with silence.
framesNumber of frames i.e. number of floats that are given for each channel.

Definition at line 246 of file sound_asset_writer.cc.

◆ write() [2/2]

void SoundAssetWriter::write ( int32_t const *const *  data,
int  channels,
int  frames 
)
Parameters
dataPointer an array of int32_t pointers, one for each channel. The 24-bit audio sample should be in the lower 24 bits of the int32_t.
channelsNumber of channels in data; if this is less than the channels in the asset the remaining asset channels will be padded with silence.
framesNumber of frames i.e. number of floats that are given for each channel.

Definition at line 253 of file sound_asset_writer.cc.

Member Data Documentation

◆ _sync

bool dcp::SoundAssetWriter::_sync = false
private

true to ignore any signal passed to write() on channel 14 and instead write a sync track

Definition at line 182 of file sound_asset_writer.h.

◆ _sync_packet

int dcp::SoundAssetWriter::_sync_packet = 0
private

index of the sync packet (0-3) which starts the next edit unit

Definition at line 184 of file sound_asset_writer.h.


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