Skip to content

Commit

Permalink
Correct export settings(2).
Browse files Browse the repository at this point in the history
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@4663 0c269be4-1314-0410-8aa9-9f06e86f4224
  • Loading branch information
sletz committed Jan 4, 2012
1 parent 9cb4950 commit aabbb62
Show file tree
Hide file tree
Showing 39 changed files with 577 additions and 368 deletions.
72 changes: 72 additions & 0 deletions common/JackAudioAdapterInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
79 changes: 10 additions & 69 deletions common/JackAudioAdapterInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
6 changes: 3 additions & 3 deletions common/JackClientInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions common/JackError.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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));
}

Expand Down
18 changes: 7 additions & 11 deletions common/JackError.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
}
Expand Down
34 changes: 34 additions & 0 deletions common/JackException.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
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());
}
}

}
14 changes: 5 additions & 9 deletions common/JackException.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions common/JackLibSampleRateResampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "JackLibSampleRateResampler.h"
#include "JackError.h"

namespace Jack
{
Expand Down
1 change: 1 addition & 0 deletions common/JackMidiBufferReadQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions common/JackMidiBufferWriteQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
10 changes: 8 additions & 2 deletions common/JackNetAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions common/JackNetDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -588,6 +590,7 @@ namespace Jack
extern "C"
{
#endif

SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
{
jack_driver_desc_t * desc;
Expand Down
Loading

0 comments on commit aabbb62

Please sign in to comment.