- * 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 3 of the License, or
- * (at your option) any later version.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
- * 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.
+ * http://www.apache.org/licenses/LICENSE-2.0
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
-PUBLIC unsigned char _pulse_init (const char *name, audioCtxHandleT *ctx) {
+static struct alsa_info **alsa_info = NULL;
+static struct dev_ctx_pulse **dev_ctx_p = NULL;
+static unsigned int client_count = 0;
+
+
+unsigned char _pulse_init (const char *name, audioCtxHandleT *ctx) {
/* make the client context aware of current card state */
ctx->mute = (unsigned char)dev_ctx_p[ret]->mute;
ctx->channels = (unsigned int)dev_ctx_p[ret]->volume.channels;
for (i = 0; i < ctx->channels; i++)
/* make the client context aware of current card state */
ctx->mute = (unsigned char)dev_ctx_p[ret]->mute;
ctx->channels = (unsigned int)dev_ctx_p[ret]->volume.channels;
for (i = 0; i < ctx->channels; i++)
ctx->idx = ret;
/* open matching sink for playback */
pa_spec = (pa_sample_spec*) malloc (sizeof(pa_sample_spec));
pa_spec->format = PA_SAMPLE_S16LE;
pa_spec->rate = 22050;
ctx->idx = ret;
/* open matching sink for playback */
pa_spec = (pa_sample_spec*) malloc (sizeof(pa_sample_spec));
pa_spec->format = PA_SAMPLE_S16LE;
pa_spec->rate = 22050;
if (!(pa = pa_simple_new (NULL, "afb-audio-plugin", PA_STREAM_PLAYBACK, dev_ctx_p[ret]->sink_name,
"afb-audio-output", pa_spec, NULL, NULL, &error))) {
fprintf (stderr, "Error opening PulseAudio sink %s : %s\n",
dev_ctx_p[ret]->sink_name, pa_strerror(error));
if (!(pa = pa_simple_new (NULL, "afb-audio-plugin", PA_STREAM_PLAYBACK, dev_ctx_p[ret]->sink_name,
"afb-audio-output", pa_spec, NULL, NULL, &error))) {
fprintf (stderr, "Error opening PulseAudio sink %s : %s\n",
dev_ctx_p[ret]->sink_name, pa_strerror(error));
pthread_create (&dev_ctx_p_c->thr, NULL, _pulse_play_thread_fn, (void*)dev_ctx_p_c);
}
pthread_create (&dev_ctx_p_c->thr, NULL, _pulse_play_thread_fn, (void*)dev_ctx_p_c);
}
pa_context_state_t state = pa_context_get_state (context);
dev_ctx_pulse_T *dev_ctx_p_t = (dev_ctx_pulse_T *)data;
pa_context_state_t state = pa_context_get_state (context);
dev_ctx_pulse_T *dev_ctx_p_t = (dev_ctx_pulse_T *)data;
for (i = 0; i < (sizeof(cards)/sizeof(char*)); i++) {
if (!strcmp (cards[i], dev_ctx_p_t->card_name[0])) {
/* it did : stop there and succeed */
for (i = 0; i < (sizeof(cards)/sizeof(char*)); i++) {
if (!strcmp (cards[i], dev_ctx_p_t->card_name[0])) {
/* it did : stop there and succeed */
for (i = 0; i < (sizeof(cards)/sizeof(char*)); i++) {
if (!strcmp (cards[i], dev_ctx_p_t->card_name[0])) {
/* it did : stop there and succeed */
for (i = 0; i < (sizeof(cards)/sizeof(char*)); i++) {
if (!strcmp (cards[i], dev_ctx_p_t->card_name[0])) {
/* it did : stop there and succeed */