Browse Source

JackMidiDriver::Process in progress.

tags/1.9.8
Stephane Letz 15 years ago
parent
commit
ea20f7f4b8
2 changed files with 68 additions and 6 deletions
  1. +60
    -0
      common/JackMidiDriver.cpp
  2. +8
    -6
      common/JackMidiDriver.h

+ 60
- 0
common/JackMidiDriver.cpp View File

@@ -138,6 +138,7 @@ int JackMidiDriver::ProcessNull()
return 0;
}

/*
int JackMidiDriver::Process()
{
if (Read() < 0) {
@@ -172,6 +173,65 @@ int JackMidiDriver::Process()
}
return 0;
}
*/

int JackMidiDriver::Process()
{
return (fEngineControl->fSyncMode) ? ProcessSync() : ProcessAsync();
}

int JackMidiDriver::ProcessSync()
{
int res = 0;

// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackMidiDriver::ProcessSync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
}

if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) {
jack_error("JackMidiDriver::ProcessSync - ResumeRefNum error");
res = -1;
}

if (fGraphManager->SuspendRefNum(&fClientControl, fSynchroTable,
DRIVER_TIMEOUT_FACTOR *
fEngineControl->fTimeOutUsecs) < 0) {
jack_error("JackMidiDriver::ProcessSync - SuspendRefNum error");
res = -1;
}

// Write output buffers from the current cycle
if (Write() < 0) {
jack_error("JackMidiDriver::ProcessSync - Write error");
}

return res;
}

int JackMidiDriver::ProcessAsync()
{
int res = 0;

// Read input buffers for the current cycle
if (Read() < 0) {
jack_error("JackMidiDriver::ProcessAsync: read error, skip cycle");
return 0; // Skip cycle, but continue processing...
}

// Write output buffers from the previous cycle
if (Write() < 0) {
jack_error("JackMidiDriver::ProcessAsync - Write error");
}

if (fGraphManager->ResumeRefNum(&fClientControl, fSynchroTable) < 0) {
jack_error("JackMidiDriver::ProcessAsync - ResumeRefNum error");
res = -1;
}

return res;
}

JackMidiBuffer* JackMidiDriver::GetInputBuffer(int port_index)
{


+ 8
- 6
common/JackMidiDriver.h View File

@@ -39,15 +39,15 @@ class SERVER_EXPORT JackMidiDriver : public JackDriver

int fCaptureChannels;
int fPlaybackChannels;
jack_ringbuffer_t* fRingBuffer[DRIVER_PORT_NUM];

jack_port_id_t fCapturePortList[DRIVER_PORT_NUM];
jack_port_id_t fPlaybackPortList[DRIVER_PORT_NUM];
JackMidiBuffer* GetInputBuffer(int port_index);
JackMidiBuffer* GetOutputBuffer(int port_index);
public:

JackMidiDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table);
@@ -62,16 +62,18 @@ class SERVER_EXPORT JackMidiDriver : public JackDriver
const char* playback_driver_name,
jack_nframes_t capture_latency,
jack_nframes_t playback_latency);
virtual int Process();
virtual int ProcessSync();
virtual int ProcessAsync();
virtual int ProcessNull();

virtual int Attach();
virtual int Detach();
virtual int Read();
virtual int Write();
};

} // end of namespace


Loading…
Cancel
Save