File: StereoSoundParameterSpaceControlPoint.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 (129 lines) | stat: -rw-r--r-- 3,557 bytes parent folder | download | duplicates (6)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Modification History
 *
 * 2004-August-9   Jason Rohrer
 * Created.
 *
 * 2004-August-12   Jason Rohrer
 * Added support for getting blocks of samples.
 *
 * 2004-August-15   Jason Rohrer
 * Added function that generates a playable sound.
 */



#ifndef STEREO_SOUND_PARAMETER_SPACE_CONTROL_POINT_INCLUDED
#define STEREO_SOUND_PARAMETER_SPACE_CONTROL_POINT_INCLUDED


#include "ParameterSpaceControlPoint.h"
#include "SoundParameterSpaceControlPoint.h"
#include "SoundSamples.h"
#include "PlayableSound.h"



#include <stdio.h>



/**
 * A control point in a 1-D parameterized stereo sound space.
 *
 * @author Jason Rohrer.
 */
class StereoSoundParameterSpaceControlPoint :
    public ParameterSpaceControlPoint {


    public:


        
        /**
         * Constructs a control point.
         *
         * @param inLeftPoint the left control point.
         *   Will be destroyed when this class is destroyed.
         * @param inRightPoint the right control point.
         *   Will be destroyed when this class is destroyed.
         */
        StereoSoundParameterSpaceControlPoint(
            SoundParameterSpaceControlPoint *inLeftPoint,
            SoundParameterSpaceControlPoint *inRightPoint );
        
        

        /**
         * Constructs a control point by reading values from a text file
         * stream.
         *
         * @param inFILE the open file to read from.
         *   Must be closed by caller.
         * @param outError pointer to where error flag should be returned.
         *   Destination will be set to true if reading a control point
         *   from inFILE fails.
         */
        StereoSoundParameterSpaceControlPoint( FILE *inFILE, char *outError );
        

        
        virtual ~StereoSoundParameterSpaceControlPoint();


        
        // implements the ParameterSpaceControlPoint interface
        ParameterSpaceControlPoint *copy();

        ParameterSpaceControlPoint *createLinearBlend(
            ParameterSpaceControlPoint *inOtherPoint,
            double inWeightOfOtherPoint );


        
        /**
         * Gets a block of samples from this control point.
         *
         * @param inStartSample the index of the first sample to get.
         * @param inSampleCount the number of samples to get.
         * @param inSamplesPerSecond the current sample rate.
         * @param inSoundLengthInSeconds the total length of the sound being
         *   played.
         *
         * @return the samples.
         *   Must be destroyed by caller.
         */
        SoundSamples *getSoundSamples( unsigned long inStartSample,
                                       unsigned long inSampleCount,
                                       unsigned long inSamplesPerSecond,
                                       double inSoundLengthInSeconds );

        

        /**
         * Gets a playable sound from this control point.
         *
         * @param inSamplesPerSecond the sample rate.
         * @param inSoundLengthInSeconds the length of the sound.
         *
         * @return a playable sound.
         *   Must be destroyed by caller.
         */
        PlayableSound *getPlayableSound( unsigned long inSamplesPerSecond,
                                         double inSoundLengthInSeconds );

        
        
        // these are public so that other Stereo Sound points can access
        // them when performing a blend.
        SoundParameterSpaceControlPoint *mLeftPoint;
        SoundParameterSpaceControlPoint *mRightPoint;

        
    };



#endif