Browse Source

Add jackctl_driver_get_type in Control API.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4529 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/1.9.8
sletz 12 years ago
parent
commit
08edac7982
27 changed files with 169 additions and 117 deletions
  1. +1
    -0
      ChangeLog
  2. +5
    -0
      common/JackControlAPI.cpp
  3. +11
    -0
      common/JackControlAPI.h
  4. +1
    -0
      common/JackDriverLoader.cpp
  5. +3
    -3
      common/JackDummyDriver.cpp
  6. +1
    -1
      common/JackLoopbackDriver.cpp
  7. +1
    -1
      common/JackNetAdapter.cpp
  8. +3
    -3
      common/JackNetDriver.cpp
  9. +1
    -1
      common/JackNetManager.cpp
  10. +3
    -3
      common/JackNetOneDriver.cpp
  11. +10
    -0
      common/driver_interface.h
  12. +19
    -0
      common/jack/control.h
  13. +1
    -1
      linux/alsa/JackAlsaAdapter.cpp
  14. +1
    -1
      linux/alsa/JackAlsaDriver.cpp
  15. +1
    -1
      linux/alsarawmidi/JackALSARawMidiDriver.cpp
  16. +2
    -2
      linux/firewire/JackFFADODriver.cpp
  17. +1
    -1
      linux/freebob/JackFreebobDriver.cpp
  18. +4
    -0
      macosx/Jackdmp.xcodeproj/project.pbxproj
  19. +1
    -1
      macosx/coreaudio/JackCoreAudioAdapter.cpp
  20. +1
    -1
      macosx/coreaudio/JackCoreAudioDriver.cpp
  21. +1
    -1
      macosx/coremidi/JackCoreMidiDriver.cpp
  22. +1
    -1
      solaris/oss/JackBoomerDriver.cpp
  23. +90
    -90
      solaris/oss/JackOSSAdapter.cpp
  24. +1
    -1
      solaris/oss/JackOSSDriver.cpp
  25. +1
    -1
      windows/portaudio/JackPortAudioAdapter.cpp
  26. +1
    -1
      windows/portaudio/JackPortAudioDriver.cpp
  27. +3
    -2
      windows/winmme/JackWinMMEDriver.cpp

+ 1
- 0
ChangeLog View File

@@ -40,6 +40,7 @@ Chris Caudle
* More robust code in synchronization primitives and in JackMessageBuffer.
* Non blocking notifications in JackEngine::NotifyAddClient and JackEngine::NotifyRemoveClient.
* More robust Control API implementation.
* Add jackctl_driver_get_type in Control API.

2011-07-29 Stephane Letz <letz@grame.fr>



+ 5
- 0
common/JackControlAPI.cpp View File

@@ -979,6 +979,11 @@ SERVER_EXPORT const char * jackctl_driver_get_name(jackctl_driver *driver_ptr)
return (driver_ptr) ? driver_ptr->desc_ptr->name : NULL;
}

SERVER_EXPORT jackctl_driver_type_t jackctl_driver_get_type(jackctl_driver *driver_ptr)
{
return (driver_ptr) ? (jackctl_driver_type_t)driver_ptr->desc_ptr->type : (jackctl_driver_type_t)0;
}

SERVER_EXPORT const JSList * jackctl_driver_get_parameters(jackctl_driver *driver_ptr)
{
return (driver_ptr) ? driver_ptr->parameters : NULL;


+ 11
- 0
common/JackControlAPI.h View File

@@ -44,6 +44,13 @@ typedef enum
JackParamBool, /**< @brief value type is a boolean */
} jackctl_param_type_t;

/** Driver types, intentionally similar to jack_driver_type_t */
typedef enum
{
JackMaster = 1, /**< @brief master driver */
JackSlave, /**< @brief slave driver */
} jackctl_driver_type_t;

/** @brief Max value that jackctl_param_type_t type can have */
#define JACK_PARAM_MAX (JackParamBool + 1)

@@ -126,6 +133,10 @@ SERVER_EXPORT const char *
jackctl_driver_get_name(
jackctl_driver_t * driver);

SERVER_EXPORT jackctl_driver_type_t
jackctl_driver_get_type(
jackctl_driver_t * driver);

SERVER_EXPORT const JSList *
jackctl_driver_get_parameters(
jackctl_driver_t * driver);


+ 1
- 0
common/JackDriverLoader.cpp View File

@@ -822,6 +822,7 @@ SERVER_EXPORT
jack_driver_desc_t *
jack_driver_descriptor_construct(
const char * name,
jack_driver_type_t type,
const char * description,
jack_driver_desc_filler_t * filler_ptr)
{


+ 3
- 3
common/JackDummyDriver.cpp View File

@@ -37,7 +37,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("dummy", "Timer based backend", &filler);
desc = jack_driver_descriptor_construct("dummy", JackDriverMaster, "Timer based backend", &filler);

value.ui = 2U;
jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamUInt, &value, NULL, "Number of capture ports", NULL);
@@ -99,14 +99,14 @@ extern "C"
}
}

if (wait_time > 0) {
if (wait_time > 0) {
buffer_size = lroundf((wait_time * sample_rate) / 1000000.0f);
if (buffer_size > BUFFER_SIZE_MAX) {
buffer_size = BUFFER_SIZE_MAX;
jack_error("Buffer size set to %d", BUFFER_SIZE_MAX);
}
}
Jack::JackDriverClientInterface* driver = new Jack::JackThreadedDriver(new Jack::JackDummyDriver("system", "dummy_pcm", engine, table));
if (driver->Open(buffer_size, sample_rate, 1, 1, capture_ports, playback_ports, monitor, "dummy", "dummy", 0, 0) == 0) {
return driver;


+ 1
- 1
common/JackLoopbackDriver.cpp View File

@@ -101,7 +101,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("loopback", "Loopback backend", &filler);
desc = jack_driver_descriptor_construct("loopback", JackDriverSlave, "Loopback backend", &filler);

value.i = 0;
jack_driver_descriptor_add_parameter(desc, &filler, "channels", 'c', JackDriverParamInt, &value, NULL, "Maximum number of loopback ports", NULL);


+ 1
- 1
common/JackNetAdapter.cpp View File

@@ -383,7 +383,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("netadapter", "netjack net <==> audio backend adapter", &filler);
desc = jack_driver_descriptor_construct("netadapter", JackDriverNone, "netjack net <==> audio backend adapter", &filler);

strcpy(value.str, DEFAULT_MULTICAST_IP);
jack_driver_descriptor_add_parameter(desc, &filler, "multicast_ip", 'a', JackDriverParamString, &value, NULL, "Multicast Address", NULL);


+ 3
- 3
common/JackNetDriver.cpp View File

@@ -73,7 +73,7 @@ namespace Jack
}

//open, close, attach and detach------------------------------------------------------
int JackNetDriver::Close()
{
#ifdef JACK_MONITOR
@@ -473,7 +473,7 @@ namespace Jack
{
return (fEngineControl->fSyncMode) ? ProcessSync() : ProcessAsync();
}
int JackNetDriver::Read()
{
//buffers
@@ -587,7 +587,7 @@ namespace Jack
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("net", "netjack slave backend component", &filler);
desc = jack_driver_descriptor_construct("net", JackDriverMaster, "netjack slave backend component", &filler);

strcpy(value.str, DEFAULT_MULTICAST_IP);
jack_driver_descriptor_add_parameter(desc, &filler, "multicast_ip", 'a', JackDriverParamString, &value, NULL, "Multicast Address", NULL);


+ 1
- 1
common/JackNetManager.cpp View File

@@ -843,7 +843,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("netmanager", "netjack multi-cast master component", &filler);
desc = jack_driver_descriptor_construct("netmanager", JackDriverNone, "netjack multi-cast master component", &filler);

strcpy(value.str, DEFAULT_MULTICAST_IP);
jack_driver_descriptor_add_parameter(desc, &filler, "multicast_ip", 'a', JackDriverParamString, &value, NULL, "Multicast Address", NULL);


+ 3
- 3
common/JackNetOneDriver.cpp View File

@@ -251,12 +251,12 @@ bool JackNetOneDriver::Initialize()
//jack ports and buffers--------------------------------------------------------------

//driver processes--------------------------------------------------------------------
int JackNetOneDriver::Process()
{
return (fEngineControl->fSyncMode) ? ProcessSync() : ProcessAsync();
}
int JackNetOneDriver::Read()
{
int delay;
@@ -764,7 +764,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("netone", "netjack one slave backend component", &filler);
desc = jack_driver_descriptor_construct("netone", JackDriverMaster, "netjack one slave backend component", &filler);

value.ui = 2U;
jack_driver_descriptor_add_parameter(desc, &filler, "audio-ins", 'i', JackDriverParamUInt, &value, NULL, "Number of capture channels (defaults to 2)", NULL);


+ 10
- 0
common/driver_interface.h View File

@@ -51,6 +51,14 @@ typedef enum
JackDriverParamBool
} jack_driver_param_type_t;

/** Driver types */
typedef enum
{
JackDriverMaster = 1,
JackDriverSlave,
JackDriverNone,
} jack_driver_type_t;

/** Driver parameter value */
typedef union
{
@@ -103,6 +111,7 @@ jack_driver_param_t;
/** A struct for describing a jack driver */
typedef struct {
char name[JACK_DRIVER_NAME_MAX + 1]; /**< The driver's canonical name */
jack_driver_type_t type; /**< The driver's type */
char desc[JACK_DRIVER_PARAM_DESC + 1]; /**< The driver's extended description */
char file[JACK_PATH_MAX + 1]; /**< The filename of the driver's shared object file */
uint32_t nparams; /**< The number of parameters the driver has */
@@ -120,6 +129,7 @@ SERVER_EXPORT int jack_parse_driver_params(jack_driver_desc_t * desc, int argc,
SERVER_EXPORT jack_driver_desc_t * /* newlly allocated driver descriptor, NULL on failure */
jack_driver_descriptor_construct(
const char * name, /* driver name */
jack_driver_type_t type, /* driver type */
const char * description, /* driver description */
jack_driver_desc_filler_t * filler); /* Pointer to stack var to be supplied to jack_driver_descriptor_add_parameter() as well.
Can be NULL for drivers that have no parameters. */


+ 19
- 0
common/jack/control.h View File

@@ -45,6 +45,13 @@ typedef enum
JackParamBool, /**< @brief value type is a boolean */
} jackctl_param_type_t;

/** Driver types */
typedef enum
{
JackMaster = 1, /**< @brief master driver */
JackSlave /**< @brief slave driver */
} jackctl_driver_type_t;

/** @brief Max value that jackctl_param_type_t type can have */
#define JACK_PARAM_MAX (JackParamBool + 1)

@@ -298,6 +305,18 @@ const char *
jackctl_driver_get_name(
jackctl_driver_t * driver);

/**
* Call this function to get type of driver.
*
* @param driver driver object handle to get name of
*
* @return driver type. Must not be modified. Always same for same
* driver object.
*/
jackctl_driver_type_t
jackctl_driver_get_type(
jackctl_driver_t * driver);

/**
* Call this function to get list of driver parameters. List node data
* pointers is a parameter object handle (::jackctl_parameter_t).


+ 1
- 1
linux/alsa/JackAlsaAdapter.cpp View File

@@ -191,7 +191,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("audioadapter", "netjack audio <==> net backend adapter", &filler);
desc = jack_driver_descriptor_construct("audioadapter", JackDriverNone, "netjack audio <==> net backend adapter", &filler);

strcpy(value.str, "none");
jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamString, &value, NULL, "Provide capture ports. Optionally set device", NULL);


+ 1
- 1
linux/alsa/JackAlsaDriver.cpp View File

@@ -729,7 +729,7 @@ SERVER_EXPORT const jack_driver_desc_t* driver_get_descriptor ()
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("alsa", "Linux ALSA API based audio backend", &filler);
desc = jack_driver_descriptor_construct("alsa", JackDriverMaster, "Linux ALSA API based audio backend", &filler);

strcpy(value.str, "none");
jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamString, &value, NULL, "Provide capture ports. Optionally set device", NULL);


+ 1
- 1
linux/alsarawmidi/JackALSARawMidiDriver.cpp View File

@@ -632,7 +632,7 @@ extern "C" {
// sizes. I don't think MIDI drivers can accept parameters right
// now without being set as the main driver.

return jack_driver_descriptor_construct("alsarawmidi", "Alternative ALSA raw MIDI backend.", NULL);
return jack_driver_descriptor_construct("alsarawmidi", JackDriverSlave, "Alternative ALSA raw MIDI backend.", NULL);
}

SERVER_EXPORT Jack::JackDriverClientInterface *


+ 2
- 2
linux/firewire/JackFFADODriver.cpp View File

@@ -527,7 +527,7 @@ int JackFFADODriver::Attach()
if (fEngine->PortRegister(fClientControl.fRefNum, buf,
JACK_DEFAULT_MIDI_TYPE,
PlaybackDriverFlags,
fEngineControl->fBufferSize, &port_index) < 0) {
fEngineControl->fBufferSize, &port_index) < 0) {
jack_error("driver: cannot register port for %s", buf);
return -1;
}
@@ -755,7 +755,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("firewire", "Linux FFADO API based audio backend", &filler);
desc = jack_driver_descriptor_construct("firewire", JackDriverMaster, "Linux FFADO API based audio backend", &filler);

strcpy(value.str, "hw:0");
jack_driver_descriptor_add_parameter(


+ 1
- 1
linux/freebob/JackFreebobDriver.cpp View File

@@ -956,7 +956,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("freebob", "Linux FreeBob API based audio backend", &filler);
desc = jack_driver_descriptor_construct("freebob", JackDriverMaster, "Linux FreeBob API based audio backend", &filler);

strcpy(value.str, "hw:0");
jack_driver_descriptor_add_parameter(desc, &filler, "device", 'd', JackDriverParamString, &value, NULL, "The FireWire device to use. Format is: 'hw:port[,node]'.", NULL);


+ 4
- 0
macosx/Jackdmp.xcodeproj/project.pbxproj View File

@@ -1798,6 +1798,8 @@
4BAB95B60B9E20B800A0C723 /* JackPortType.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackPortType.cpp; path = ../common/JackPortType.cpp; sourceTree = SOURCE_ROOT; };
4BAB95B70B9E20B800A0C723 /* JackPortType.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackPortType.h; path = ../common/JackPortType.h; sourceTree = SOURCE_ROOT; };
4BAB95EC0B9E21A500A0C723 /* JackAudioPort.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = JackAudioPort.cpp; path = ../common/JackAudioPort.cpp; sourceTree = SOURCE_ROOT; };
4BB21C6D1407E16400287B3C /* JackWinMMEDriver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackWinMMEDriver.cpp; path = ../windows/winmme/JackWinMMEDriver.cpp; sourceTree = SOURCE_ROOT; };
4BB21C6E1407E16400287B3C /* JackWinMMEDriver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackWinMMEDriver.h; path = ../windows/winmme/JackWinMMEDriver.h; sourceTree = SOURCE_ROOT; };
4BB371D40C1AD85A0050C1E4 /* JackNotification.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = JackNotification.h; path = ../common/JackNotification.h; sourceTree = SOURCE_ROOT; };
4BBAE40E0F42FA6100B8BD3F /* JackEngineProfiling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JackEngineProfiling.h; path = ../common/JackEngineProfiling.h; sourceTree = SOURCE_ROOT; };
4BBAE40F0F42FA6100B8BD3F /* JackEngineProfiling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JackEngineProfiling.cpp; path = ../common/JackEngineProfiling.cpp; sourceTree = SOURCE_ROOT; };
@@ -2850,6 +2852,8 @@
4B05A08A0DF72BF600840F4C /* Windows */ = {
isa = PBXGroup;
children = (
4BB21C6D1407E16400287B3C /* JackWinMMEDriver.cpp */,
4BB21C6E1407E16400287B3C /* JackWinMMEDriver.h */,
4B05A08B0DF72C3200840F4C /* JackWinEvent.cpp */,
4B05A08C0DF72C3200840F4C /* JackWinEvent.h */,
4B05A08D0DF72C3200840F4C /* JackWinNamedPipe.cpp */,


+ 1
- 1
macosx/coreaudio/JackCoreAudioAdapter.cpp View File

@@ -1509,7 +1509,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("audioadapter", "netjack audio <==> net backend adapter", &filler);
desc = jack_driver_descriptor_construct("audioadapter", JackDriverNone, "netjack audio <==> net backend adapter", &filler);

value.i = -1;
jack_driver_descriptor_add_parameter(desc, &filler, "channels", 'c', JackDriverParamInt, &value, NULL, "Maximum number of channels", "Maximum number of channels. If -1, max possible number of channels will be used");


+ 1
- 1
macosx/coreaudio/JackCoreAudioDriver.cpp View File

@@ -2059,7 +2059,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("coreaudio", "Apple CoreAudio API based audio backend", &filler);
desc = jack_driver_descriptor_construct("coreaudio", JackDriverMaster, "Apple CoreAudio API based audio backend", &filler);

value.i = -1;
jack_driver_descriptor_add_parameter(desc, &filler, "channels", 'c', JackDriverParamInt, &value, NULL, "Maximum number of channels", "Maximum number of channels. If -1, max possible number of channels will be used");


+ 1
- 1
macosx/coremidi/JackCoreMidiDriver.cpp View File

@@ -638,7 +638,7 @@ extern "C" {
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("coremidi", "Apple CoreMIDI API based MIDI backend", &filler);
desc = jack_driver_descriptor_construct("coremidi", JackDriverSlave, "Apple CoreMIDI API based MIDI backend", &filler);

value.ui = 0;
jack_driver_descriptor_add_parameter(desc, &filler, "inchannels", 'i', JackDriverParamUInt, &value, NULL, "CoreMIDI virtual bus", NULL);


+ 1
- 1
solaris/oss/JackBoomerDriver.cpp View File

@@ -821,7 +821,7 @@ SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("boomer", "Boomer/OSS API based audio backend", &filler);
desc = jack_driver_descriptor_construct("boomer", JackDriverMaster, "Boomer/OSS API based audio backend", &filler);

value.ui = OSS_DRIVER_DEF_FS;
jack_driver_descriptor_add_parameter(desc, &filler, "rate", 'r', JackDriverParamUInt, &value, NULL, "Sample rate", NULL);


+ 90
- 90
solaris/oss/JackOSSAdapter.cpp View File

@@ -73,12 +73,12 @@ static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nfram
s32dst += channel;
sample_move_d24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); // No dithering for now...
break;
}
}
case 32: {
signed int *s32dst = (signed int*)dst;
s32dst += channel;
sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL);
break;
break;
}
}
}
@@ -92,7 +92,7 @@ void JackOSSAdapter::SetSampleFormat()
fSampleSize = sizeof(int);
break;
case 32: /* native-endian 32-bit integer */
fSampleFormat = AFMT_S32_NE;
fSampleFormat = AFMT_S32_NE;
fSampleSize = sizeof(int);
break;
case 16: /* native-endian 16-bit integer */
@@ -105,30 +105,30 @@ void JackOSSAdapter::SetSampleFormat()

JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params)
:JackAudioAdapterInterface(buffer_size, sample_rate)
,fThread(this),
fInFD(-1), fOutFD(-1), fBits(OSS_DRIVER_DEF_BITS),
,fThread(this),
fInFD(-1), fOutFD(-1), fBits(OSS_DRIVER_DEF_BITS),
fSampleFormat(0), fNperiods(OSS_DRIVER_DEF_NPERIODS), fRWMode(0), fIgnoreHW(true), fExcl(false),
fInputBufferSize(0), fOutputBufferSize(0),
fInputBuffer(NULL), fOutputBuffer(NULL), fFirstCycle(true)
{
const JSList* node;
const jack_driver_param_t* param;
fCaptureChannels = 2;
fPlaybackChannels = 2;

strcpy(fCaptureDriverName, OSS_DRIVER_DEF_DEV);
strcpy(fPlaybackDriverName, OSS_DRIVER_DEF_DEV);
for (node = params; node; node = jack_slist_next(node)) {
param = (const jack_driver_param_t*) node->data;
switch (param->character) {

case 'r':
SetAdaptedSampleRate(param->value.ui);
break;
case 'p':
SetAdaptedBufferSize(param->value.ui);
break;
@@ -136,15 +136,15 @@ JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample
case 'n':
fNperiods = param->value.ui;
break;
case 'w':
fBits = param->value.i;
break;
case 'i':
fCaptureChannels = param->value.ui;
break;
case 'o':
fPlaybackChannels = param->value.ui;
break;
@@ -152,21 +152,21 @@ JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample
case 'e':
fExcl = true;
break;
case 'C':
fRWMode |= kRead;
if (strcmp(param->value.str, "none") != 0) {
strcpy(fCaptureDriverName, param->value.str);
}
break;
case 'P':
fRWMode |= kWrite;
if (strcmp(param->value.str, "none") != 0) {
strcpy(fPlaybackDriverName, param->value.str);
}
break;
case 'd':
fRWMode |= kRead;
fRWMode |= kWrite;
@@ -177,11 +177,11 @@ JackOSSAdapter::JackOSSAdapter(jack_nframes_t buffer_size, jack_nframes_t sample
case 'b':
fIgnoreHW = true;
break;
case 'q':
fQuality = param->value.ui;
break;
case 'g':
fRingbufferCurSize = param->value.ui;
fAdaptative = false;
@@ -200,14 +200,14 @@ void JackOSSAdapter::DisplayDeviceInfo()
oss_audioinfo ai_in, ai_out;
memset(&info, 0, sizeof(audio_buf_info));
int cap = 0;
// Duplex cards : http://manuals.opensound.com/developer/full_duplex.html
jack_info("Audio Interface Description :");
jack_info("Sampling Frequency : %d, Sample Format : %d, Mode : %d", fAdaptedSampleRate, fSampleFormat, fRWMode);
if (fRWMode & kWrite) {
oss_sysinfo si;
if (ioctl(fOutFD, OSS_SYSINFO, &si) == -1) {
jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -219,17 +219,17 @@ void JackOSSAdapter::DisplayDeviceInfo()
jack_info("OSS numaudioengines %d", si.numaudioengines);
jack_info("OSS numcards %d", si.numcards);
}
jack_info("Output capabilities - %d channels : ", fPlaybackChannels);
jack_info("Output block size = %d", fOutputBufferSize);
if (ioctl(fOutFD, SNDCTL_DSP_GETOSPACE, &info) == -1) {
jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
} else {
jack_info("output space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d",
jack_info("output space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d",
info.fragments, info.fragstotal, info.fragsize, info.bytes);
}
if (ioctl(fOutFD, SNDCTL_DSP_GETCAPS, &cap) == -1) {
jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETCAPS failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
} else {
@@ -242,10 +242,10 @@ void JackOSSAdapter::DisplayDeviceInfo()
if (cap & DSP_CAP_MULTI) jack_info(" DSP_CAP_MULTI");
if (cap & DSP_CAP_BIND) jack_info(" DSP_CAP_BIND");
}
}
}
if (fRWMode & kRead) {
oss_sysinfo si;
if (ioctl(fInFD, OSS_SYSINFO, &si) == -1) {
jack_error("JackOSSAdapter::DisplayDeviceInfo OSS_SYSINFO failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -257,14 +257,14 @@ void JackOSSAdapter::DisplayDeviceInfo()
jack_info("OSS numaudioengines %d", si.numaudioengines);
jack_info("OSS numcards %d", si.numcards);
}
jack_info("Input capabilities - %d channels : ", fCaptureChannels);
jack_info("Input block size = %d", fInputBufferSize);
if (ioctl(fInFD, SNDCTL_DSP_GETOSPACE, &info) == -1) {
if (ioctl(fInFD, SNDCTL_DSP_GETOSPACE, &info) == -1) {
jack_error("JackOSSAdapter::DisplayDeviceInfo SNDCTL_DSP_GETOSPACE failed : %s@%i, errno = %d", __FILE__, __LINE__, errno);
} else {
jack_info("input space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d",
jack_info("input space info: fragments = %d, fragstotal = %d, fragsize = %d, bytes = %d",
info.fragments, info.fragstotal, info.fragsize, info.bytes);
}

@@ -281,15 +281,15 @@ void JackOSSAdapter::DisplayDeviceInfo()
if (cap & DSP_CAP_BIND) jack_info(" DSP_CAP_BIND");
}
}
if (ioctl(fInFD, SNDCTL_AUDIOINFO, &ai_in) != -1) {
jack_info("Using audio engine %d = %s for input", ai_in.dev, ai_in.name);
}
if (ioctl(fOutFD, SNDCTL_AUDIOINFO, &ai_out) != -1) {
jack_info("Using audio engine %d = %s for output", ai_out.dev, ai_out.name);
}
if (ai_in.rate_source != ai_out.rate_source) {
jack_info("Warning : input and output are not necessarily driven by the same clock!");
}
@@ -301,9 +301,9 @@ int JackOSSAdapter::OpenInput()
int gFragFormat;
int cur_sample_format, cur_capture_channels;
jack_nframes_t cur_sample_rate;
if (fCaptureChannels == 0) fCaptureChannels = 2;
if ((fInFD = open(fCaptureDriverName, O_RDONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
jack_error("JackOSSAdapter::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
return -1;
@@ -316,7 +316,7 @@ int JackOSSAdapter::OpenInput()
}
}

gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fCaptureChannels);
gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fCaptureChannels);
if (ioctl(fInFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
jack_error("JackOSSAdapter::OpenInput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
goto error;
@@ -330,7 +330,7 @@ int JackOSSAdapter::OpenInput()
if (cur_sample_format != fSampleFormat) {
jack_info("JackOSSAdapter::OpenInput driver forced the sample format %ld", fSampleFormat);
}
cur_capture_channels = fCaptureChannels;
if (ioctl(fInFD, SNDCTL_DSP_CHANNELS, &fCaptureChannels) == -1) {
jack_error("JackOSSAdapter::OpenInput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -339,7 +339,7 @@ int JackOSSAdapter::OpenInput()
if (cur_capture_channels != fCaptureChannels) {
jack_info("JackOSSAdapter::OpenInput driver forced the number of capture channels %ld", fCaptureChannels);
}
cur_sample_rate = fAdaptedSampleRate;
if (ioctl(fInFD, SNDCTL_DSP_SPEED, &fAdaptedSampleRate) == -1) {
jack_error("JackOSSAdapter::OpenInput failed to set sample rate : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -354,7 +354,7 @@ int JackOSSAdapter::OpenInput()
jack_error("JackOSSAdapter::OpenInput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
goto error;
}
if (fInputBufferSize != fAdaptedBufferSize * fSampleSize * fCaptureChannels) {
if (fIgnoreHW) {
jack_info("JackOSSAdapter::OpenInput driver forced buffer size %ld", fOutputBufferSize);
@@ -366,16 +366,16 @@ int JackOSSAdapter::OpenInput()

fInputBuffer = (void*)calloc(fInputBufferSize, 1);
assert(fInputBuffer);
fInputSampleBuffer = (float**)malloc(fCaptureChannels * sizeof(float*));
assert(fInputSampleBuffer);
for (int i = 0; i < fCaptureChannels; i++) {
fInputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
assert(fInputSampleBuffer[i]);
}
return 0;
error:
::close(fInFD);
return -1;
@@ -387,22 +387,22 @@ int JackOSSAdapter::OpenOutput()
int gFragFormat;
int cur_sample_format, cur_playback_channels;
jack_nframes_t cur_sample_rate;
if (fPlaybackChannels == 0) fPlaybackChannels = 2;
if ((fOutFD = open(fPlaybackDriverName, O_WRONLY | ((fExcl) ? O_EXCL : 0))) < 0) {
jack_error("JackOSSAdapter::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
return -1;
}
if (fExcl) {
if (ioctl(fOutFD, SNDCTL_DSP_COOKEDMODE, &flags) == -1) {
jack_error("JackOSSAdapter::OpenOutput failed to set cooked mode : %s@%i, errno = %d", __FILE__, __LINE__, errno);
goto error;
}
}
}
}

gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fPlaybackChannels);
gFragFormat = (2 << 16) + int2pow2(fAdaptedBufferSize * fSampleSize * fPlaybackChannels);
if (ioctl(fOutFD, SNDCTL_DSP_SETFRAGMENT, &gFragFormat) == -1) {
jack_error("JackOSSAdapter::OpenOutput failed to set fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
goto error;
@@ -416,7 +416,7 @@ int JackOSSAdapter::OpenOutput()
if (cur_sample_format != fSampleFormat) {
jack_info("JackOSSAdapter::OpenOutput driver forced the sample format %ld", fSampleFormat);
}
cur_playback_channels = fPlaybackChannels;
if (ioctl(fOutFD, SNDCTL_DSP_CHANNELS, &fPlaybackChannels) == -1) {
jack_error("JackOSSAdapter::OpenOutput failed to set channels : %s@%i, errno = %d", __FILE__, __LINE__, errno);
@@ -440,7 +440,7 @@ int JackOSSAdapter::OpenOutput()
jack_error("JackOSSAdapter::OpenOutput failed to get fragments : %s@%i, errno = %d", __FILE__, __LINE__, errno);
goto error;
}
if (fOutputBufferSize != fAdaptedBufferSize * fSampleSize * fPlaybackChannels) {
if (fIgnoreHW) {
jack_info("JackOSSAdapter::OpenOutput driver forced buffer size %ld", fOutputBufferSize);
@@ -452,18 +452,18 @@ int JackOSSAdapter::OpenOutput()

fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
assert(fOutputBuffer);
fOutputSampleBuffer = (float**)malloc(fPlaybackChannels * sizeof(float*));
assert(fOutputSampleBuffer);
for (int i = 0; i < fPlaybackChannels; i++) {
fOutputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
assert(fOutputSampleBuffer[i]);
}
fFirstCycle = true;
return 0;
error:
::close(fOutFD);
return -1;
@@ -472,46 +472,46 @@ error:
int JackOSSAdapter::Open()
{
SetSampleFormat();
if ((fRWMode & kRead) && (OpenInput() < 0)) {
return -1;
}
if ((fRWMode & kWrite) && (OpenOutput() < 0)) {
if ((fRWMode & kWrite) && (OpenOutput() < 0)) {
return -1;
}
// In duplex mode, check that input and output use the same buffer size
if ((fRWMode & kRead) && (fRWMode & kWrite) && (fInputBufferSize != fOutputBufferSize)) {
jack_error("JackOSSAdapter::OpenAux input and output buffer size are not the same!!");
goto error;
}

DisplayDeviceInfo();
DisplayDeviceInfo();

//start adapter thread
if (fThread.StartSync() < 0) {
jack_error ( "Cannot start audioadapter thread" );
return -1;
}
//turn the thread realtime
fThread.AcquireRealTime(JackServerGlobals::fInstance->GetEngineControl()->fClientPriority);
return 0;
error:
CloseAux();
return -1;
}

int JackOSSAdapter::Close()
{
#ifdef JACK_MONITOR
fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
#endif
fThread.Stop();
CloseAux();
CloseAux();
return 0;
}

@@ -521,23 +521,23 @@ void JackOSSAdapter::CloseAux()
close(fInFD);
fInFD = -1;
}
if (fRWMode & kWrite) {
close(fOutFD);
fOutFD = -1;
}
free(fInputBuffer);
fInputBuffer = NULL;
free(fOutputBuffer);
fOutputBuffer = NULL;
for (int i = 0; i < fCaptureChannels; i++) {
free(fInputSampleBuffer[i]);
}
free(fInputSampleBuffer);
for (int i = 0; i < fPlaybackChannels; i++) {
free(fOutputSampleBuffer[i]);
}
@@ -547,13 +547,13 @@ void JackOSSAdapter::CloseAux()
int JackOSSAdapter::Read()
{
ssize_t count = ::read(fInFD, fInputBuffer, fInputBufferSize);
if (count < fInputBufferSize) {
jack_error("JackOSSAdapter::Read error bytes read = %ld", count);
return -1;
} else {
for (int i = 0; i < fCaptureChannels; i++) {
CopyAndConvertIn(fInputSampleBuffer[i], fInputBuffer, fAdaptedBufferSize, i, fCaptureChannels, fBits);
CopyAndConvertIn(fInputSampleBuffer[i], fInputBuffer, fAdaptedBufferSize, i, fCaptureChannels, fBits);
}
return 0;
}
@@ -562,10 +562,10 @@ int JackOSSAdapter::Read()
int JackOSSAdapter::Write()
{
ssize_t count;
// Maybe necessay to write an empty output buffer first time : see http://manuals.opensound.com/developer/fulldup.c.html
if (fFirstCycle) {
fFirstCycle = false;
memset(fOutputBuffer, 0, fOutputBufferSize);

@@ -577,23 +577,23 @@ int JackOSSAdapter::Write()
return -1;
}
}
int delay;
if (ioctl(fOutFD, SNDCTL_DSP_GETODELAY, &delay) == -1) {
jack_error("JackOSSDriver::Write error get out delay : %s@%i, errno = %d", __FILE__, __LINE__, errno);
return -1;
}
delay /= fSampleSize * fPlaybackChannels;
jack_info("JackOSSDriver::Write output latency frames = %ld", delay);
}
for (int i = 0; i < fPlaybackChannels; i++) {
CopyAndConvertOut(fOutputBuffer, fOutputSampleBuffer[i], fAdaptedBufferSize, i, fCaptureChannels, fBits);
}
count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
if (count < fOutputBufferSize) {
jack_error("JackOSSAdapter::Write error bytes written = %ld", count);
return -1;
@@ -607,13 +607,13 @@ bool JackOSSAdapter::Execute()
//read data from audio interface
if (Read() < 0)
return false;
PushAndPull(fInputSampleBuffer, fOutputSampleBuffer, fAdaptedBufferSize);
//write data to audio interface
if (Write() < 0)
return false;
return true;
}

@@ -623,7 +623,7 @@ int JackOSSAdapter::SetBufferSize(jack_nframes_t buffer_size)
Close();
return Open();
}
} // namespace

#ifdef __cplusplus
@@ -637,7 +637,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("audioadapter", "netjack audio <==> net backend adapter", &filler);
desc = jack_driver_descriptor_construct("audioadapter", JackDriverNone, "netjack audio <==> net backend adapter", &filler);

value.ui = OSS_DRIVER_DEF_FS;
jack_driver_descriptor_add_parameter(desc, &filler, "rate", 'r', JackDriverParamUInt, &value, NULL, "Sample rate", NULL);
@@ -653,7 +653,7 @@ extern "C"

value.ui = OSS_DRIVER_DEF_INS;
jack_driver_descriptor_add_parameter(desc, &filler, "inchannels", 'i', JackDriverParamUInt, &value, NULL, "Capture channels", NULL);
value.ui = OSS_DRIVER_DEF_OUTS;
jack_driver_descriptor_add_parameter(desc, &filler, "outchannels", 'o', JackDriverParamUInt, &value, NULL, "Playback channels", NULL);

@@ -664,19 +664,19 @@ extern "C"
jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamString, &value, NULL, "Input device", NULL);
jack_driver_descriptor_add_parameter(desc, &filler, "playback", 'P', JackDriverParamString, &value, NULL, "Output device", NULL);
jack_driver_descriptor_add_parameter(desc, &filler, "device", 'd', JackDriverParamString, &value, NULL, "OSS device name", NULL);
value.i = true;
jack_driver_descriptor_add_parameter(desc, &filler, "ignorehwbuf", 'b', JackDriverParamBool, &value, NULL, "Ignore hardware period size", NULL);
value.ui = 0;
jack_driver_descriptor_add_parameter(desc, &filler, "quality", 'q', JackDriverParamInt, &value, NULL, "Resample algorithm quality (0 - 4)", NULL);
value.i = 32768;
jack_driver_descriptor_add_parameter(desc, &filler, "ring-buffer", 'g', JackDriverParamInt, &value, NULL, "Fixed ringbuffer size", "Fixed ringbuffer size (if not set => automatic adaptative)");
return desc;
}
#ifdef __cplusplus
}
#endif


+ 1
- 1
solaris/oss/JackOSSDriver.cpp View File

@@ -738,7 +738,7 @@ SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("oss", "OSS API based audio backend", &filler);
desc = jack_driver_descriptor_construct("oss", JackDriverMaster, "OSS API based audio backend", &filler);

value.ui = OSS_DRIVER_DEF_FS;
jack_driver_descriptor_add_parameter(desc, &filler, "rate", 'r', JackDriverParamUInt, &value, NULL, "Sample rate", NULL);


+ 1
- 1
windows/portaudio/JackPortAudioAdapter.cpp View File

@@ -218,7 +218,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("audioadapter", "netjack audio <==> net backend adapter", &filler);
desc = jack_driver_descriptor_construct("audioadapter", JackDriverNone, "netjack audio <==> net backend adapter", &filler);

value.ui = 0;
jack_driver_descriptor_add_parameter(desc, &filler, "inchannels", 'i', JackDriverParamInt, &value, NULL, "Maximum number of input channels", NULL);


+ 1
- 1
windows/portaudio/JackPortAudioDriver.cpp View File

@@ -266,7 +266,7 @@ extern "C"
jack_driver_desc_filler_t filler;
jack_driver_param_value_t value;

desc = jack_driver_descriptor_construct("portaudio", "PortAudio API based audio backend", &filler);
desc = jack_driver_descriptor_construct("portaudio", JackDriverMaster, "PortAudio API based audio backend", &filler);

value.ui = 0;
jack_driver_descriptor_add_parameter(desc, &filler, "channels", 'c', JackDriverParamUInt, &value, NULL, "Maximum number of channels", NULL);


+ 3
- 2
windows/winmme/JackWinMMEDriver.cpp View File

@@ -60,7 +60,7 @@ JackWinMMEDriver::Attach()
// Inputs
for (int i = 0; i < fCaptureChannels; i++) {
JackWinMMEInputPort *input_port = input_ports[i];
name = input_port->GetName();
name = input_port->GetName();
if (fEngine->PortRegister(fClientControl.fRefNum, name,
JACK_DEFAULT_MIDI_TYPE,
CaptureDriverFlags, buffer_size, &index) < 0) {
@@ -361,7 +361,7 @@ extern "C"
{
jack_driver_desc_t * desc;

return jack_driver_descriptor_construct("winmme", "WinMME API based MIDI backend", NULL);
return jack_driver_descriptor_construct("winmme", JackDriverSlave, "WinMME API based MIDI backend", NULL);
}

SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
@@ -436,3 +436,4 @@ jack_connect system_midi:capture_2 system:midi_playback_1
jack_connect system_midi:capture_1 system_midi:playback_1

*/


Loading…
Cancel
Save