MCPcopy Create free account
hub / github.com/LancePutnam/Gamma / MyApp

Class MyApp

examples/source/samplePlayer2.cpp:16–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace gam;
15
16class MyApp : public AudioApp{
17public:
18
19 SamplePlayer<> player1, player2;
20
21 MyApp(){
22 // Load sound file (only once!) into buffer
23 player1.load("../../sounds/water3.wav");
24
25 // Assign player1's buffer to player2;
26 // this can be called safely in the audio thread.
27 player2.buffer(player1);
28
29 // Make second playback rate slightly higher to create "phasing"
30 player2.rate(1.005);
31 }
32
33 void onAudio(AudioIOData& io){
34 while(io()){
35 float s = (player1() + player2()) * 0.5;
36 player1.loop();
37 player2.loop();
38 io.out(0) = io.out(1) = s;
39 }
40 }
41};
42
43int main(){
44 MyApp().start();

Callers 1

mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected