Commit f0be6772 authored by sletz's avatar sletz
Browse files

New JackAudioAdapterFactory.

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2706 0c269be4-1314-0410-8aa9-9f06e86f4224
parent 2280b776
......@@ -188,87 +188,3 @@ fail:
}
} //namespace
#ifdef __cplusplus
extern "C"
{
#endif
#include "driver_interface.h"
#ifdef __linux__
#include "JackAlsaAdapter.h"
#endif
#ifdef __APPLE__
#include "JackCoreAudioAdapter.h"
#endif
#ifdef WIN32
#include "JackPortAudioAdapter.h"
#endif
using namespace Jack;
EXPORT int jack_internal_initialize(jack_client_t* jack_client, const JSList* params)
{
jack_log("Loading audioadapter");
Jack::JackAudioAdapter* adapter;
jack_nframes_t buffer_size = jack_get_buffer_size(jack_client);
jack_nframes_t sample_rate = jack_get_sample_rate(jack_client);
#ifdef __linux__
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackAlsaAdapter(buffer_size, sample_rate, params));
#endif
#ifdef WIN32
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackPortAudioAdapter(buffer_size, sample_rate, params));
#endif
#ifdef __APPLE__
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackCoreAudioAdapter(buffer_size, sample_rate, params));
#endif
assert(adapter);
if (adapter->Open() == 0)
return 0;
else
{
delete adapter;
return 1;
}
}
EXPORT int jack_initialize(jack_client_t* jack_client, const char* load_init)
{
JSList* params = NULL;
jack_driver_desc_t *desc = jack_get_descriptor();
JackArgParser parser(load_init);
if (parser.GetArgc() > 0)
{
if (parser.ParseParams(desc, &params) != 0)
jack_error("Internal client : JackArgParser::ParseParams error.");
}
return jack_internal_initialize(jack_client, params);
}
EXPORT void jack_finish(void* arg)
{
Jack::JackAudioAdapter* adapter = static_cast<Jack::JackAudioAdapter*>(arg);
if (adapter)
{
jack_log("Unloading audioadapter");
adapter->Close();
delete adapter;
}
}
#ifdef __cplusplus
}
#endif
/*
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 "JackAudioAdapter.h"
#include "JackTools.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#ifdef __cplusplus
extern "C"
{
#endif
#include "driver_interface.h"
#ifdef __linux__
#include "JackAlsaAdapter.h"
#endif
#ifdef __APPLE__
#include "JackCoreAudioAdapter.h"
#endif
#ifdef WIN32
#include "JackPortAudioAdapter.h"
#endif
using namespace Jack;
EXPORT int jack_internal_initialize(jack_client_t* jack_client, const JSList* params)
{
jack_log("Loading audioadapter");
Jack::JackAudioAdapter* adapter;
jack_nframes_t buffer_size = jack_get_buffer_size(jack_client);
jack_nframes_t sample_rate = jack_get_sample_rate(jack_client);
#ifdef __linux__
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackAlsaAdapter(buffer_size, sample_rate, params));
#endif
#ifdef WIN32
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackPortAudioAdapter(buffer_size, sample_rate, params));
#endif
#ifdef __APPLE__
adapter = new Jack::JackAudioAdapter(jack_client, new Jack::JackCoreAudioAdapter(buffer_size, sample_rate, params));
#endif
assert(adapter);
if (adapter->Open() == 0)
return 0;
else
{
delete adapter;
return 1;
}
}
EXPORT int jack_initialize(jack_client_t* jack_client, const char* load_init)
{
JSList* params = NULL;
jack_driver_desc_t *desc = jack_get_descriptor();
JackArgParser parser(load_init);
if (parser.GetArgc() > 0)
{
if (parser.ParseParams(desc, &params) != 0)
jack_error("Internal client : JackArgParser::ParseParams error.");
}
return jack_internal_initialize(jack_client, params);
}
EXPORT void jack_finish(void* arg)
{
Jack::JackAudioAdapter* adapter = static_cast<Jack::JackAudioAdapter*>(arg);
if (adapter)
{
jack_log("Unloading audioadapter");
adapter->Close();
delete adapter;
}
}
#ifdef __cplusplus
}
#endif
......@@ -195,20 +195,32 @@ def build(bld):
create_jack_process_obj(bld, 'netmanager', 'JackNetManager.cpp', serverlib)
if bld.env()['IS_MACOSX']:
process = create_jack_process_obj(bld, 'audioadapter','JackResampler.cpp JackLibSampleRateResampler.cpp JackAudioAdapter.cpp JackAudioAdapterInterface.cpp ../macosx/JackCoreAudioAdapter.cpp', serverlib)
if bld.env()['IS_LINUX']:
process = create_jack_process_obj(bld, 'audioadapter','JackResampler.cpp JackLibSampleRateResampler.cpp JackAudioAdapter.cpp JackAudioAdapterInterface.cpp ../linux/alsa/JackAlsaAdapter.cpp', serverlib)
#process = create_jack_process_obj(bld, 'audioadapter', 'JackResampler.cpp JackLibSampleRateResampler.cpp JackAudioAdapter.cpp JackAudioAdapterInterface.cpp ../windows/JackPortAudioAdapter.cpp', serverlib)
process.env.append_value("LINKFLAGS", "-lsamplerate")
adapter_sources = [
'JackResampler.cpp',
'JackLibSampleRateResampler.cpp',
'JackAudioAdapter.cpp',
'JackAudioAdapterFactory.cpp',
'JackAudioAdapterInterface.cpp',
]
if bld.env()['IS_MACOSX']:
process.env.append_value("LINKFLAGS", "../macosx/libportaudio.a -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
adapter_sources += ['../macosx/JackCoreAudioAdapter.cpp']
process = create_jack_process_obj(bld, 'audioadapter', adapter_sources, serverlib)
process.env.append_value("LINKFLAGS", "../macosx/libportaudio.a -framework CoreAudio -framework AudioUnit -framework AudioToolbox -framework CoreServices")
process.env.append_value("LINKFLAGS", "-lsamplerate")
if bld.env()['IS_LINUX']:
process.env.append_value("LINKFLAGS", "-lasound")
adapter_sources += ['../linux/alsa/JackAlsaAdapter.cpp']
process = create_jack_process_obj(bld, 'audioadapter', adapter_sources, serverlib)
process.env.append_value("LINKFLAGS", "-lasound -lsamplerate")
if bld.env()['IS_SUN']:
adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp']
process = create_jack_process_obj(bld, 'audioadapter', adapter_sources, serverlib)
process.env.append_value("LINKFLAGS", "-lsamplerate")
#adapter_sources += ['../windows/JackPortAudioAdapter.cpp']
#process = create_jack_process_obj(bld, 'audioadapter', adapter_sources, serverlib)
install_files('PREFIX', 'include/jack', 'jack/*.h')
......
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