Changeset 191

Show
Ignore:
Timestamp:
01/16/08 13:29:17 (4 years ago)
Author:
ath
Message:

Output driver fixes.

Location:
fm_server/trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • fm_server/trunk/src/fm_output_alsa.c

    r149 r191  
    11/* 
    22 *  FreeMix - sound server 
    3  *  Copyright (C) 2006 Alberto Botti <alberto.botti@yoda2000.net> 
     3 *  Copyright (C) 2006-2008 Alberto Botti <alberto.botti@yoda2000.net> 
    44 * 
    55 *  This program is free software; you can redistribute it and/or modify 
     
    1616 *  along with this program; if not, write to the Free Software 
    1717 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     18 * 
     19 * 
     20 *  fm_output_alsa.c - Output element for the JACK audio subsystem 
     21 * 
     22 *  (a lot of this code comes from AlsaPlayer and TerminatorX) 
     23 * 
    1824 */ 
    1925  
    20  
    21 /* Most of this stuff came from AlsaPlayer. */ 
    2226 
    2327#include <glib.h> 
     
    3842 
    3943#define ALSA_DEFAULT_DEVICE "default" 
     44//#define ALSA_DEFAULT_DEVICE "surround40" 
    4045#define ALSA_DEFAULT_SAMPLE_RATE 44100 
     46//#define ALSA_DEFAULT_SAMPLE_RATE 48000 
    4147#define ALSA_DEFAULT_BUFFER_TIME 22000 
    4248#define ALSA_DEFAULT_PERIOD_TIME 10000 
     
    288294        } 
    289295 
    290         output->sample_rate = 44100; 
     296//      output->sample_rate = 44100; 
     297        output->sample_rate = ALSA_DEFAULT_SAMPLE_RATE; 
    291298        err = snd_pcm_hw_params_set_rate_near (output_alsa->sound_handle, 
    292299                                               output_alsa->hwparams, 
     
    437444                //g_print("asking for %d samples\n", output_alsa->buffer_size_samples); 
    438445                FM_BUFFER_REQUESTED(output_alsa->main_buffer) = output_alsa->buffer_size_samples; 
    439                 fm_element_get_buffer_from_src(element, output_alsa->main_buffer); 
    440  
    441                 FmSync *sync = fm_element_pipeline_get_sync_info (element); 
    442                 fm_sync_update_cycle (sync); 
     446                fm_element_get_buffer_from_src(element, output_alsa->main_buffer, NULL); 
     447 
     448/*              FmSync *sync = fm_element_pipeline_get_sync_info (element); 
     449                fm_sync_update_cycle (sync);            FIXME: obsoleted */ 
    443450         
    444451                src_float_to_short_array_stereo (output_alsa->main_buffer->channel_data[0], 
  • fm_server/trunk/src/fm_output_alsa.h

    r151 r191  
    11/* 
    22 *  FreeMix - sound server 
    3  *  Copyright (C) 2006 Alberto Botti <alberto.botti@yoda2000.net> 
     3 *  Copyright (C) 2006-2008 Alberto Botti <alberto.botti@yoda2000.net> 
    44 * 
    55 *  This program is free software; you can redistribute it and/or modify 
     
    1616 *  along with this program; if not, write to the Free Software 
    1717 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     18 * 
     19 * 
     20 *  fm_output_alsa.h - Output element for the JACK audio subsystem 
     21 * 
     22 *  (a lot of this code comes from AlsaPlayer and TerminatorX) 
     23 * 
    1824 */ 
    1925 
  • fm_server/trunk/src/fm_output_jack.c

    r181 r191  
     1/* 
     2 *  FreeMix - sound server 
     3 *  Copyright (C) 2008 Alberto Botti <alberto.botti@yoda2000.net> 
     4 * 
     5 *  This program is free software; you can redistribute it and/or modify 
     6 *  it under the terms of the GNU General Public License as published by 
     7 *  the Free Software Foundation; either version 2 of the License, or 
     8 *  (at your option) any later version. 
     9 * 
     10 *  This program is distributed in the hope that it will be useful, 
     11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
     12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
     13 *  GNU Library General Public License for more details. 
     14 * 
     15 *  You should have received a copy of the GNU General Public License 
     16 *  along with this program; if not, write to the Free Software 
     17 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     18 * 
     19 * 
     20 *  fm_output_jack.c - Output element for the JACK audio subsystem 
     21 * 
     22 *  (a lot of this code comes from the JACK programming examples) 
     23 * 
     24 */ 
     25 
     26 
    127#include <glib.h> 
    228#include <glib-object.h> 
     
    139165        FmOutputJack *output_jack = FM_OUTPUT_JACK (element); 
    140166 
     167        if (!output_jack->client) { 
     168                g_warning ("Can't activate FmOutputJack - not initialized\n"); 
     169                return FALSE; 
     170        } 
     171 
    141172        g_print ("Activating FmOutputJack\n"); 
     173 
    142174         
    143175        /* Creating the ports... */ 
     
    184216jack_start                              (FmOutput       *output) 
    185217{ 
    186         FmOutputJack *output_jack = FM_OUTPUT_JACK(output); 
     218        FmElement *element = FM_ELEMENT (output); 
     219        FmOutputJack *output_jack = FM_OUTPUT_JACK (output); 
     220 
     221        g_return_val_if_fail (element->active, FALSE); 
    187222 
    188223        if (jack_activate(output_jack->client) == 0) { 
     
    199234jack_stop                               (FmOutput       *output) 
    200235{ 
    201         FmOutputJack *output_jack = FM_OUTPUT_JACK(output); 
     236        FmElement *element = FM_ELEMENT (output); 
     237        FmOutputJack *output_jack = FM_OUTPUT_JACK (output); 
     238 
     239        g_return_val_if_fail (element->active, FALSE); 
    202240 
    203241        if (jack_deactivate(output_jack->client) == 0) { 
     
    214252jack_connect_to_hw_ports                (FmOutputJack   *output_jack) 
    215253{ 
    216         /* FIXME: check if activated */ 
     254        FmElement *element = FM_ELEMENT (output_jack); 
     255        g_return_if_fail (element->active); 
    217256         
    218257        const char **ports = jack_get_ports (output_jack->client, 
     
    293332 
    294333        FM_BUFFER_REQUESTED(output_jack->main_buffer) = nframes; 
    295         fm_element_get_buffer_from_src(element, output_jack->main_buffer); 
     334        fm_element_get_buffer_from_src(element, output_jack->main_buffer, NULL); 
    296335 
    297336        memcpy(left, FM_BUFFER_CHANNEL_DATA(output_jack->main_buffer, 0), 
     
    300339               nframes * sizeof(jack_default_audio_sample_t)); 
    301340 
    302         FmSync *sync = fm_element_pipeline_get_sync_info (element); 
    303         fm_sync_update_cycle (sync); 
     341/*      FmSync *sync = fm_element_pipeline_get_sync_info (element); 
     342        fm_sync_update_cycle (sync);           FIXME: obsoleted */ 
    304343         
    305344        return 0; 
  • fm_server/trunk/src/fm_output_jack.h

    r151 r191  
    11/* 
    22 *  FreeMix - sound server 
    3  *  Copyright (C) 2006 Alberto Botti <alberto.botti@yoda2000.net> 
     3 *  Copyright (C) 2008 Alberto Botti <alberto.botti@yoda2000.net> 
    44 * 
    55 *  This program is free software; you can redistribute it and/or modify 
     
    1616 *  along with this program; if not, write to the Free Software 
    1717 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
     18 * 
     19 * 
     20 *  fm_output_jack.h - Output element for the JACK audio subsystem 
     21 * 
     22 *  (a lot of this code comes from the JACK programming examples) 
     23 * 
    1824 */ 
    1925