Commit 08edac79 authored by sletz's avatar sletz
Browse files

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
parent eb306810
......@@ -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>
......
......@@ -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;
......
......@@ -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);
......
......@@ -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)
{
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
......@@ -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. */
......
......@@ -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).
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 *
......
......@@ -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(
......
......@@ -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);
......
......@@ -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 */,
......
......@@ -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");
......
......@@ -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");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment