File: SoundSamples.h

package info (click to toggle)
transcend 0.3.dfsg2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 5,796 kB
  • ctags: 3,074
  • sloc: cpp: 26,886; ansic: 693; sh: 210; makefile: 99; perl: 67
file content (100 lines) | stat: -rw-r--r-- 2,274 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
 * Modification History
 *
 * 2004-July-17   Jason Rohrer
 * Created.
 *
 * 2004-August-12   Jason Rohrer
 * Added a constructor that can specify all sound data.
 */



#ifndef SOUND_SAMPLES_INCLUDED
#define SOUND_SAMPLES_INCLUDED



/**
 * Class that encapsulates a buffer of sound samples.
 *
 * @author Jason Rohrer
 */
class SoundSamples {


    public:

        unsigned long mSampleCount;
        
        float *mLeftChannel;
        float *mRightChannel;


        
        /**
         * Constructs a sound samples object.
         *
         * @param inSampleCount the number of samples.
         * @param inLeftChannel samples for the left channel.
         *   Will be destroyed when this class is destroyed.
         * @param inRightChannel samples for the right channel.
         *   Will be destroyed when this class is destroyed.
         */
        SoundSamples( unsigned long inSampleCount,
                      float *inLeftChannel, float *inRightChannel );


        
        /**
         * Constructs a sound samples object filled with 0 samples.
         *
         * @param inSampleCount the number of samples.
         */
        SoundSamples( unsigned long inSampleCount );


        
        /**
         * Constructs a sound samples object by copying another object.
         *
         * @param inSamplesToCopy the object to copy.
         *   Must be destroyed by caller.
         */
        SoundSamples( SoundSamples *inSamplesToCopy );

        

        /**
         * Constructs a sound samples object by copying samples from
         * another object.
         *
         * @param inSamplesToCopy the object to copy.
         *   Must be destroyed by caller.
         * @param inNumToCopy the number of samples from the start of
         *   inSamplesToCopy to take.
         */
        SoundSamples( SoundSamples *inSamplesToCopy,
                      unsigned long inNumToCopy );

        
        
        ~SoundSamples();


        
        /**
         * Trims samples from the beginning of this sound.
         *
         * @param inNumSamplesToDrop the number of samples at the beginning
         *   of this sound to drop.
         */
        void trim( unsigned long inNumSamplesToDrop );
        

        
    };



#endif