Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Clean up of spectro code

  • Loading branch information...
commit 77af5fe76bdcecd6ddf07fc55784d471e084e7e0 1 parent 1c38b70
Kartik Thakore kthakore authored
20 code_listings/sdl_mixer_spectro.pl
@@ -52,10 +52,7 @@
52 52
53 53 my $music_is_playing :shared = 0;
54 54 sub callback{
55   -
56 55 $music_is_playing = 0;
57   -
58   - warn "Going to next song \n"
59 56 };
60 57
61 58
@@ -70,16 +67,17 @@ sub callback{
70 67 my $stream : shared;
71 68 my $quit_processing : shared = 0;
72 69
  70 + my $effect_id =
  71 + SDL::Mixer::Effects::register( MIX_CHANNEL_POST, "main::spiffy",
  72 + "main::spiffydone", 0 );
  73 +
  74 +
73 75 foreach (@songs) {
74 76 warn 'Playing ' . $_;
75 77
76 78 my $song = SDL::Mixer::Music::load_MUS($_);
77 79 SDL::Mixer::Music::hook_music_finished('main::callback');
78 80 SDL::Mixer::Music::play_music( $song, 0 );
79   - my $effect_id =
80   - SDL::Mixer::Effects::register( MIX_CHANNEL_POST, "main::spiffy",
81   - "main::spiffydone", 0 );
82   -
83 81 $music_is_playing = 1;
84 82
85 83 while ($music_is_playing) {
@@ -108,9 +106,9 @@ sub callback{
108 106
109 107 }
110 108
111   - SDL::Mixer::Effects::unregister( MIX_CHANNEL_POST, $effect_id );
112 109
113 110 }
  111 + SDL::Mixer::Effects::unregister( MIX_CHANNEL_POST, $effect_id );
114 112
115 113 SDL::Mixer::Music::hook_music_finished();
116 114 join_threads();
@@ -146,7 +144,6 @@ sub process_stream {
146 144 $stream = '';
147 145 my @left;
148 146 my @right;
149   - # warn ' stream is '.$#stream_cut;
150 147 my $cut = $#stream_cut/$lines;
151 148 my @x;
152 149 my @left_bezier;
@@ -165,8 +162,6 @@ sub process_stream {
165 162 my $point_x = ( $i / $#stream_cut ) * 800;
166 163
167 164
168   - # print int($point_y) .'|'. int($point_x)."\n";
169   -
170 165 push @x, $point_x;
171 166 push @left_bezier, $point_y;
172 167
@@ -175,8 +170,7 @@ sub process_stream {
175 170
176 171 }
177 172
178   - #SDL::GFX::Primitives::bezier_color($app, \@x, \@left_bezier, $#left_bezier, 30, 0xFF0000FF);
179   - $stream_update = 0;
  173 + $stream_update = 0;
180 174 SDL::Video::flip($app);
181 175 }
182 176 else {
BIN  data/music/00-sample.ogg
Binary file not shown

0 comments on commit 77af5fe

Please sign in to comment.
Something went wrong with that request. Please try again.