/*
* Copyright (C) 2005-2007 by Pieter Palmers
*
* This file is part of FFADO
* FFADO = Free Firewire (pro-)audio drivers for linux
*
* FFADO is based upon FreeBoB.
*
* 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.
*
* 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, see .
*
*/
/**
* Test application for the direct decode stream API
* for floating point use
*/
#ifdef HAVE_CONFIG_H
#include
#endif
#include
#include
#include
#include
#include "libffado/ffado.h"
#include "debugtools.h"
int run;
static void sighandler (int sig)
{
run = 0;
}
int main(int argc, char *argv[])
{
#define PERIOD_SIZE 256
int samplesread=0;
// int sampleswritten=0;
int nb_in_channels=0, nb_out_channels=0;
int retval=0;
int i=0;
int start_flag = 0;
int nb_periods=0;
float **audiobuffers_in;
ffado_sample_t **audiobuffers_out;
ffado_sample_t *nullbuffer;
run=1;
printf("Ffado streaming test application (3)\n");
signal (SIGINT, sighandler);
signal (SIGPIPE, sighandler);
ffado_device_info_t device_info;
memset(&device_info,0,sizeof(ffado_device_info_t));
ffado_options_t dev_options;
memset(&dev_options,0,sizeof(ffado_options_t));
dev_options.sample_rate=44100;
dev_options.period_size=PERIOD_SIZE;
dev_options.nb_buffers=3;
dev_options.realtime=1;
dev_options.packetizer_priority=70;
dev_options.verbose=5;
dev_options.slave_mode=0;
dev_options.snoop_mode=0;
ffado_device_t *dev=ffado_streaming_init(device_info, dev_options);
if (!dev) {
fprintf(stderr,"Could not init Ffado Streaming layer\n");
exit(-1);
}
nb_in_channels=ffado_streaming_get_nb_capture_streams(dev);
nb_out_channels=ffado_streaming_get_nb_playback_streams(dev);
/* allocate intermediate buffers */
audiobuffers_in=calloc(nb_in_channels,sizeof(float *));
audiobuffers_out=calloc(nb_in_channels,sizeof(ffado_sample_t));
for (i=0;i