
/*
 * --- GSMP-COPYRIGHT-NOTE-BEGIN ---
 * 
 * This copyright note is auto-generated by ./scripts/Create-CopyPatch.
 * Please add additional copyright information _after_ the line containing
 * the GSMP-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
 * the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
 * 
 * GSMP: pcm/src/BasicIOStream.cc
 * General Sound Manipulation Program is Copyright (C) 2000 - 2004
 *   Valentin Ziegler and René Rebe
 * 
 * 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; version 2. A copy of the GNU General
 * Public License can be found in the file LICENSE.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANT-
 * ABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
 * Public License for more details.
 * 
 * --- GSMP-COPYRIGHT-NOTE-END ---
 */

/* Short Description:
 *   IO architecture. Base classes and Mixer implementation.
 */

#include <iostream>
#include "Limits.hh"
#include "Logging.hh"

#include "BasicIOStream.hh"

using namespace GSMP;

const BasicIOStream::IOParams& BasicIOStream::Params ()
{
  return m_params;
}

channel_index BasicIOStream::SetPlaybackChannels (channel_index n_pl_channels)
{
  m_params.cur_pl_channels =
    Utility::limit_min_max (n_pl_channels,
			    m_params.min_pl_channels,
			    m_params.max_pl_channels);
  return m_params.cur_pl_channels;
}

channel_index BasicIOStream::SetCaptureChannels (channel_index n_ca_channels)
{
  m_params.cur_ca_channels =
    Utility::limit_min_max (n_ca_channels,
			    m_params.min_ca_channels,
			    m_params.max_ca_channels);
  return m_params.cur_ca_channels;
}

sample_rate BasicIOStream::SetRate (sample_rate n_rate)
{
  m_params.cur_rate =
    Utility::limit_min_max (n_rate,
			    m_params.min_rate, m_params.max_rate);
  return m_params.cur_rate;
}

int BasicIOStream::SetDepth (int n_depth)
{
  m_params.cur_depth =
    Utility::limit_min_max (n_depth,
			    m_params.min_depth, m_params.max_depth);
  return m_params.cur_depth;
}

int BasicIOStream::SetPeriodTime (int n_period_time)
{
  m_params.cur_period_time =
    Utility::limit_min_max (n_period_time,
			    m_params.min_period_time, m_params.max_period_time);
  return m_params.cur_period_time;
}

int BasicIOStream::SetPeriods (int n_periods)
{
  m_params.cur_periods =
    Utility::limit_min_max (n_periods,
			    m_params.min_periods, m_params.max_periods);
  return m_params.cur_periods;
}
