@@ -93,7 +93,7 @@ int main(void)
9393 {
9494 // Update
9595 //----------------------------------------------------------------------------------
96- if (IsKeyPressed (KEY_SPACE )) env .state = ATTACK ;
96+ if (IsKeyPressed (KEY_SPACE )) env .state = ATTACK ;
9797
9898 if (IsKeyReleased (KEY_SPACE ) && (env .state != IDLE )) env .state = RELEASE ;
9999
@@ -106,14 +106,14 @@ int main(void)
106106 UpdateEnvelope (& env );
107107 FillAudioBuffer (i , buffer , env .currentValue , & audioTime );
108108 }
109- }
109+ }
110110 else
111111 {
112112 // Clear buffer if silent to avoid looping noise
113113 for (int i = 0 ; i < BUFFER_SIZE ; i ++ ) buffer [i ] = 0 ;
114114 audioTime = 0.0f ;
115115 }
116-
116+
117117 UpdateAudioStream (stream , buffer , BUFFER_SIZE );
118118 }
119119
@@ -166,7 +166,7 @@ static void FillAudioBuffer(int i, float *buffer, float envelopeValue, float *au
166166static void UpdateEnvelope (Envelope * env )
167167{
168168 // Calculate the time delta for ONE sample (1/44100)
169- float sampleTime = 1.0f /SAMPLE_RATE ;
169+ float sampleTime = 1.0f /SAMPLE_RATE ;
170170
171171 switch (env -> state )
172172 {
@@ -178,7 +178,7 @@ static void UpdateEnvelope(Envelope *env)
178178 env -> currentValue = 1.0f ;
179179 env -> state = DECAY ;
180180 }
181-
181+
182182 } break ;
183183 case DECAY :
184184 {
@@ -188,12 +188,12 @@ static void UpdateEnvelope(Envelope *env)
188188 env -> currentValue = env -> sustainLevel ;
189189 env -> state = SUSTAIN ;
190190 }
191-
191+
192192 } break ;
193193 case SUSTAIN :
194194 {
195195 env -> currentValue = env -> sustainLevel ;
196-
196+
197197 } break ;
198198 case RELEASE :
199199 {
@@ -203,8 +203,8 @@ static void UpdateEnvelope(Envelope *env)
203203 env -> currentValue = 0.0f ;
204204 env -> state = IDLE ;
205205 }
206-
207- } break ;
206+
207+ } break ;
208208 default : break ;
209209 }
210210}
@@ -219,7 +219,7 @@ static void DrawADSRGraph(Envelope *env, Rectangle bounds)
219219
220220 // Total time to visualize (sum of A, D, R + a padding for Sustain)
221221 float totalTime = env -> attackTime + env -> decayTime + sustainWidth + env -> releaseTime ;
222-
222+
223223 float scaleX = bounds .width /totalTime ;
224224 float scaleY = bounds .height ;
225225
0 commit comments