2006-09-03 10:39:10 +03:00
|
|
|
/*
|
2008-02-01 21:46:45 +02:00
|
|
|
Copyright (C) 2004-2008 Grame
|
2006-09-03 10:39:10 +03:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __JackPortAudioDriver__
|
|
|
|
#define __JackPortAudioDriver__
|
|
|
|
|
|
|
|
#include "JackAudioDriver.h"
|
2008-07-08 11:44:44 +03:00
|
|
|
#include "JackPortAudioDevices.h"
|
2023-12-03 13:29:07 +02:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
2011-05-03 16:21:19 +03:00
|
|
|
#include "JackMMCSS.h"
|
2023-12-03 13:29:07 +02:00
|
|
|
#endif
|
2006-09-03 10:39:10 +03:00
|
|
|
|
|
|
|
namespace Jack
|
|
|
|
{
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\brief The PortAudio driver.
|
|
|
|
*/
|
|
|
|
|
2023-12-03 13:29:07 +02:00
|
|
|
class JackPortAudioDriver :
|
|
|
|
#ifdef _WIN32
|
|
|
|
public JackMMCSS,
|
|
|
|
#endif
|
|
|
|
public JackAudioDriver
|
2006-09-03 10:39:10 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
PaStream* fStream;
|
2011-03-11 16:45:57 +02:00
|
|
|
jack_default_audio_sample_t** fInputBuffer;
|
|
|
|
jack_default_audio_sample_t** fOutputBuffer;
|
2006-09-03 10:39:10 +03:00
|
|
|
PaDeviceIndex fInputDevice;
|
|
|
|
PaDeviceIndex fOutputDevice;
|
2013-02-28 12:12:50 +02:00
|
|
|
PortAudioDevices* fPaDevices;
|
2023-12-03 13:29:07 +02:00
|
|
|
jack_native_thread_t fReservationLoopThread;
|
2006-09-03 10:39:10 +03:00
|
|
|
|
|
|
|
static int Render(const void* inputBuffer, void* outputBuffer,
|
|
|
|
unsigned long framesPerBuffer,
|
|
|
|
const PaStreamCallbackTimeInfo* timeInfo,
|
|
|
|
PaStreamCallbackFlags statusFlags,
|
|
|
|
void* userData);
|
|
|
|
|
2011-04-04 15:03:01 +03:00
|
|
|
PaError OpenStream(jack_nframes_t buffer_size);
|
2011-11-04 15:47:54 +02:00
|
|
|
void UpdateLatencies();
|
2013-01-31 23:02:33 +02:00
|
|
|
int Render(const void* inputBuffer, void* outputBuffer, PaStreamCallbackFlags statusFlags);
|
2011-03-30 12:41:00 +03:00
|
|
|
|
2006-09-03 10:39:10 +03:00
|
|
|
public:
|
|
|
|
|
2023-12-03 13:29:07 +02:00
|
|
|
JackPortAudioDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table, PortAudioDevices* pa_devices) :
|
|
|
|
#ifdef _WIN32
|
|
|
|
JackMMCSS(),
|
|
|
|
#endif
|
|
|
|
JackAudioDriver(name, alias, engine, table), fStream(NULL), fInputBuffer(NULL), fOutputBuffer(NULL),
|
2013-01-09 15:06:32 +02:00
|
|
|
fInputDevice(paNoDevice), fOutputDevice(paNoDevice), fPaDevices(pa_devices)
|
2013-01-07 11:48:01 +02:00
|
|
|
{}
|
2006-09-03 10:39:10 +03:00
|
|
|
|
|
|
|
virtual ~JackPortAudioDriver()
|
2008-07-09 13:24:28 +03:00
|
|
|
{
|
|
|
|
delete fPaDevices;
|
|
|
|
}
|
2006-09-03 10:39:10 +03:00
|
|
|
|
2008-07-12 13:27:19 +03:00
|
|
|
int Open(jack_nframes_t buffe_size,
|
|
|
|
jack_nframes_t samplerate,
|
2008-01-26 11:20:44 +02:00
|
|
|
bool capturing,
|
|
|
|
bool playing,
|
2006-09-03 10:39:10 +03:00
|
|
|
int chan_in,
|
|
|
|
int chan_out,
|
|
|
|
bool monitor,
|
|
|
|
const char* capture_driver_name,
|
|
|
|
const char* playback_driver_name,
|
|
|
|
jack_nframes_t capture_latency,
|
|
|
|
jack_nframes_t playback_latency);
|
|
|
|
|
|
|
|
int Close();
|
2012-01-21 18:35:32 +02:00
|
|
|
|
2012-01-20 23:22:14 +02:00
|
|
|
int Attach();
|
2006-09-03 10:39:10 +03:00
|
|
|
|
|
|
|
int Start();
|
|
|
|
int Stop();
|
|
|
|
|
|
|
|
int Read();
|
|
|
|
int Write();
|
|
|
|
|
2011-03-11 12:59:03 +02:00
|
|
|
// BufferSize can be changed
|
|
|
|
bool IsFixedBufferSize()
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-10-12 01:19:46 +03:00
|
|
|
int SetBufferSize(jack_nframes_t buffer_size);
|
2006-09-03 10:39:10 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
} // end of namespace
|
|
|
|
|
|
|
|
#endif
|