JUCE: AudioCDBurner Class Reference

JUCE

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
AudioCDBurner Class Reference
juce_audio_utils » audio_cd

`#include <juce_AudioCDBurner.h>`

Inheritance diagram for AudioCDBurner:

## 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.
DiskState | getDiskState () const
| Returns the current status of the device.
bool | isDiskPresent () const
| Returns true if there's a writable disk in the drive.
bool | openTray ()
| Sends an eject signal to the drive.
DiskState | waitUntilStateChange (int timeOutMilliseconds)
| Blocks the current thread until the drive's state changes, or until the timeout expires.
Array< int > | getAvailableWriteSpeeds () const
| Returns the set of possible write speeds that the device can handle.
bool | setBufferUnderrunProtection (bool shouldBeEnabled)
| Tries to enable or disable buffer underrun safety on devices that support it.
int | getNumAvailableAudioBlocks () const
| Returns the number of free blocks on the disk.
bool | addAudioTrack (AudioSource *source, int numSamples)
| Adds a track to be written.
String | burn (BurnProgressListener *listener, bool ejectDiscAfterwards, bool performFakeBurnForTesting, int writeSpeed)
| Runs the burn process.
void | abortBurn ()
| If a burn operation is currently in progress, this tells it to stop as soon as possible.
Public Member Functions inherited from ChangeBroadcaster
| ChangeBroadcaster () noexcept
| Creates an ChangeBroadcaster.
virtual | ~ChangeBroadcaster ()
| Destructor.
void | addChangeListener (ChangeListener *listener)
| Registers a listener to receive change callbacks from this broadcaster.
void | removeChangeListener (ChangeListener *listener)
| Unregisters a listener from the list.
void | removeAllChangeListeners ()
| Removes all listeners from the list.
void | sendChangeMessage ()
| Causes an asynchronous change message to be sent to all the registered listeners.
void | sendSynchronousChangeMessage ()
| Sends a synchronous change message to all the registered listeners.
void | dispatchPendingMessages ()
| If a change message has been sent but not yet dispatched, this will call sendSynchronousChangeMessage() to make the callback immediately.

## Static Public Member Functions
static StringArray | findAvailableDevices ()
| Returns a list of available optical drives.
static AudioCDBurner * | openDevice (const int deviceIndex)
| Tries to open one of the optical drives.

## Member Enumeration Documentation

## ◆ DiskState

enum AudioCDBurner::DiskState

Enumerator
unknown | An error condition, if the device isn't responding.
trayOpen | The drive is currently open. Note that a slot-loading drive may seem to be permanently open.
noDisc | The drive has no disk in it.
writableDiskPresent | The drive contains a writeable disk.
readOnlyDiskPresent | The drive contains a read-only disk.

## Constructor & Destructor Documentation

## ◆ ~AudioCDBurner()

AudioCDBurner::~AudioCDBurner | ( |  | ) |

Destructor.

## Member Function Documentation

## ◆ findAvailableDevices()

static StringArray AudioCDBurner::findAvailableDevices | ( |  | ) |
| static

Returns a list of available optical drives.

Use openDevice() to open one of the items from this list.

## ◆ openDevice()

static AudioCDBurner * AudioCDBurner::openDevice | ( | const int | deviceIndex | ) |
| static

Tries to open one of the optical drives.

The deviceIndex is an index into the array returned by findAvailableDevices().

## ◆ getDiskState()

DiskState 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.

## ◆ isDiskPresent()

bool AudioCDBurner::isDiskPresent | ( |  | ) | const

Returns true if there's a writable disk in the drive.

## ◆ openTray()

bool 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.

## ◆ waitUntilStateChange()

DiskState AudioCDBurner::waitUntilStateChange | ( | int | timeOutMilliseconds | ) |

Blocks the current thread until the drive's state changes, or until the timeout expires.

Returns
  the device's new state

## ◆ getAvailableWriteSpeeds()

Array< int > AudioCDBurner::getAvailableWriteSpeeds | ( |  | ) | const

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!

See also
  setWriteSpeed, getWriteSpeed

## ◆ setBufferUnderrunProtection()

bool AudioCDBurner::setBufferUnderrunProtection | ( | bool | shouldBeEnabled | ) |

Tries to enable or disable buffer underrun safety on devices that support it.

Returns
  true if it's now enabled. If the device doesn't support it, this will always return false.

## ◆ getNumAvailableAudioBlocks()

int AudioCDBurner::getNumAvailableAudioBlocks | ( |  | ) | const

Returns the number of free blocks on the disk.

There are 75 blocks per second, at 44100Hz.

## ◆ addAudioTrack()

bool 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.

## ◆ burn()

String AudioCDBurner::burn | ( | BurnProgressListener * | listener,
|  | bool | ejectDiscAfterwards,
|  | bool | performFakeBurnForTesting,
|  | int | writeSpeed
| ) |  |

Runs the burn process.

This method will block until the operation is complete.

Parameters

  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.

## ◆ abortBurn()

void 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()

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

- juce_AudioCDBurner.h