loopmix.cpp

Mixing and looping

00001 //$Id: loopmix.cpp 195 2005-08-23 05:41:49Z tapted $ $URL: file:///var/svn/pub/taptaudio/trunk/tests/loopmix.cpp $
00002 #include "taptaudio.h"
00003 
00004 #include <SDL.h>
00005 
00006 void vp(ASSample* s, float vol, Uint32 delay) {
00007     fprintf(stderr, "Playing at %f%% volume, then delaying %ums\n", vol*100, delay);
00008     AudioSystem::get()->loopSample(s, vol);
00009     SDL_Delay(delay);
00010 }
00011 
00012 int main(int argc, char* argv[]) {
00013     AudioSystem as;
00014     ASSample *s = as.loadSample(WAVPATH "/mix.wav");
00015     if (!s)
00016         return 1;
00017     vp(s, 1.0, 200);
00018     vp(s, 0.5, 300);
00019     vp(s, 2.0, 400);
00020     vp(s, 1.5, 500);
00021     vp(s, 0.25, 600);
00022     vp(s, 0.1, 700);
00023     fprintf(stderr, "Looping mix for 8 seconds\n");
00024     SDL_Delay(8000);
00025     fprintf(stderr, "Stopping.\n");
00026     as.stopSample(s);
00027     vp(s, 3.0, 800);
00028     vp(s, 4.0, 900);
00029     vp(s, 5.0, 1000);
00030 //    vp(s, 6.0);
00031 //    vp(s, 7.0);
00032 //    vp(s, 8.0);
00033 //    vp(s, 9.0);
00034 //    vp(s, 10.0);
00035     SDL_Delay(8000);
00036     fprintf(stderr, "Looping mix for 8 seconds\n");
00037     return 0;
00038 }
00039 

Generated on Thu Mar 16 11:30:41 2006 for TaptAudio by  doxygen 1.4.6