Commit aabbb622 authored by sletz's avatar sletz
Browse files

Correct export settings(2).

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4663 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 9cb49507
......@@ -26,6 +26,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackLibSampleRateResampler.h"
#endif
#include "JackTime.h"
#include "JackError.h"
#include <stdio.h>
namespace Jack
......@@ -317,4 +318,75 @@ namespace Jack
return res;
}
int JackAudioAdapterInterface::SetHostBufferSize(jack_nframes_t buffer_size)
{
fHostBufferSize = buffer_size;
if (fAdaptative) {
AdaptRingBufferSize();
}
return 0;
}
int JackAudioAdapterInterface::SetAdaptedBufferSize(jack_nframes_t buffer_size)
{
fAdaptedBufferSize = buffer_size;
if (fAdaptative) {
AdaptRingBufferSize();
}
return 0;
}
int JackAudioAdapterInterface::SetBufferSize(jack_nframes_t buffer_size)
{
SetHostBufferSize(buffer_size);
SetAdaptedBufferSize(buffer_size);
return 0;
}
int JackAudioAdapterInterface::SetHostSampleRate(jack_nframes_t sample_rate)
{
fHostSampleRate = sample_rate;
fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
return 0;
}
int JackAudioAdapterInterface::SetAdaptedSampleRate(jack_nframes_t sample_rate)
{
fAdaptedSampleRate = sample_rate;
fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
return 0;
}
int JackAudioAdapterInterface::SetSampleRate(jack_nframes_t sample_rate)
{
SetHostSampleRate(sample_rate);
SetAdaptedSampleRate(sample_rate);
return 0;
}
void JackAudioAdapterInterface::SetInputs(int inputs)
{
jack_log("JackAudioAdapterInterface::SetInputs %d", inputs);
fCaptureChannels = inputs;
}
void JackAudioAdapterInterface::SetOutputs(int outputs)
{
jack_log("JackAudioAdapterInterface::SetOutputs %d", outputs);
fPlaybackChannels = outputs;
}
int JackAudioAdapterInterface::GetInputs()
{
//jack_log("JackAudioAdapterInterface::GetInputs %d", fCaptureChannels);
return fCaptureChannels;
}
int JackAudioAdapterInterface::GetOutputs()
{
//jack_log ("JackAudioAdapterInterface::GetOutputs %d", fPlaybackChannels);
return fPlaybackChannels;
}
} // namespace
......@@ -154,75 +154,16 @@ namespace Jack
return 0;
}
virtual int SetHostBufferSize(jack_nframes_t buffer_size)
{
fHostBufferSize = buffer_size;
if (fAdaptative) {
AdaptRingBufferSize();
}
return 0;
}
virtual int SetAdaptedBufferSize(jack_nframes_t buffer_size)
{
fAdaptedBufferSize = buffer_size;
if (fAdaptative) {
AdaptRingBufferSize();
}
return 0;
}
virtual int SetBufferSize(jack_nframes_t buffer_size)
{
SetHostBufferSize(buffer_size);
SetAdaptedBufferSize(buffer_size);
return 0;
}
virtual int SetHostSampleRate(jack_nframes_t sample_rate)
{
fHostSampleRate = sample_rate;
fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
return 0;
}
virtual int SetAdaptedSampleRate(jack_nframes_t sample_rate)
{
fAdaptedSampleRate = sample_rate;
fPIControler.Init(double(fHostSampleRate) / double(fAdaptedSampleRate));
return 0;
}
virtual int SetSampleRate(jack_nframes_t sample_rate)
{
SetHostSampleRate(sample_rate);
SetAdaptedSampleRate(sample_rate);
return 0;
}
void SetInputs(int inputs)
{
jack_log("JackAudioAdapterInterface::SetInputs %d", inputs);
fCaptureChannels = inputs;
}
void SetOutputs(int outputs)
{
jack_log("JackAudioAdapterInterface::SetOutputs %d", outputs);
fPlaybackChannels = outputs;
}
int GetInputs()
{
//jack_log("JackAudioAdapterInterface::GetInputs %d", fCaptureChannels);
return fCaptureChannels;
}
int GetOutputs()
{
//jack_log ("JackAudioAdapterInterface::GetOutputs %d", fPlaybackChannels);
return fPlaybackChannels;
}
virtual int SetHostBufferSize(jack_nframes_t buffer_size);
virtual int SetAdaptedBufferSize(jack_nframes_t buffer_size);
virtual int SetBufferSize(jack_nframes_t buffer_size);
virtual int SetHostSampleRate(jack_nframes_t sample_rate);
virtual int SetAdaptedSampleRate(jack_nframes_t sample_rate);
virtual int SetSampleRate(jack_nframes_t sample_rate);
void SetInputs(int inputs);
void SetOutputs(int outputs);
int GetInputs();
int GetOutputs();
virtual int GetInputLatency(int port_index) { return 0; }
virtual int GetOutputLatency(int port_index) { return 0; }
......
......@@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
......@@ -36,12 +36,12 @@ class SERVER_EXPORT JackClientInterface
{
public:
JackClientInterface()
{}
virtual ~JackClientInterface()
{}
virtual int Close() = 0;
virtual int ClientNotify(int refnum, const char* name, int notify, int sync, const char* message, int value1, int value2) = 0;
......
......@@ -2,21 +2,21 @@
Copyright (C) 2001 Paul Davis
Copyright (C) 2004-2008 Grame
Copyright (C) 2008 Nedko Arnaudov
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <stdarg.h>
......@@ -29,7 +29,7 @@ using namespace Jack;
static bool change_thread_log_function(jack_log_function_t log_function)
{
return (jack_tls_get(JackGlobals::fKeyLogFunction) == NULL
return (jack_tls_get(JackGlobals::fKeyLogFunction) == NULL
&& jack_tls_set(JackGlobals::fKeyLogFunction, (void*)log_function));
}
......
......@@ -31,14 +31,8 @@ extern "C"
{
#endif
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_ERROR 2
SERVER_EXPORT void jack_error(const char *fmt, ...);
SERVER_EXPORT void jack_info(const char *fmt, ...);
// like jack_info() but only if verbose mode is enabled
SERVER_EXPORT void jack_log(const char *fmt, ...);
SERVER_EXPORT extern void (*jack_error_callback)(const char *desc);
......@@ -47,14 +41,16 @@ extern "C"
SERVER_EXPORT extern void default_jack_error_callback(const char *desc);
SERVER_EXPORT extern void default_jack_info_callback(const char *desc);
SERVER_EXPORT extern void silent_jack_error_callback(const char *desc);
SERVER_EXPORT extern void silent_jack_info_callback(const char *desc);
SERVER_EXPORT void silent_jack_error_callback(const char *desc);
SERVER_EXPORT void silent_jack_info_callback(const char *desc);
typedef void (* jack_log_function_t)(int level, const char *message);
SERVER_EXPORT int set_threaded_log_function();
void jack_log_function(int level, const char *message);
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_ERROR 2
SERVER_EXPORT int set_threaded_log_function();
void jack_log_function(int level, const char *message);
typedef void (* jack_log_function_t)(int level, const char *message);
#ifdef __cplusplus
}
......
/*
Copyright (C) 2008 Grame
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.
*/
#include "JackException.h"
#include "JackError.h"
namespace Jack
{
void JackException::PrintMessage()
{
std::string str = what();
if (str != "") {
jack_info(str.c_str());
}
}
}
......@@ -20,10 +20,11 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __JackException__
#define __JackException__
#include "JackCompilerDeps.h"
#include <stdexcept>
#include <iostream>
#include <string>
#include "JackError.h"
namespace Jack
{
......@@ -55,14 +56,9 @@ class SERVER_EXPORT JackException : public std::runtime_error {
return what();
}
void PrintMessage()
{
std::string str = what();
if (str != "") {
jack_info(str.c_str());
}
}
};
void PrintMessage();
};
/*!
\brief Exception thrown by JackEngine in temporary mode.
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "JackLibSampleRateResampler.h"
#include "JackError.h"
namespace Jack
{
......
......@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackMidiBufferReadQueue.h"
#include "JackMidiUtil.h"
#include "JackError.h"
using Jack::JackMidiBufferReadQueue;
......
......@@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "JackMidiBufferWriteQueue.h"
#include "JackMidiUtil.h"
#include "JackError.h"
using Jack::JackMidiBufferWriteQueue;
......
......@@ -19,9 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <assert.h>
#include <stdarg.h>
#include "JackNetInterface.h"
#include "JackError.h"
#include "JackException.h"
#include "JackAudioAdapterInterface.h"
#ifdef __cplusplus
......@@ -122,6 +121,13 @@ extern "C"
LIB_EXPORT int jack_adapter_push_and_pull(jack_adapter_t* adapter, float** input, float** output, unsigned int frames);
LIB_EXPORT int jack_adapter_pull_and_push(jack_adapter_t* adapter, float** input, float** output, unsigned int frames);
#define LOG_LEVEL_INFO 1
#define LOG_LEVEL_ERROR 2
LIB_EXPORT void jack_error(const char *fmt, ...);
LIB_EXPORT void jack_info(const char *fmt, ...);
LIB_EXPORT void jack_log(const char *fmt, ...);
#ifdef __cplusplus
}
#endif
......
......@@ -16,6 +16,8 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "JackCompilerDeps.h"
#include "driver_interface.h"
#include "JackNetDriver.h"
#include "JackEngineControl.h"
#include "JackLockedEngine.h"
......@@ -588,6 +590,7 @@ namespace Jack
extern "C"
{
#endif
SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
{
jack_driver_desc_t * desc;
......
......@@ -18,6 +18,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "JackNetInterface.h"
#include "JackException.h"
#include "JackError.h"
#include <assert.h>
using namespace std;
......@@ -608,6 +610,17 @@ namespace Jack
uint JackNetSlaveInterface::fSlaveCounter = 0;
void JackNetSlaveInterface::InitAPI()
{
// open Socket API with the first slave
if (fSlaveCounter++ == 0) {
if (SocketAPIInit() < 0) {
jack_error("Can't init Socket API, exiting...");
throw std::bad_alloc();
}
}
}
bool JackNetSlaveInterface::Init()
{
jack_log("JackNetSlaveInterface::Init()");
......
......@@ -206,16 +206,7 @@ namespace Jack
void FatalRecvError();
void FatalSendError();
void InitAPI()
{
// open Socket API with the first slave
if (fSlaveCounter++ == 0) {
if (SocketAPIInit() < 0) {
jack_error("Can't init Socket API, exiting...");
throw std::bad_alloc();
}
}
}
void InitAPI();
public:
......
......@@ -753,6 +753,7 @@ JackNetOneDriver::render_jack_ports_to_payload (int bitdepth, JSList *playback_p
extern "C"
{
#endif
SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor ()
{
jack_driver_desc_t * desc;
......
......@@ -20,7 +20,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef __JackNetSocket__
#define __JackNetSocket__
#include "JackError.h"
#include "JackCompilerDeps.h"
#include <cstdlib>
#include <cstdio>
#include <iostream>
......@@ -29,7 +30,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
namespace Jack
{
//get host name*********************************
SERVER_EXPORT int GetHostName ( char * name, int size );
SERVER_EXPORT int GetHostName(char * name, int size);
//net errors ***********************************
enum _net_error
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "JackNetTool.h"
#include "JackError.h"
#ifdef __APPLE__
......
......@@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "JackResampler.h"
#include "JackError.h"
#include <stdio.h>
namespace Jack
......
......@@ -22,7 +22,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "ringbuffer.h"
#include "types.h"
#include "JackError.h"
namespace Jack
{
......
......@@ -294,5 +294,123 @@ void BuildClientPath(char* path_to_so, int path_len, const char* so_name)
#endif
template <class T>
JackGnuPlotMonitor<T>::JackGnuPlotMonitor(uint32_t measure_cnt, uint32_t measure_points, std::string name)
{
jack_log ( "JackGnuPlotMonitor::JackGnuPlotMonitor %u measure points - %u measures", measure_points, measure_cnt );
fMeasureCnt = measure_cnt;
fMeasurePoints = measure_points;
fTablePos = 0;
fName = name;
fCurrentMeasure = new T[fMeasurePoints];
fMeasureTable = new T*[fMeasureCnt];
for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
{
fMeasureTable[cnt] = new T[fMeasurePoints];
fill_n ( fMeasureTable[cnt], fMeasurePoints, 0 );
}
}
template <class T>
JackGnuPlotMonitor<T>::~JackGnuPlotMonitor()
{
jack_log ( "JackGnuPlotMonitor::~JackGnuPlotMonitor" );
for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
delete[] fMeasureTable[cnt];
delete[] fMeasureTable;
delete[] fCurrentMeasure;
}
template <class T>
T JackGnuPlotMonitor<T>::AddNew(T measure_point)
{
fMeasureId = 0;
return fCurrentMeasure[fMeasureId++] = measure_point;
}
template <class T>
uint32_t JackGnuPlotMonitor<T>::New()
{
return fMeasureId = 0;
}
template <class T>
T JackGnuPlotMonitor<T>::Add(T measure_point)
{
return fCurrentMeasure[fMeasureId++] = measure_point;
}
template <class T>
uint32_t JackGnuPlotMonitor<T>::AddLast(T measure_point)
{
fCurrentMeasure[fMeasureId] = measure_point;
fMeasureId = 0;
return Write();
}
template <class T>
uint32_t JackGnuPlotMonitor<T>::Write()
{
for ( uint32_t point = 0; point < fMeasurePoints; point++ )
fMeasureTable[fTablePos][point] = fCurrentMeasure[point];
if ( ++fTablePos == fMeasureCnt )
fTablePos = 0;
return fTablePos;
}
template <class T>
int JackGnuPlotMonitor<T>::Save(std::string name)
{
std::string filename = ( name.empty() ) ? fName : name;
filename += ".log";
jack_log ( "JackGnuPlotMonitor::Save filename %s", filename.c_str() );
std::ofstream file ( filename.c_str() );
for ( uint32_t cnt = 0; cnt < fMeasureCnt; cnt++ )
{
for ( uint32_t point = 0; point < fMeasurePoints; point++ )
file << fMeasureTable[cnt][point] << " \t";
file << std::endl;
}
file.close();
return 0;
}
template <class T>
int JackGnuPlotMonitor<T>::SetPlotFile(std::string* options_list, uint32_t options_number,
std::string* field_names, uint32_t field_number,
std::string name)
{
std::string title = ( name.empty() ) ? fName : name;
std::string plot_filename = title + ".plt";
std::string data_filename = title + ".log";
std::ofstream file ( plot_filename.c_str() );
file << "set multiplot" << std::endl;
file << "set grid" << std::endl;
file << "set title \"" << title << "\"" << std::endl;
for ( uint32_t i = 0; i < options_number; i++ )
file << options_list[i] << std::endl;
file << "plot ";
for ( uint32_t row = 1; row <= field_number; row++ )
{
file << "\"" << data_filename << "\" using " << row << " title \"" << field_names[row-1] << "\" with lines";
file << ( ( row < field_number ) ? ", " : "\n" );
}