~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/doc/Sound.py

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Blender.Sound module and the Sound PyType object
 
2
 
 
3
"""
 
4
The Blender.Sound submodule.
 
5
 
 
6
Sound
 
7
=====
 
8
 
 
9
This module provides access to B{Sound} objects in Blender.
 
10
 
 
11
Example::
 
12
  import Blender
 
13
  from Blender import Sound
 
14
  #
 
15
  sound = Sound.Load("/path/to/my/sound.wav")    # load a sound file
 
16
  print "Sound from", sound.getFilename(),
 
17
  print "loaded to obj", sound.getName())
 
18
  print "All Sounds available now:", Sound.Get()
 
19
"""
 
20
 
 
21
def Load (filename):
 
22
  """
 
23
  Load the sound called 'filename' into a Sound object.
 
24
  @type filename: string
 
25
  @param filename: The full path to the sound file.
 
26
  @rtype:  Blender Sound
 
27
  @return: A Blender Sound object with the data from I{filename}.
 
28
  """
 
29
 
 
30
def Get (name = None):
 
31
  """
 
32
  Get the Sound object(s) from Blender.
 
33
  @type name: string
 
34
  @param name: The name of the Sound object.
 
35
  @rtype: Blender Sound or a list of Blender Sounds
 
36
  @return: It depends on the I{name} parameter:
 
37
      - (name): The Sound object called I{name}, None if not found;
 
38
      - (): A list with all Sound objects in the current scene.
 
39
  """
 
40
 
 
41
 
 
42
class Sound:
 
43
  """
 
44
  The Sound object
 
45
  ================
 
46
    This object gives access to Sounds in Blender.
 
47
  @ivar name: The name of this Sound object.
 
48
  @ivar filename: The filename (path) to the sound file loaded into this Sound
 
49
     object.
 
50
  """
 
51
 
 
52
  def getName():
 
53
    """
 
54
    Get the name of this Sound object.
 
55
    @rtype: string
 
56
    """
 
57
 
 
58
  def getFilename():
 
59
    """
 
60
    Get the filename of the sound file loaded into this Sound object.
 
61
    @rtype: string
 
62
    """
 
63
 
 
64
  def play():
 
65
    """
 
66
    Play this sound.
 
67
    """
 
68
 
 
69
  def setCurrent():
 
70
    """
 
71
    Make this the active sound in the sound buttons window (also redraws).
 
72
    """
 
73
 
 
74
  def getVolume():
 
75
    """
 
76
    Get this sound's volume.
 
77
    rtype: float
 
78
    """
 
79
 
 
80
  def setVolume(f):
 
81
    """
 
82
    Set this sound's volume.
 
83
    @type f: float
 
84
    @param f: the new volume value in the range [0.0, 1.0].
 
85
    """
 
86
 
 
87
  def getAttenuation():
 
88
    """
 
89
    Get this sound's attenuation value.
 
90
    rtype: float
 
91
    """
 
92
 
 
93
  def setAttenuation(f):
 
94
    """
 
95
    Set this sound's attenuation.
 
96
    @type f: float
 
97
    @param f: the new attenuation value in the range [0.0, 5.0].
 
98
    """
 
99
 
 
100
  def getPitch():
 
101
    """
 
102
    Get this sound's pitch value.
 
103
    rtype: float
 
104
    """
 
105
 
 
106
  def setPitch(f):
 
107
    """
 
108
    Set this sound's pitch.
 
109
    @type f: float
 
110
    @param f: the new pitch value in the range [-12.0, 12.0].    
 
111
    """
 
112