|
Discman
|
The Reader uses a separate thread to load data into the CDDrive's ring buffer. More...
#include <cd_drive.h>

Public Types | |
| enum | Action { Idle , Load , Exit } |
| Actions are taken consecutively. Setting an action on the Reader takes effect after its current action. More... | |
Public Member Functions | |
| Reader (CDDrive &drive) | |
| Reader constructor. | |
| ~Reader () | |
| Reader destructor. | |
| void | action (const Action action) |
| Set the next action for the Reader. | |
| Action | action () |
| Returns the current Reader action in a thread-safe way. | |
| void | track (const int track) |
| Seeks to the given track on the disc using 1-based indexing. | |
| void | buffer (const int buffer) |
| Sets the index of the buffer in the CDDrive's ring buffer to read samples into. | |
| void | load () |
| Fills the current buffer with audio samples. | |
| void | loop () |
| The execution loop performed by the thread. | |
Private Attributes | |
| CDDrive & | _drive |
| The parent CDDrive. | |
| Action | _action |
| The current or next action to be taken by the Reader. | |
| int | _buffer |
| The index of the buffer in the CDDrive's ring buffer to read samples into. | |
| cdrom_paranoia_t * | _paranoia |
| cdio handle to the sample reader. | |
| std::mutex | _action_lock |
| Provides mutually exclusive access to the _action member between the the application thread and the Reader thread. | |
| std::thread | _thread |
| The thread used to run loop(). | |
The Reader uses a separate thread to load data into the CDDrive's ring buffer.
Definition at line 172 of file cd_drive.h.
Actions are taken consecutively. Setting an action on the Reader takes effect after its current action.
| Enumerator | |
|---|---|
| Idle | |
| Load | |
| Exit | |
Definition at line 177 of file cd_drive.h.
| CDDrive::Reader::Reader | ( | CDDrive & | drive | ) |
Reader constructor.
| [in] | drive | The parent CDDrive. |
Definition at line 9 of file cd_drive.cc.
| CDDrive::Reader::~Reader | ( | ) |
Reader destructor.
Definition at line 19 of file cd_drive.cc.
| CDDrive::Reader::Action CDDrive::Reader::action | ( | ) |
Returns the current Reader action in a thread-safe way.
Definition at line 42 of file cd_drive.cc.
| void CDDrive::Reader::action | ( | const Action | action | ) |
Set the next action for the Reader.
| [in] | action | The action to take. |
Definition at line 26 of file cd_drive.cc.
| void CDDrive::Reader::buffer | ( | const int | buffer | ) |
Sets the index of the buffer in the CDDrive's ring buffer to read samples into.
| [in] | buffer | The index of the buffer (0 or 1). |
Definition at line 38 of file cd_drive.cc.
| void CDDrive::Reader::load | ( | ) |
Fills the current buffer with audio samples.
Definition at line 61 of file cd_drive.cc.
| void CDDrive::Reader::loop | ( | ) |
The execution loop performed by the thread.
Definition at line 77 of file cd_drive.cc.
| void CDDrive::Reader::track | ( | const int | track | ) |
Seeks to the given track on the disc using 1-based indexing.
| [in] | track | The track to seek to . |
Definition at line 32 of file cd_drive.cc.
|
private |
The current or next action to be taken by the Reader.
Definition at line 212 of file cd_drive.h.
|
private |
Provides mutually exclusive access to the _action member between the the application thread and the Reader thread.
Definition at line 220 of file cd_drive.h.
|
private |
The index of the buffer in the CDDrive's ring buffer to read samples into.
Definition at line 214 of file cd_drive.h.
|
private |
The parent CDDrive.
Definition at line 210 of file cd_drive.h.
|
private |
cdio handle to the sample reader.
Definition at line 216 of file cd_drive.h.
|
private |
The thread used to run loop().
Definition at line 224 of file cd_drive.h.