/[svn]/linuxsampler/trunk/src/drivers/audio/AudioChannel.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/drivers/audio/AudioChannel.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1004 by schoenebeck, Thu Dec 28 18:05:14 2006 UTC revision 1037 by schoenebeck, Tue Jan 23 20:03:22 2007 UTC
# Line 3  Line 3 
3   *   LinuxSampler - modular, streaming capable sampler                     *   *   LinuxSampler - modular, streaming capable sampler                     *
4   *                                                                         *   *                                                                         *
5   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *   *   Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck   *
6   *   Copyright (C) 2005, 2006 Christian Schoenebeck                        *   *   Copyright (C) 2005 - 2007 Christian Schoenebeck                       *
7   *                                                                         *   *                                                                         *
8   *   This program is free software; you can redistribute it and/or modify  *   *   This program is free software; you can redistribute it and/or modify  *
9   *   it under the terms of the GNU General Public License as published by  *   *   it under the terms of the GNU General Public License as published by  *
# Line 109  namespace LinuxSampler { Line 109  namespace LinuxSampler {
109       * Copies audio data (unmodified) from this AudioChannel to the given       * Copies audio data (unmodified) from this AudioChannel to the given
110       * destination AudioChannel.       * destination AudioChannel.
111       *       *
112         * @e Caution: This method will overwrite the content in the destination
113         * channel buffer.
114         *
115       * @param pDst    - destination channel       * @param pDst    - destination channel
116       * @param Samples - amount of sample points to be copied       * @param Samples - amount of sample points to be copied
117       */       */
# Line 121  namespace LinuxSampler { Line 124  namespace LinuxSampler {
124       * AudioChannel and applies the given volume coefficient to the       * AudioChannel and applies the given volume coefficient to the
125       * destination audio signal.       * destination audio signal.
126       *       *
127         * @e Caution: This method will overwrite the content in the destination
128         * channel buffer.
129         *
130       * @param pDst    - destination channel       * @param pDst    - destination channel
131       * @param Samples - amount of sample points to be copied       * @param Samples - amount of sample points to be copied
132       * @param fLevel  - volume coefficient to be applied       * @param fLevel  - volume coefficient to be applied
# Line 135  namespace LinuxSampler { Line 141  namespace LinuxSampler {
141          }          }
142      }      }
143    
144        /**
145         * Copies audio data (unmodified) from this AudioChannel and mixes it to the
146         * given destination AudioChannel.
147         *
148         * @param pDst    - destination channel
149         * @param Samples - amount of sample points to be mixed over
150         */
151        void AudioChannel::MixTo(AudioChannel* pDst, const uint Samples) {
152            //TODO: there's probably a more efficient way to do this ...
153            float* pSrcBuf = Buffer();
154            float* pDstBuf = pDst->Buffer();
155            for (int i = 0; i < Samples; i++)
156                pDstBuf[i] += pSrcBuf[i];
157        }
158    
159        /**
160         * Copies audio data from this AudioChannel, applies the given volume
161         * coefficient to the audio signal and mixes it to the given destination
162         * channel.
163         *
164         * @param pDst    - destination channel
165         * @param Samples - amount of sample points to be mixed over
166         * @param fLevel  - volume coefficient to be applied
167         */
168        void AudioChannel::MixTo(AudioChannel* pDst, const uint Samples, const float fLevel) {
169            if (fLevel == 1.0f) MixTo(pDst, Samples);
170            else {
171                float* pSrcBuf = Buffer();
172                float* pDstBuf = pDst->Buffer();
173                for (int i = 0; i < Samples; i++)
174                    pDstBuf[i] += pSrcBuf[i] * fLevel;
175            }
176        }
177    
178      std::map<String,DeviceRuntimeParameter*> AudioChannel::ChannelParameters() {      std::map<String,DeviceRuntimeParameter*> AudioChannel::ChannelParameters() {
179          return Parameters;          return Parameters;
180      }      }

Legend:
Removed from v.1004  
changed lines
  Added in v.1037

  ViewVC Help
Powered by ViewVC