@tags{Audio} More...
#include <juce_AudioCDBurner.h>
Classes | |
class | BurnProgressListener |
Receives progress callbacks during a cd-burn operation. More... | |
Public Types | |
enum | DiskState { unknown, trayOpen, noDisc, writableDiskPresent, readOnlyDiskPresent } |
Public Member Functions | |
~AudioCDBurner () | |
Destructor. More... | |
void | abortBurn () |
If a burn operation is currently in progress, this tells it to stop as soon as possible. More... | |
bool | addAudioTrack (AudioSource *source, int numSamples) |
Adds a track to be written. More... | |
void | addChangeListener (ChangeListener *listener) |
Registers a listener to receive change callbacks from this broadcaster. More... | |
String | burn (BurnProgressListener *listener, bool ejectDiscAfterwards, bool performFakeBurnForTesting, int writeSpeed) |
Runs the burn process. More... | |
void | dispatchPendingMessages () |
If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately. More... | |
Array< int > | getAvailableWriteSpeeds () const |
Returns the set of possible write speeds that the device can handle. More... | |
DiskState | getDiskState () const |
Returns the current status of the device. More... | |
int | getNumAvailableAudioBlocks () const |
Returns the number of free blocks on the disk. More... | |
bool | isDiskPresent () const |
Returns true if there's a writable disk in the drive. More... | |
bool | openTray () |
Sends an eject signal to the drive. More... | |
void | removeAllChangeListeners () |
Removes all listeners from the list. More... | |
void | removeChangeListener (ChangeListener *listener) |
Unregisters a listener from the list. More... | |
void | sendChangeMessage () |
Causes an asynchronous change message to be sent to all the registered listeners. More... | |
void | sendSynchronousChangeMessage () |
Sends a synchronous change message to all the registered listeners. More... | |
bool | setBufferUnderrunProtection (bool shouldBeEnabled) |
Tries to enable or disable buffer underrun safety on devices that support it. More... | |
DiskState | waitUntilStateChange (int timeOutMilliseconds) |
Blocks the current thread until the drive's state changes, or until the timeout expires. More... | |
Static Public Member Functions | |
static StringArray | findAvailableDevices () |
Returns a list of available optical drives. More... | |
static AudioCDBurner * | openDevice (const int deviceIndex) |
Tries to open one of the optical drives. More... | |
Private Member Functions | |
AudioCDBurner (const int deviceIndex) | |
void | callListeners () |
Private Attributes | |
std::atomic< bool > | anyListeners { false } |
ChangeBroadcasterCallback | broadcastCallback |
ListenerList< ChangeListener > | changeListeners |
std::unique_ptr< Pimpl > | pimpl |
@tags{Audio}
juce::AudioCDBurner::~AudioCDBurner | ( | ) |
Destructor.
|
private |
void juce::AudioCDBurner::abortBurn | ( | ) |
If a burn operation is currently in progress, this tells it to stop as soon as possible.
It's also possible to stop the burn process by returning true from BurnProgressListener::audioCDBurnProgress()
bool juce::AudioCDBurner::addAudioTrack | ( | AudioSource * | source, |
int | numSamples | ||
) |
Adds a track to be written.
The source passed-in here will be kept by this object, and it will be used and deleted at some point in the future, either during the burn() method or when this AudioCDBurner object is deleted. Your caller method shouldn't keep a reference to it or use it again after passing it in here.
|
inherited |
Registers a listener to receive change callbacks from this broadcaster.
Trying to add a listener that's already on the list will have no effect.
String juce::AudioCDBurner::burn | ( | BurnProgressListener * | listener, |
bool | ejectDiscAfterwards, | ||
bool | performFakeBurnForTesting, | ||
int | writeSpeed | ||
) |
Runs the burn process.
This method will block until the operation is complete.
listener | the object to receive callbacks about progress |
ejectDiscAfterwards | whether to eject the disk after the burn completes |
performFakeBurnForTesting | if true, no data will actually be written to the disk |
writeSpeed | one of the write speeds from getAvailableWriteSpeeds(), or 0 or less to mean the fastest speed. |
|
privateinherited |
|
inherited |
If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately.
For thread-safety reasons, you must only call this method on the main message thread.
|
static |
Returns a list of available optical drives.
Use openDevice() to open one of the items from this list.
Returns the set of possible write speeds that the device can handle.
These are as a multiple of 'normal' speed, so e.g. '24x' returns 24, etc. Note that if there's no media present in the drive, this value may be unavailable!
DiskState juce::AudioCDBurner::getDiskState | ( | ) | const |
Returns the current status of the device.
To get informed when the drive's status changes, attach a ChangeListener to the AudioCDBurner.
int juce::AudioCDBurner::getNumAvailableAudioBlocks | ( | ) | const |
Returns the number of free blocks on the disk.
There are 75 blocks per second, at 44100Hz.
bool juce::AudioCDBurner::isDiskPresent | ( | ) | const |
Returns true if there's a writable disk in the drive.
|
static |
Tries to open one of the optical drives.
The deviceIndex is an index into the array returned by findAvailableDevices().
bool juce::AudioCDBurner::openTray | ( | ) |
Sends an eject signal to the drive.
The eject will happen asynchronously, so you can use getDiskState() and waitUntilStateChange() to monitor its progress.
|
inherited |
Removes all listeners from the list.
|
inherited |
Unregisters a listener from the list.
If the listener isn't on the list, this won't have any effect.
|
inherited |
Causes an asynchronous change message to be sent to all the registered listeners.
The message will be delivered asynchronously by the main message thread, so this method will return immediately. To call the listeners synchronously use sendSynchronousChangeMessage().
Referenced by juce::SelectedItemSet< SelectableItemType >::changed().
|
inherited |
Sends a synchronous change message to all the registered listeners.
This will immediately call all the listeners that are registered. For thread-safety reasons, you must only call this method on the main message thread.
Referenced by juce::SelectedItemSet< SelectableItemType >::changed().
Tries to enable or disable buffer underrun safety on devices that support it.
Blocks the current thread until the drive's state changes, or until the timeout expires.
|
privateinherited |
|
privateinherited |
|
privateinherited |
|
private |