~ubuntu-branches/ubuntu/saucy/sflphone/saucy

« back to all changes in this revision

Viewing changes to sflphone-common/src/audio/audioloop.h

  • Committer: Bazaar Package Importer
  • Author(s): Francois Marier
  • Date: 2010-12-24 16:33:55 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20101224163355-tkvvikqxbrbav6up
Tags: 0.9.11-1
* New upstream release
* Add new build dependencies on libwebkit-dev and libyaml-dev

* Bump Standards-Version up to 3.9.1
* Bump debhelper compatibility to 8
* Patch another typo in the upstream code (lintian notice)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *  Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010 Savoir-Faire Linux Inc.
3
3
 *  Author: Yan Morin <yan.morin@savoirfairelinux.com>
4
4
 *
5
 
 *  Inspired by tonegenerator of 
 
5
 *  Inspired by tonegenerator of
6
6
 *   Laurielle Lea <laurielle.lea@savoirfairelinux.com> (2004)
7
 
 * 
 
7
 *
8
8
 *  This program is free software; you can redistribute it and/or modify
9
9
 *  it under the terms of the GNU General Public License as published by
10
10
 *  the Free Software Foundation; either version 3 of the License, or
41
41
 * @brief Loop on a sound file
42
42
 */
43
43
 
44
 
class AudioLoop {
45
 
public:
46
 
  /**
47
 
   * Constructor
48
 
   */
49
 
  AudioLoop();
50
 
  
51
 
  /**
52
 
   * Virtual destructor
53
 
   */
54
 
  virtual ~AudioLoop();
55
 
 
56
 
  /**
57
 
   * Get the next fragment of the tone
58
 
   * the function change the intern position, and will loop
59
 
   * @param output  The data buffer
60
 
   * @param nb of int16 to send
61
 
   * @param volume  The volume
62
 
   * @return the number of int16 sent (nb*2)
63
 
   */
64
 
  int getNext(SFLDataFormat* output, int nb, short volume=100);
65
 
  
66
 
  /**
67
 
   * Reset the pointer position
68
 
   */ 
69
 
  void reset() { _pos = 0; }
70
 
 
71
 
  /**
72
 
   * Accessor to the size of the buffer
73
 
   * @return unsigned int The size
74
 
   */
75
 
  unsigned int getSize() { return _size; }
76
 
  
77
 
 
78
 
protected:
79
 
  /** The data buffer */
80
 
  SFLDataFormat* _buffer;
81
 
 
82
 
  /** Number of int16 inside the buffer, not the delay */
83
 
  int _size;  
84
 
 
85
 
  /** current position, set to 0, when initialize */
86
 
  int _pos;  
87
 
 
88
 
  /** Sample rate */
89
 
  int _sampleRate;
90
 
 
91
 
private:
92
 
 
93
 
  // Copy Constructor
94
 
  AudioLoop(const AudioLoop& rh);
95
 
 
96
 
  // Assignment Operator
97
 
  AudioLoop& operator=( const AudioLoop& rh);
 
44
class AudioLoop
 
45
{
 
46
    public:
 
47
        /**
 
48
         * Constructor
 
49
         */
 
50
        AudioLoop();
 
51
 
 
52
        /**
 
53
         * Virtual destructor
 
54
         */
 
55
        virtual ~AudioLoop();
 
56
 
 
57
        /**
 
58
         * Get the next fragment of the tone
 
59
         * the function change the intern position, and will loop
 
60
         * @param output  The data buffer
 
61
         * @param nb of int16 to send
 
62
         * @param volume  The volume
 
63
         * @return the number of int16 sent (nb*2)
 
64
         */
 
65
        int getNext (SFLDataFormat* output, int nb, short volume=100);
 
66
 
 
67
        /**
 
68
         * Reset the pointer position
 
69
         */
 
70
        void reset() {
 
71
            _pos = 0;
 
72
        }
 
73
 
 
74
        /**
 
75
         * Accessor to the size of the buffer
 
76
         * @return unsigned int The size
 
77
         */
 
78
        unsigned int getSize() {
 
79
            return _size;
 
80
        }
 
81
 
 
82
 
 
83
    protected:
 
84
        /** The data buffer */
 
85
        SFLDataFormat* _buffer;
 
86
 
 
87
        /** Number of int16 inside the buffer, not the delay */
 
88
        int _size;
 
89
 
 
90
        /** current position, set to 0, when initialize */
 
91
        int _pos;
 
92
 
 
93
        /** Sample rate */
 
94
        int _sampleRate;
 
95
 
 
96
    private:
 
97
 
 
98
        // Copy Constructor
 
99
        AudioLoop (const AudioLoop& rh);
 
100
 
 
101
        // Assignment Operator
 
102
        AudioLoop& operator= (const AudioLoop& rh);
98
103
};
99
104
 
100
105
#endif // __AUDIOLOOP_H__