diff --git a/common/JackAudioDriver.cpp b/common/JackAudioDriver.cpp index cc3de2c5..52ab00a8 100644 --- a/common/JackAudioDriver.cpp +++ b/common/JackAudioDriver.cpp @@ -203,7 +203,7 @@ int JackAudioDriver::Process() } /* -The driver ASYNC mode: output buffers computed at the *previous cycle* are used, the server does not +The driver "asynchronous" mode: output buffers computed at the *previous cycle* are used, the server does not synchronize to the end of client graph execution. */ @@ -239,6 +239,10 @@ void JackAudioDriver::ProcessGraphAsync() } } +/* +Used when the driver works in master mode. +*/ + void JackAudioDriver::ProcessGraphAsyncMaster() { // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle @@ -261,6 +265,10 @@ void JackAudioDriver::ProcessGraphAsyncMaster() // Does not wait on graph execution end } +/* +Used when the driver works in slave mode. +*/ + void JackAudioDriver::ProcessGraphAsyncSlave() { if (ResumeRefNum() < 0) { @@ -269,7 +277,7 @@ void JackAudioDriver::ProcessGraphAsyncSlave() } /* -The driver SYNC mode: the server does synchronize to the end of client graph execution, +The driver "synchronous" mode: the server does synchronize to the end of client graph execution, if graph process succeed, output buffers computed at the *current cycle* are used. */ @@ -305,6 +313,10 @@ void JackAudioDriver::ProcessGraphSync() } } +/* +Used when the driver works in master mode. +*/ + void JackAudioDriver::ProcessGraphSyncMaster() { // fBeginDateUst is set in the "low level" layer, fEndDateUst is from previous cycle @@ -332,6 +344,10 @@ void JackAudioDriver::ProcessGraphSyncMaster() } } +/* +Used when the driver works in slave mode. +*/ + void JackAudioDriver::ProcessGraphSyncSlave() { if (ResumeRefNum() < 0) { diff --git a/common/JackAudioDriver.h b/common/JackAudioDriver.h index d6edd0c4..e6f332f0 100644 --- a/common/JackAudioDriver.h +++ b/common/JackAudioDriver.h @@ -28,6 +28,15 @@ namespace Jack /*! \brief The base class for audio drivers: drivers with audio ports. + +A concrete derived class will have to be defined with a real audio driver API, +either callback based one (like CoreAudio, PortAudio..) ones or blocking ones (like ALSA). + +Most of the generic audio handing code is part of this class : + - concrete callback basedd derived subclasses typically have to Open/Close the underlying audio API, + setup the audio callback and implement the Read/Write methods + - concrete blocking based derived subclasses typically have to Open/Close the underlying audio API, + implement the Read/Write methods and "wraps" the driver with the JackThreadDriver class. */ class SERVER_EXPORT JackAudioDriver : public JackDriver @@ -69,6 +78,10 @@ class SERVER_EXPORT JackAudioDriver : public JackDriver jack_nframes_t capture_latency, jack_nframes_t playback_latency); + /* + To be called by the underlying driver audio callback, or possibly by a RT thread (using JackThreadedDriver decorator) + when a blocking read/write underlying API is used (like ALSA) + */ virtual int Process(); virtual int Attach(); diff --git a/common/JackDriver.h b/common/JackDriver.h index 772ce1f2..804d9b27 100644 --- a/common/JackDriver.h +++ b/common/JackDriver.h @@ -95,9 +95,11 @@ class SERVER_EXPORT JackDriverInterface virtual int ProcessRead() = 0; virtual int ProcessWrite() = 0; + // For "slave" driver in "synchronous" mode virtual int ProcessReadSync() = 0; virtual int ProcessWriteSync() = 0; + // For "slave" driver in "asynchronous" mode virtual int ProcessReadAsync() = 0; virtual int ProcessWriteAsync() = 0; @@ -231,15 +233,17 @@ class SERVER_EXPORT JackDriver : public JackDriverClientInterface int ProcessReadSlaves(); int ProcessWriteSlaves(); - // For "slave" driver - int ProcessRead(); - int ProcessWrite(); + // For "slave" driver with typically decompose a given cycle in separated Read and Write parts. + virtual int ProcessRead(); + virtual int ProcessWrite(); - int ProcessReadSync(); - int ProcessWriteSync(); + // For "slave" driver in "synchronous" mode + virtual int ProcessReadSync(); + virtual int ProcessWriteSync(); - int ProcessReadAsync(); - int ProcessWriteAsync(); + // For "slave" driver in "asynchronous" mode + virtual int ProcessReadAsync(); + virtual int ProcessWriteAsync(); virtual bool IsFixedBufferSize(); virtual int SetBufferSize(jack_nframes_t buffer_size); diff --git a/common/JackMidiDriver.h b/common/JackMidiDriver.h index 204d6bbf..76f187db 100644 --- a/common/JackMidiDriver.h +++ b/common/JackMidiDriver.h @@ -30,6 +30,10 @@ namespace Jack /*! \brief The base class for MIDI drivers: drivers with MIDI ports. + +A concrete derived class will have to be defined with a real MIDI driver API, +either callback based one (like CoreMIDI..) ones or blocking ones (like ALSA MIDI). + */ class SERVER_EXPORT JackMidiDriver : public JackDriver