Source

pygame-freetype / docs / ref / mixer.html

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>pygame.mixer &mdash; Pygame v1.9.2 documentation</title>
    <link rel="stylesheet" href="../_static/pygame.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    '../',
        VERSION:     '1.9.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="../_static/jquery.js"></script>
    <script type="text/javascript" src="../_static/underscore.js"></script>
    <script type="text/javascript" src="../_static/doctools.js"></script>
    <link rel="shortcut icon" href="../_static/pygame.ico"/>
    <link rel="top" title="Pygame v1.9.2 documentation" href="../index.html" />
    <link rel="next" title="pygame.mouse" href="mouse.html" />
    <link rel="prev" title="pygame.midi" href="midi.html" /> 
  </head>
  <body>  

    <div class="document">

  <div class="header">
    <table>
      <tr>
	<td class="logo">
	  <a href="http://www.pygame.org/">
	    <img src="../_static/pygame_tiny.png"/>
	  </a>
	  <h5>pygame documentation</h5>
	</td>
	<td class="pagelinks">
	  <p class="top">
	    ||
	    <a href="http://www.pygame.org/">Pygame Home</a> ||
	    <a href="../index.html">Help Contents</a> ||
	    <a href="../genindex.html">Reference Index</a> ||
	  </p>
	  <p class="bottom">
	    <a href="camera.html">camera</a> || 
	    <a href="cdrom.html">cdrom</a> || 
	    <a href="color.html">Color</a> || 
	    <a href="cursors.html">cursors</a> || 
	    <a href="display.html">display</a> || 
	    <a href="draw.html">draw</a> || 
	    <a href="event.html">event</a> || 
	    <a href="examples.html">examples</a> || 
	    <a href="font.html">font</a> || 
	    <a href="freetype.html">freetype</a> || 
	    <a href="gfxdraw.html">gfxdraw</a> || 
	    <a href="image.html">image</a> || 
	    <a href="joystick.html">joystick</a> || 
	    <a href="key.html">key</a> || 
	    <a href="locals.html">locals</a> || 
	    <a href="mask.html">mask</a> || 
	    <a href="math.html">math</a> || 
	    <a href="midi.html">midi</a> || 
	    <a href="mixer.html">mixer</a> || 
	    <a href="mouse.html">mouse</a> || 
	    <a href="movie.html">movie</a> || 
	    <a href="music.html">music</a> || 
	    <a href="overlay.html">Overlay</a> || 
	    <a href="pixelarray.html">PixelArray</a> || 
	    <a href="pixelcopy.html">pixelcopy</a> || 
	    <a href="pygame.html">pygame</a> || 
	    <a href="rect.html">Rect</a> || 
	    <a href="scrap.html">scrap</a> || 
	    <a href="sndarray.html">sndarray</a> || 
	    <a href="sprite.html">sprite</a> || 
	    <a href="surface.html">Surface</a> || 
	    <a href="surfarray.html">surfarray</a> || 
	    <a href="tests.html">tests</a> || 
	    <a href="time.html">time</a> || 
	    <a href="transform.html">transform</a> || 
	    <a href="pygame.html#module-pygame.version">version</a>
	  </p>
	</td>
      </tr>
    </table>
  </div>

      <div class="documentwrapper">
          <div class="body">
            
  <div class="sectionwrapper">
<div class="section" id="module-pygame.mixer">
<span id="pygame-mixer"></span><dl class="definition module">
<dt class="title module">
<tt class="docutils literal"><span class="pre">pygame.mixer</span></tt></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">pygame module for loading and playing sounds</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="32%" />
<col width="1%" />
<col width="67%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.init">pygame.mixer.init</a></td>
<td></td>
<td>initialize the mixer module</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.pre_init">pygame.mixer.pre_init</a></td>
<td></td>
<td>preset the mixer init arguments</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.quit">pygame.mixer.quit</a></td>
<td></td>
<td>uninitialize the mixer</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.get_init">pygame.mixer.get_init</a></td>
<td></td>
<td>test if the mixer is initialized</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.stop">pygame.mixer.stop</a></td>
<td></td>
<td>stop playback of all sound channels</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.pause">pygame.mixer.pause</a></td>
<td></td>
<td>temporarily stop playback of all sound channels</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.unpause">pygame.mixer.unpause</a></td>
<td></td>
<td>resume paused playback of sound channels</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.fadeout">pygame.mixer.fadeout</a></td>
<td></td>
<td>fade out the volume on all sounds before stopping</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.set_num_channels">pygame.mixer.set_num_channels</a></td>
<td></td>
<td>set the total number of playback channels</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.get_num_channels">pygame.mixer.get_num_channels</a></td>
<td></td>
<td>get the total number of playback channels</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.set_reserved">pygame.mixer.set_reserved</a></td>
<td></td>
<td>reserve channels from being automatically used</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.find_channel">pygame.mixer.find_channel</a></td>
<td></td>
<td>find an unused channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.get_busy">pygame.mixer.get_busy</a></td>
<td></td>
<td>test if any sound is being mixed</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound">pygame.mixer.Sound</a></td>
<td></td>
<td>Create a new Sound object from a file or buffer object</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel">pygame.mixer.Channel</a></td>
<td></td>
<td>Create a Channel object for controlling playback</td>
</tr>
</tbody>
</table>
<p>This module contains classes for loading Sound objects and controlling
playback. The mixer module is optional and depends on SDL_mixer. Your program
should test that <a class="tooltip reference internal" href="#module-pygame.mixer" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.mixer</span></tt><span class="tooltip-content">pygame module for loading and playing sounds</span></a> is available and intialized before using
it.</p>
<p>The mixer module has a limited number of channels for playback of sounds.
Usually programs tell pygame to start playing audio and it selects an available
channel automatically. The default is 8 simultaneous channels, but complex
programs can get more precise control over the number of channels and their
use.</p>
<p>All sound playback is mixed in background threads. When you begin to play a
Sound object, it will return immediately while the sound continues to play. A
single Sound object can also be actively played back multiple times.</p>
<p>The mixer also has a special streaming channel. This is for music playback and
is accessed through the <a class="tooltip reference internal" href="music.html#module-pygame.mixer.music" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.mixer.music</span></tt><span class="tooltip-content">pygame module for controlling streamed audio</span></a> module.</p>
<p>The mixer module must be initialized like other pygame modules, but it has some
extra conditions. The <tt class="docutils literal"><span class="pre">pygame.mixer.init()</span></tt> function takes several optional
arguments to control the playback rate and sample size. Pygame will default to
reasonable values, but pygame cannot perform Sound resampling, so the mixer
should be initialized to match the values of your audio resources.</p>
<p><tt class="docutils literal"><span class="pre">NOTE</span></tt>: Not to get less laggy sound, use a smaller buffer size. The default
is set to reduce the chance of scratchy sounds on some computers. You can
change the default buffer by calling <a class="tooltip reference internal" href="#pygame.mixer.pre_init" title=""><tt class="xref py py-func docutils literal"><span class="pre">pygame.mixer.pre_init()</span></tt><span class="tooltip-content">preset the mixer init arguments</span></a> before
<a class="tooltip reference internal" href="#pygame.mixer.init" title=""><tt class="xref py py-func docutils literal"><span class="pre">pygame.mixer.init()</span></tt><span class="tooltip-content">initialize the mixer module</span></a> or <a class="tooltip reference internal" href="pygame.html#pygame.init" title=""><tt class="xref py py-func docutils literal"><span class="pre">pygame.init()</span></tt><span class="tooltip-content">initialize all imported pygame modules</span></a> is called. For example:
<tt class="docutils literal"><span class="pre">pygame.mixer.pre_init(44100,-16,2,</span> <span class="pre">1024)</span></tt> The default size was changed from
1024 to 3072 in pygame 1.8.</p>
<dl class="definition function">
<dt class="title" id="pygame.mixer.init">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">initialize the mixer module</span></div>
<div class="line"><span class="signature">init(frequency=22050, size=-16, channels=2, buffer=4096) -&gt; None</span></div>
</div>
<p>Initialize the mixer module for Sound loading and playback. The default
arguments can be overridden to provide specific audio mixing. Keyword
arguments are accepted. For backward compatibility where an argument is set
zero the default value is used (possible changed by a pre_init call).</p>
<p>The size argument represents how many bits are used for each audio sample.
If the value is negative then signed sample values will be used. Positive
values mean unsigned audio samples will be used. An invalid value raises an
exception.</p>
<p>The channels argument is used to specify whether to use mono or stereo. 1
for mono and 2 for stereo. No other values are supported (negative values
are treated as 1, values greater than 2 as 2).</p>
<p>The buffer argument controls the number of internal samples used in the
sound mixer. The default value should work for most cases. It can be lowered
to reduce latency, but sound dropout may occur. It can be raised to larger
values to ensure playback never skips, but it will impose latency on sound
playback. The buffer size must be a power of two (if not it is rounded up to
the next nearest power of 2).</p>
<p>Some platforms require the <a class="tooltip reference internal" href="#module-pygame.mixer" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.mixer</span></tt><span class="tooltip-content">pygame module for loading and playing sounds</span></a> module to be initialized
after the display modules have initialized. The top level <tt class="docutils literal"><span class="pre">pygame.init()</span></tt>
takes care of this automatically, but cannot pass any arguments to the mixer
init. To solve this, mixer has a function <tt class="docutils literal"><span class="pre">pygame.mixer.pre_init()</span></tt> to set
the proper defaults before the toplevel init is used.</p>
<p>It is safe to call this more than once, but after the mixer is initialized
you cannot change the playback arguments without first calling
<tt class="docutils literal"><span class="pre">pygame.mixer.quit()</span></tt>.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.pre_init">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">pre_init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.pre_init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">preset the mixer init arguments</span></div>
<div class="line"><span class="signature">pre_init(frequency=22050, size=-16, channels=2, buffersize=4096) -&gt; None</span></div>
</div>
<p>Call pre_init to change the defaults used when the real
<tt class="docutils literal"><span class="pre">pygame.mixer.init()</span></tt> is called. Keyword arguments are accepted. The best
way to set custom mixer playback values is to call
<tt class="docutils literal"><span class="pre">pygame.mixer.pre_init()</span></tt> before calling the top level <tt class="docutils literal"><span class="pre">pygame.init()</span></tt>.
For backward compatibility argument values of zero is replaced with the
startup defaults.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.quit">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">quit</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.quit" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">uninitialize the mixer</span></div>
<div class="line"><span class="signature">quit() -&gt; None</span></div>
</div>
<p>This will uninitialize <a class="tooltip reference internal" href="#module-pygame.mixer" title=""><tt class="xref py py-mod docutils literal"><span class="pre">pygame.mixer</span></tt><span class="tooltip-content">pygame module for loading and playing sounds</span></a>. All playback will stop and any
loaded Sound objects may not be compatible with the mixer if it is
reinitialized later.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.get_init">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">get_init</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.get_init" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">test if the mixer is initialized</span></div>
<div class="line"><span class="signature">get_init() -&gt; (frequency, format, channels)</span></div>
</div>
<p>If the mixer is initialized, this returns the playback arguments it is
using. If the mixer has not been initialized this returns None</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.stop">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.stop" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">stop playback of all sound channels</span></div>
<div class="line"><span class="signature">stop() -&gt; None</span></div>
</div>
<p>This will stop all playback of all active mixer channels.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.pause">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">pause</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.pause" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">temporarily stop playback of all sound channels</span></div>
<div class="line"><span class="signature">pause() -&gt; None</span></div>
</div>
<p>This will temporarily stop all playback on the active mixer channels. The
playback can later be resumed with <tt class="docutils literal"><span class="pre">pygame.mixer.unpause()</span></tt></p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.unpause">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">unpause</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.unpause" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">resume paused playback of sound channels</span></div>
<div class="line"><span class="signature">unpause() -&gt; None</span></div>
</div>
<p>This will resume all active sound channels after they have been paused.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.fadeout">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">fadeout</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.fadeout" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">fade out the volume on all sounds before stopping</span></div>
<div class="line"><span class="signature">fadeout(time) -&gt; None</span></div>
</div>
<p>This will fade out the volume on all active channels over the time argument
in milliseconds. After the sound is muted the playback will stop.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.set_num_channels">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">set_num_channels</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.set_num_channels" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the total number of playback channels</span></div>
<div class="line"><span class="signature">set_num_channels(count) -&gt; None</span></div>
</div>
<p>Sets the number of available channels for the mixer. The default value is 8.
The value can be increased or decreased. If the value is decreased, sounds
playing on the truncated channels are stopped.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.get_num_channels">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">get_num_channels</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.get_num_channels" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the total number of playback channels</span></div>
<div class="line"><span class="signature">get_num_channels() -&gt; count</span></div>
</div>
<p>Returns the number of currently active playback channels.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.set_reserved">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">set_reserved</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.set_reserved" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">reserve channels from being automatically used</span></div>
<div class="line"><span class="signature">set_reserved(count) -&gt; None</span></div>
</div>
<p>The mixer can reserve any number of channels that will not be automatically
selected for playback by Sounds. If sounds are currently playing on the
reserved channels they will not be stopped.</p>
<p>This allows the application to reserve a specific number of channels for
important sounds that must not be dropped or have a guaranteed channel to
play on.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.find_channel">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">find_channel</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.find_channel" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">find an unused channel</span></div>
<div class="line"><span class="signature">find_channel(force=False) -&gt; Channel</span></div>
</div>
<p>This will find and return an inactive Channel object. If there are no
inactive Channels this function will return None. If there are no inactive
channels and the force argument is True, this will find the Channel with the
longest running Sound and return it.</p>
<p>If the mixer has reserved channels from <tt class="docutils literal"><span class="pre">pygame.mixer.set_reserved()</span></tt> then
those channels will not be returned here.</p>
</dd></dl>

<dl class="definition function">
<dt class="title" id="pygame.mixer.get_busy">
<tt class="descclassname">pygame.mixer.</tt><tt class="descname">get_busy</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.get_busy" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">test if any sound is being mixed</span></div>
<div class="line"><span class="signature">get_busy() -&gt; bool</span></div>
</div>
<p>Returns True if the mixer is busy mixing any channels. If the mixer is idle
then this return False.</p>
</dd></dl>

<dl class="definition class">
<dt class="title" id="pygame.mixer.Sound">
<em class="property">class </em><tt class="descclassname">pygame.mixer.</tt><tt class="descname">Sound</tt><a class="headerlink" href="#pygame.mixer.Sound" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Create a new Sound object from a file or buffer object</span></div>
<div class="line"><span class="signature">Sound(filename) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(file=filename) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(buffer) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(buffer=buffer) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(object) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(file=object) -&gt; Sound</span></div>
<div class="line"><span class="signature">Sound(array=object) -&gt; Sound</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="36%" />
<col width="1%" />
<col width="63%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.play">pygame.mixer.Sound.play</a></td>
<td></td>
<td>begin sound playback</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.stop">pygame.mixer.Sound.stop</a></td>
<td></td>
<td>stop sound playback</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.fadeout">pygame.mixer.Sound.fadeout</a></td>
<td></td>
<td>stop sound playback after fading out</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.set_volume">pygame.mixer.Sound.set_volume</a></td>
<td></td>
<td>set the playback volume for this Sound</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.get_volume">pygame.mixer.Sound.get_volume</a></td>
<td></td>
<td>get the playback volume</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.get_num_channels">pygame.mixer.Sound.get_num_channels</a></td>
<td></td>
<td>count how many times this Sound is playing</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.get_length">pygame.mixer.Sound.get_length</a></td>
<td></td>
<td>get the length of the Sound</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Sound.get_buffer">pygame.mixer.Sound.get_buffer</a></td>
<td></td>
<td>acquires a buffer object for the samples of the Sound.</td>
</tr>
</tbody>
</table>
<p>Load a new sound buffer from a filename, a python file object or a readable
buffer object. Limited resampling will be performed to help the sample match
the initialize arguments for the mixer. A Unicode string can only be a file
pathname. A Python 2.x string or a Python 3.x bytes object can be either a
pathname or a buffer object. Use the &#8216;file&#8217; or &#8216;buffer&#8217; keywords to avoid
ambiguity; otherwise Sound may guess wrong. If the array keyword is used,
the object is expected to export a version 3, <tt class="docutils literal"><span class="pre">C</span></tt> level array interface
or, for Python 2.6 or later, a new buffer interface (The object is checked
for a buffer interface first.)</p>
<p>The Sound object represents actual sound sample data. Methods that change
the state of the Sound object will the all instances of the Sound playback.
A Sound object also exports an array interface, and, for Python 2.6 or
later, a new buffer interface.</p>
<p>The Sound can be loaded from an <tt class="docutils literal"><span class="pre">OGG</span></tt> audio file or from an uncompressed
<tt class="docutils literal"><span class="pre">WAV</span></tt>.</p>
<p>Note: The buffer will be copied internally, no data will be shared between
it and the Sound object.</p>
<p>For now buffer and array support is consistent with <tt class="docutils literal"><span class="pre">sndarray.make_sound</span></tt>
for Numeric arrays, in that sample sign and byte order are ignored. This
will change, either by correctly handling sign and byte order, or by raising
an exception when different. Also, source samples are truncated to fit the
audio sample size. This will not change.</p>
<p><tt class="docutils literal"><span class="pre">pygame.mixer.Sound(buffer)</span></tt> is new in pygame 1.8
<a class="tooltip reference internal" href="#pygame.mixer.Sound" title=""><tt class="xref py py-class docutils literal"><span class="pre">pygame.mixer.Sound</span></tt><span class="tooltip-content">Create a new Sound object from a file or buffer object</span></a> keyword arguments and array interface support
new in pygame 1.9.2</p>
<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.play">
<tt class="descname">play</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.play" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">begin sound playback</span></div>
<div class="line"><span class="signature">play(loops=0, maxtime=0, fade_ms=0) -&gt; Channel</span></div>
</div>
<p>Begin playback of the Sound (i.e., on the computer&#8217;s speakers) on an
available Channel. This will forcibly select a Channel, so playback may
cut off a currently playing sound if necessary.</p>
<p>The loops argument controls how many times the sample will be repeated
after being played the first time. A value of 5 means that the sound will
be played once, then repeated five times, and so is played a total of six
times. The default value (zero) means the Sound is not repeated, and so
is only played once. If loops is set to -1 the Sound will loop
indefinitely (though you can still call <tt class="docutils literal"><span class="pre">stop()</span></tt> to stop it).</p>
<p>The maxtime argument can be used to stop playback after a given number of
milliseconds.</p>
<p>The fade_ms argument will make the sound start playing at 0 volume and
fade up to full volume over the time given. The sample may end before the
fade-in is complete.</p>
<p>This returns the Channel object for the channel that was selected.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.stop" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">stop sound playback</span></div>
<div class="line"><span class="signature">stop() -&gt; None</span></div>
</div>
<p>This will stop the playback of this Sound on any active Channels.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.fadeout">
<tt class="descname">fadeout</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.fadeout" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">stop sound playback after fading out</span></div>
<div class="line"><span class="signature">fadeout(time) -&gt; None</span></div>
</div>
<p>This will stop playback of the sound after fading it out over the time
argument in milliseconds. The Sound will fade and stop on all actively
playing channels.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.set_volume">
<tt class="descname">set_volume</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.set_volume" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the playback volume for this Sound</span></div>
<div class="line"><span class="signature">set_volume(value) -&gt; None</span></div>
</div>
<p>This will set the playback volume (loudness) for this Sound. This will
immediately affect the Sound if it is playing. It will also affect any
future playback of this Sound. The argument is a value from 0.0 to 1.0.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.get_volume">
<tt class="descname">get_volume</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.get_volume" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the playback volume</span></div>
<div class="line"><span class="signature">get_volume() -&gt; value</span></div>
</div>
<p>Return a value from 0.0 to 1.0 representing the volume for this Sound.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.get_num_channels">
<tt class="descname">get_num_channels</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.get_num_channels" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">count how many times this Sound is playing</span></div>
<div class="line"><span class="signature">get_num_channels() -&gt; count</span></div>
</div>
<p>Return the number of active channels this sound is playing on.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.get_length">
<tt class="descname">get_length</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.get_length" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the length of the Sound</span></div>
<div class="line"><span class="signature">get_length() -&gt; seconds</span></div>
</div>
<p>Return the length of this Sound in seconds.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Sound.get_buffer">
<tt class="descname">get_buffer</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Sound.get_buffer" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">acquires a buffer object for the samples of the Sound.</span></div>
<div class="line"><span class="signature">get_buffer() -&gt; BufferProxy</span></div>
</div>
<p>Return a buffer object for the Sound samples. The buffer can be used for
direct access and manipulation.</p>
<p>New in pygame 1.8.</p>
</dd></dl>

</dd></dl>

<dl class="definition class">
<dt class="title" id="pygame.mixer.Channel">
<em class="property">class </em><tt class="descclassname">pygame.mixer.</tt><tt class="descname">Channel</tt><a class="headerlink" href="#pygame.mixer.Channel" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">Create a Channel object for controlling playback</span></div>
<div class="line"><span class="signature">Channel(id) -&gt; Channel</span></div>
</div>
<table border="1" class="toc docutils">
<colgroup>
<col width="36%" />
<col width="1%" />
<col width="63%" />
</colgroup>
<tbody valign="top">
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.play">pygame.mixer.Channel.play</a></td>
<td></td>
<td>play a Sound on a specific Channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.stop">pygame.mixer.Channel.stop</a></td>
<td></td>
<td>stop playback on a Channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.pause">pygame.mixer.Channel.pause</a></td>
<td></td>
<td>temporarily stop playback of a channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.unpause">pygame.mixer.Channel.unpause</a></td>
<td></td>
<td>resume pause playback of a channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.fadeout">pygame.mixer.Channel.fadeout</a></td>
<td></td>
<td>stop playback after fading channel out</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.set_volume">pygame.mixer.Channel.set_volume</a></td>
<td></td>
<td>set the volume of a playing channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.get_volume">pygame.mixer.Channel.get_volume</a></td>
<td></td>
<td>get the volume of the playing channel</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.get_busy">pygame.mixer.Channel.get_busy</a></td>
<td></td>
<td>check if the channel is active</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.get_sound">pygame.mixer.Channel.get_sound</a></td>
<td></td>
<td>get the currently playing Sound</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.queue">pygame.mixer.Channel.queue</a></td>
<td></td>
<td>queue a Sound object to follow the current</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.get_queue">pygame.mixer.Channel.get_queue</a></td>
<td></td>
<td>return any Sound that is queued</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.set_endevent">pygame.mixer.Channel.set_endevent</a></td>
<td></td>
<td>have the channel send an event when playback stops</td>
</tr>
<tr><td><a class="toc reference external" href="mixer.html#pygame.mixer.Channel.get_endevent">pygame.mixer.Channel.get_endevent</a></td>
<td></td>
<td>get the event a channel sends when playback stops</td>
</tr>
</tbody>
</table>
<p>Return a Channel object for one of the current channels. The id must be a
value from 0 to the value of <tt class="docutils literal"><span class="pre">pygame.mixer.get_num_channels()</span></tt>.</p>
<p>The Channel object can be used to get fine control over the playback of
Sounds. A channel can only playback a single Sound at time. Using channels
is entirely optional since pygame can manage them by default.</p>
<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.play">
<tt class="descname">play</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.play" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">play a Sound on a specific Channel</span></div>
<div class="line"><span class="signature">play(Sound, loops=0, maxtime=0, fade_ms=0) -&gt; None</span></div>
</div>
<p>This will begin playback of a Sound on a specific Channel. If the Channel
is currently playing any other Sound it will be stopped.</p>
<p>The loops argument has the same meaning as in <tt class="docutils literal"><span class="pre">Sound.play()</span></tt>: it is the
number of times to repeat the sound after the first time. If it is 3, the
sound will be played 4 times (the first time, then three more). If loops
is -1 then the playback will repeat indefinitely.</p>
<p>As in <tt class="docutils literal"><span class="pre">Sound.play()</span></tt>, the maxtime argument can be used to stop playback
of the Sound after a given number of milliseconds.</p>
<p>As in <tt class="docutils literal"><span class="pre">Sound.play()</span></tt>, the fade_ms argument can be used fade in the
sound.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.stop">
<tt class="descname">stop</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.stop" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">stop playback on a Channel</span></div>
<div class="line"><span class="signature">stop() -&gt; None</span></div>
</div>
<p>Stop sound playback on a channel. After playback is stopped the channel
becomes available for new Sounds to play on it.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.pause">
<tt class="descname">pause</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.pause" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">temporarily stop playback of a channel</span></div>
<div class="line"><span class="signature">pause() -&gt; None</span></div>
</div>
<p>Temporarily stop the playback of sound on a channel. It can be resumed at
a later time with <tt class="docutils literal"><span class="pre">Channel.unpause()</span></tt></p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.unpause">
<tt class="descname">unpause</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.unpause" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">resume pause playback of a channel</span></div>
<div class="line"><span class="signature">unpause() -&gt; None</span></div>
</div>
<p>Resume the playback on a paused channel.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.fadeout">
<tt class="descname">fadeout</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.fadeout" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">stop playback after fading channel out</span></div>
<div class="line"><span class="signature">fadeout(time) -&gt; None</span></div>
</div>
<p>Stop playback of a channel after fading out the sound over the given time
argument in milliseconds.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.set_volume">
<tt class="descname">set_volume</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.set_volume" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">set the volume of a playing channel</span></div>
<div class="line"><span class="signature">set_volume(value) -&gt; None</span></div>
<div class="line"><span class="signature">set_volume(left, right) -&gt; None</span></div>
</div>
<p>Set the volume (loudness) of a playing sound. When a channel starts to
play its volume value is reset. This only affects the current sound. The
value argument is between 0.0 and 1.0.</p>
<p>If one argument is passed, it will be the volume of both speakers. If two
arguments are passed and the mixer is in stereo mode, the first argument
will be the volume of the left speaker and the second will be the volume
of the right speaker. (If the second argument is None, the first argument
will be the volume of both speakers.)</p>
<p>If the channel is playing a Sound on which <tt class="docutils literal"><span class="pre">set_volume()</span></tt> has also been
called, both calls are taken into account. For example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">sound</span> <span class="o">=</span> <span class="n">pygame</span><span class="o">.</span><span class="n">mixer</span><span class="o">.</span><span class="n">Sound</span><span class="p">(</span><span class="s">&quot;s.wav&quot;</span><span class="p">)</span>
<span class="n">channel</span> <span class="o">=</span> <span class="n">s</span><span class="o">.</span><span class="n">play</span><span class="p">()</span>      <span class="c"># Sound plays at full volume by default</span>
<span class="n">sound</span><span class="o">.</span><span class="n">set_volume</span><span class="p">(</span><span class="mf">0.9</span><span class="p">)</span>   <span class="c"># Now plays at 90% of full volume.</span>
<span class="n">sound</span><span class="o">.</span><span class="n">set_volume</span><span class="p">(</span><span class="mf">0.6</span><span class="p">)</span>   <span class="c"># Now plays at 60% (previous value replaced).</span>
<span class="n">channel</span><span class="o">.</span><span class="n">set_volume</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span> <span class="c"># Now plays at 30% (0.6 * 0.5).</span>
</pre></div>
</div>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.get_volume">
<tt class="descname">get_volume</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.get_volume" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the volume of the playing channel</span></div>
<div class="line"><span class="signature">get_volume() -&gt; value</span></div>
</div>
<p>Return the volume of the channel for the current playing sound. This does
not take into account stereo separation used by
<a class="reference internal" href="#pygame.mixer.Channel.set_volume" title="pygame.mixer.Channel.set_volume"><tt class="xref py py-meth docutils literal"><span class="pre">Channel.set_volume()</span></tt></a>. The Sound object also has its own volume
which is mixed with the channel.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.get_busy">
<tt class="descname">get_busy</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.get_busy" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">check if the channel is active</span></div>
<div class="line"><span class="signature">get_busy() -&gt; bool</span></div>
</div>
<p>Returns true if the channel is activily mixing sound. If the channel is
idle this returns False.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.get_sound">
<tt class="descname">get_sound</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.get_sound" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the currently playing Sound</span></div>
<div class="line"><span class="signature">get_sound() -&gt; Sound</span></div>
</div>
<p>Return the actual Sound object currently playing on this channel. If the
channel is idle None is returned.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.queue">
<tt class="descname">queue</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.queue" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">queue a Sound object to follow the current</span></div>
<div class="line"><span class="signature">queue(Sound) -&gt; None</span></div>
</div>
<p>When a Sound is queued on a Channel, it will begin playing immediately
after the current Sound is finished. Each channel can only have a single
Sound queued at a time. The queued Sound will only play if the current
playback finished automatically. It is cleared on any other call to
<tt class="docutils literal"><span class="pre">Channel.stop()</span></tt> or <tt class="docutils literal"><span class="pre">Channel.play()</span></tt>.</p>
<p>If there is no sound actively playing on the Channel then the Sound will
begin playing immediately.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.get_queue">
<tt class="descname">get_queue</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.get_queue" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">return any Sound that is queued</span></div>
<div class="line"><span class="signature">get_queue() -&gt; Sound</span></div>
</div>
<p>If a Sound is already queued on this channel it will be returned. Once
the queued sound begins playback it will no longer be on the queue.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.set_endevent">
<tt class="descname">set_endevent</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.set_endevent" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">have the channel send an event when playback stops</span></div>
<div class="line"><span class="signature">set_endevent() -&gt; None</span></div>
<div class="line"><span class="signature">set_endevent(type) -&gt; None</span></div>
</div>
<p>When an endevent is set for a channel, it will send an event to the
pygame queue every time a sound finishes playing on that channel (not
just the first time). Use <tt class="docutils literal"><span class="pre">pygame.event.get()</span></tt> to retrieve the endevent
once it&#8217;s sent.</p>
<p>Note that if you called <tt class="docutils literal"><span class="pre">Sound.play(n)</span></tt> or <tt class="docutils literal"><span class="pre">Channel.play(sound,n)</span></tt>,
the end event is sent only once: after the sound has been played &#8220;n+1&#8221;
times (see the documentation of Sound.play).</p>
<p>If <tt class="docutils literal"><span class="pre">Channel.stop()</span></tt> or <tt class="docutils literal"><span class="pre">Channel.play()</span></tt> is called while the sound was
still playing, the event will be posted immediately.</p>
<p>The type argument will be the event id sent to the queue. This can be any
valid event type, but a good choice would be a value between
<tt class="docutils literal"><span class="pre">pygame.locals.USEREVENT</span></tt> and <tt class="docutils literal"><span class="pre">pygame.locals.NUMEVENTS</span></tt>. If no type
argument is given then the Channel will stop sending endevents.</p>
</dd></dl>

<dl class="definition method">
<dt class="title" id="pygame.mixer.Channel.get_endevent">
<tt class="descname">get_endevent</tt><big>(</big><big>)</big><a class="headerlink" href="#pygame.mixer.Channel.get_endevent" title="Permalink to this definition"></a></dt>
<dd><div class="line-block">
<div class="line"><span class="summaryline">get the event a channel sends when playback stops</span></div>
<div class="line"><span class="signature">get_endevent() -&gt; type</span></div>
</div>
<p>Returns the event type to be sent every time the Channel finishes
playback of a Sound. If there is no endevent the function returns
<tt class="docutils literal"><span class="pre">pygame.NOEVENT</span></tt>.</p>
</dd></dl>

</dd></dl>

</dd></dl>

</div>

  </div>
          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="mouse.html" title="pygame.mouse"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="midi.html" title="pygame.midi"
             accesskey="P">previous</a> |</li>
        <li><a href="../index.html">Pygame v1.9.2 documentation</a> &raquo;</li>
    <script type="text/javascript" src="jquery.plugin.docscomments.js"></script>

      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2011, Pygame Developers.
    </div>
  </body>
</html>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.