2 Copyright (C) 2008 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 "JackArgParser.h"
27 #include "JackAlsaAdapter.h"
31 #include "JackCoreAudioAdapter.h"
35 #include "JackPortAudioAdapter.h"
38 #if defined(__sun__) || defined(sun)
39 #include "JackOSSAdapter.h"
49 SERVER_EXPORT
int jack_internal_initialize(jack_client_t
* jack_client
, const JSList
* params
)
51 jack_log("Loading audioadapter");
53 Jack::JackAudioAdapter
* adapter
;
54 jack_nframes_t buffer_size
= jack_get_buffer_size(jack_client
);
55 jack_nframes_t sample_rate
= jack_get_sample_rate(jack_client
);
60 adapter
= new Jack::JackAudioAdapter(jack_client
, new Jack::JackAlsaAdapter(buffer_size
, sample_rate
, params
));
64 adapter
= new Jack::JackAudioAdapter(jack_client
, new Jack::JackPortAudioAdapter(buffer_size
, sample_rate
, params
));
68 adapter
= new Jack::JackAudioAdapter(jack_client
, new Jack::JackCoreAudioAdapter(buffer_size
, sample_rate
, params
));
71 #if defined(__sun__) || defined(sun)
72 adapter
= new Jack::JackAudioAdapter(jack_client
, new Jack::JackOSSAdapter(buffer_size
, sample_rate
, params
));
77 if (adapter
->Open() == 0)
90 SERVER_EXPORT
int jack_initialize(jack_client_t
* jack_client
, const char* load_init
)
92 JSList
* params
= NULL
;
93 bool parse_params
= true;
95 jack_driver_desc_t
* desc
= jack_get_descriptor();
97 Jack::JackArgParser
parser ( load_init
);
98 if ( parser
.GetArgc() > 0 )
99 parse_params
= parser
.ParseParams ( desc
, ¶ms
);
102 res
= jack_internal_initialize ( jack_client
, params
);
103 parser
.FreeParams ( params
);
108 SERVER_EXPORT
void jack_finish(void* arg
)
110 Jack::JackAudioAdapter
* adapter
= static_cast<Jack::JackAudioAdapter
*>(arg
);
113 jack_log("Unloading audioadapter");