Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/src/Wave.cpp @ 4:ab6db404403a
commented JackDevice
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Wed, 13 Jul 2016 12:31:37 +0200 |
parents | 7fb593d53361 |
children | 75b744078d66 |
comparison
equal
deleted
inserted
replaced
3:7fb593d53361 | 4:ab6db404403a |
---|---|
14 | 14 |
15 for ( size_t i = 0; i < numChunks; i++ ){ | 15 for ( size_t i = 0; i < numChunks; i++ ){ |
16 mChunks.emplace_back( i ); | 16 mChunks.emplace_back( i ); |
17 } | 17 } |
18 | 18 |
19 // init cinder batch drawing | |
19 auto lambert = gl::ShaderDef().color(); | 20 auto lambert = gl::ShaderDef().color(); |
20 gl::GlslProgRef shader = gl::getStockShader( lambert ); | 21 gl::GlslProgRef shader = gl::getStockShader( lambert ); |
21 mChunkBatch = gl::Batch::create( geom::Rect( ci::Rectf( 0, 0, Chunk::kWidth, 1 ) ), shader ); | 22 mChunkBatch = gl::Batch::create( geom::Rect( ci::Rectf( 0, 0, Chunk::kWidth, 1 ) ), shader ); |
22 } | 23 } |
23 | 24 |
61 continue; | 62 continue; |
62 | 63 |
63 | 64 |
64 double elapsed = now - itr->second.lastUpdate; | 65 double elapsed = now - itr->second.lastUpdate; |
65 | 66 |
67 // A chunk of audio corresponds to a certain time according to sample rate. | |
68 // Use elapsed time to advance through chunks so that the cursor is animated | |
69 // and goes from start to end of the seleciton in the time span of the grain | |
66 itr->second.pos = mSelection.getStart() + int( elapsed / secondsPerChunk ); | 70 itr->second.pos = mSelection.getStart() + int( elapsed / secondsPerChunk ); |
67 | 71 |
68 /* check we don't go too far off */ | 72 // check we don't go too far off |
69 if (itr->second.pos > mSelection.getEnd()){ | 73 if (itr->second.pos > mSelection.getEnd()){ |
70 itr->second.pos = Cursor::kNoPosition; | 74 itr->second.pos = Cursor::kNoPosition; |
71 } | 75 } |
72 } | 76 } |
73 | 77 |