Debian Codegraph @

audio/Smooth_proc.h

raw symbols SCIP
1 /* Copyright 2012 Kjetil S. Matheussen
2
3 This program is free software; you can redistribute it and/or
4 modify it under the terms of the GNU General Public License
5 as published by the Free Software Foundation; either version 2
6 of the License, or (at your option) any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
16
17 #ifndef AUDIO_SMOOTH_PROC_H
18 #define AUDIO_SMOOTH_PROC_Hcxx . . $ `audio/Smooth_proc.h:18:9`!
19
20 typedef structcxx . . $ $anonymous_type_7b6f4b7fe5be81_0#{
21 float* valuescxx . . $ $anonymous_type_7b6f4b7fe5be81_0#values.;
22
23 volatile float target_valuecxx . . $ $anonymous_type_7b6f4b7fe5be81_0#target_value.;
24
25 float start_valuecxx . . $ $anonymous_type_7b6f4b7fe5be81_0#start_value.;
26 float end_valuecxx . . $ $anonymous_type_7b6f4b7fe5be81_0#end_value.;
27
28 int num_valuescxx . . $ $anonymous_type_7b6f4b7fe5be81_0#num_values.;
29
30 bool smoothing_is_necessarycxx . . $ $anonymous_type_7b6f4b7fe5be81_0#smoothing_is_necessary.;
31 } Smoothcxx . . $ Smooth#;
32
33 typedef structcxx . . $ $anonymous_type_7b6f4b7fe5be81_1#{
34 float valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals. [2][2];
35 } Panvalscxx . . $ Panvals#;
36
37
38
39 // Copied from https://github.com/kmatheussen/soundengine/blob/master/SoundObject.java (written by me)
40 //
41 static inline Panvalscxx . . $ Panvals# get_pan_vals_vectorcxx . . $ get_pan_vals_vector(6b2913056d9e28a1).(float pan, int num_source_channels){
42 Panvalscxx . . $ Panvals# p;
43
44 const float sqrt2 = 1.414213562373095;
45 const float pan_scaleval = 2.0f-(2*sqrt2);
46
47 if(num_source_channels==1){
48
49 float x=scalecxx . . $ scale(a4708ef16e45b76e).(pan,-1,1,0,1);
50 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][0] = ((1.0f-x)*((pan_scaleval*(1.0f-x))+(1.0f-pan_scaleval)));
51 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][1] = x * ( (pan_scaleval*x) + (1.0f-pan_scaleval));
52
53 }else{
54
55 if(pan<=0){
56 //fprintf(stderr,"p1\n");
57 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][0] = 1.0f;
58 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][1] = 0.0f;
59
60 pan=scalecxx . . $ scale(a4708ef16e45b76e).(pan,-1,0,-1,1);
61 float x=scalecxx . . $ scale(a4708ef16e45b76e).(pan,-1,1,0,1);
62 //fprintf(stderr,"p2\n");
63 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[1][0] = ((1.0f-x)*((pan_scaleval*(1.0f-x))+(1.0f-pan_scaleval)));
64 //fprintf(stderr,"p3\n");
65 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[1][1] = x * ( (pan_scaleval*x) + (1.0f-pan_scaleval));
66 //fprintf(stderr,"p4\n");
67 //System.out.println("l/r/pan "+p.vals[1][0]+" "+p.vals[1][1]+" "+pan);
68
69 }else{
70 //fprintf(stderr,"p5\n");
71 pan=scalecxx . . $ scale(a4708ef16e45b76e).(pan,0,1,-1,1);
72 float x=scalecxx . . $ scale(a4708ef16e45b76e).(pan,-1,1,0,1);
73 //fprintf(stderr,"p6\n");
74 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][0] = ((1.0f-x)*((pan_scaleval*(1.0f-x))+(1.0f-pan_scaleval)));
75 //fprintf(stderr,"p7\n");
76 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[0][1] = x * ( (pan_scaleval*x) + (1.0f-pan_scaleval));
77 //fprintf(stderr,"p8\n");
78
79 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[1][0] = 0.0f;
80 p.valscxx . . $ $anonymous_type_7b6f4b7fe5be81_1#vals.[1][1] = 1.0f;
81 //System.out.println("l/r/pan "+p.vals[0][0]+" "+p.vals[0][1]+" "+pan);
82
83 }
84 }
85
86 return p;
87 }
88
89
90 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_init(Smoothcxx . . $ Smooth# *smooth, float value, int blocksize);
91 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_new_blocksize(Smoothcxx . . $ Smooth# *smooth, int blockframes);
92 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_release(Smoothcxx . . $ Smooth# *smooth);
93 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_set_target_value(Smoothcxx . . $ Smooth# *smooth, float value);
94 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! float SMOOTH_get_target_value(Smoothcxx . . $ Smooth# *smooth);
95 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_called_per_block(Smoothcxx . . $ Smooth# *smooth);
96 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_apply_volume(Smoothcxx . . $ Smooth# *smooth, float *sound, int num_frames);
97 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_apply_inverted_volume(Smoothcxx . . $ Smooth# *smooth, float *sound, int num_frames);
98 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_copy_sound(Smoothcxx . . $ Smooth# *smooth, float *dst, float *src, int num_frames);
99 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_mix_sounds_raw(float *target, float *source, int num_frames, float start_volume, float end_volume);
100 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_mix_sounds(Smoothcxx . . $ Smooth# *smooth, float *target, float *source, int num_frames);
101 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_mix_sounds_using_inverted_values(Smoothcxx . . $ Smooth# *smooth, float *target, float *source, int num_frames);
102 extern LANGSPECcxx . . $ `common/nsmtracker.h:34:11`! void SMOOTH_apply_pan(Smoothcxx . . $ Smooth# *smooth, float **sound, int num_channels, int num_frames);
103
104 #endif // AUDIO_SMOOTH_PROC_H