2 Copyright (C) 2008-2012 Grame
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include "JackAudioAdapter.h"
21 #include "JackPlatformPlug.h"
22 #include "JackArgParser.h"
29 #include "JackCoreAudioAdapter.h"
30 #define JackPlatformAdapter JackCoreAudioAdapter
34 #include "JackAlsaAdapter.h"
35 #define JackPlatformAdapter JackAlsaAdapter
38 #if defined(__sun__) || defined(sun) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
39 #include "JackOSSAdapter.h"
40 #define JackPlatformAdapter JackOSSAdapter
44 #include "JackPortAudioAdapter.h"
45 #define JackPlatformAdapter JackPortAudioAdapter
55 SERVER_EXPORT
int jack_internal_initialize(jack_client_t
* jack_client
, const JSList
* params
)
57 jack_log("Loading audioadapter");
59 Jack::JackAudioAdapter
* adapter
;
60 jack_nframes_t buffer_size
= jack_get_buffer_size(jack_client
);
61 jack_nframes_t sample_rate
= jack_get_sample_rate(jack_client
);
65 adapter
= new Jack::JackAudioAdapter(jack_client
, new Jack::JackPlatformAdapter(buffer_size
, sample_rate
, params
), params
);
68 if (adapter
->Open() == 0) {
76 jack_info("audioadapter allocation error");
81 SERVER_EXPORT
int jack_initialize(jack_client_t
* jack_client
, const char* load_init
)
83 JSList
* params
= NULL
;
84 bool parse_params
= true;
86 jack_driver_desc_t
* desc
= jack_get_descriptor();
88 Jack::JackArgParser
parser(load_init
);
89 if (parser
.GetArgc() > 0) {
90 parse_params
= parser
.ParseParams(desc
, ¶ms
);
94 res
= jack_internal_initialize(jack_client
, params
);
95 parser
.FreeParams(params
);
100 SERVER_EXPORT
void jack_finish(void* arg
)
102 Jack::JackAudioAdapter
* adapter
= static_cast<Jack::JackAudioAdapter
*>(arg
);
105 jack_log("Unloading audioadapter");