mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
*** empty log message ***
This commit is contained in:
parent
a045e476e7
commit
d31724f76c
@ -1,18 +1,12 @@
|
||||
|
||||
Panda Audio Documentation
|
||||
-------------------------
|
||||
|
||||
Contents:
|
||||
|
||||
Introduction
|
||||
|
||||
Example Usage
|
||||
|
||||
Advanced Usage
|
||||
|
||||
Discussion
|
||||
Implementing an Alternative Sound System
|
||||
|
||||
Differences From the Prior System
|
||||
|
||||
Summary
|
||||
|
||||
|
||||
@ -24,6 +18,7 @@ Introduction
|
||||
Example Usage
|
||||
-------------
|
||||
|
||||
Python Example:
|
||||
effects = AudioManager.createAudioManager()
|
||||
music = AudioManager.createAudioManager()
|
||||
|
||||
@ -33,33 +28,43 @@ background = music.load("background_music")
|
||||
background.play()
|
||||
bang.play()
|
||||
|
||||
C++ Example:
|
||||
AudioManager effects = AudioManager::create_AudioManager();
|
||||
AudioManager music = AudioManager::create_AudioManager();
|
||||
|
||||
Differences From the Prior System
|
||||
---------------------------------
|
||||
bang = effects.get_sound("bang");
|
||||
background = music.get_sound("background_music");
|
||||
|
||||
General:
|
||||
background.play();
|
||||
bang.play();
|
||||
|
||||
The prior system had a lot of neat ideas in it, but we decided to go for something different anyway.
|
||||
|
||||
AudioPool, AudioManager, and AudioSound:
|
||||
Discussion
|
||||
----------
|
||||
|
||||
In the prior system, an AudioPool would be used to load sounds; a AudioManager would create an AudioSound; and you would pass the AudioSound back to the AudioManager to operate on it. This has been turned around quite a bit. It's now more object-oriented, in my opinion.
|
||||
AudioManager, and AudioSound:
|
||||
|
||||
The AudioManager is now a combination of the AudioPool and a category of sounds (e.g. sound effects, or music). It has many other functions removed -- or, if you like, moved to AudioSound. In the new system, you tell the sound itself to change its volume, loop, start time, play, stop, etc. There is no need to involve the AudioManager explicitly in these operations.
|
||||
The AudioManager is a combination of a file cache and a category
|
||||
of sounds (e.g. sound effects, battle sounds, or music).
|
||||
|
||||
In the old system, when you were done with a sound, you would explicitly give it back to the AudioPool. In the new system, you just delete the sound when you're done with it. (The AudioSound knows which AudioManager it is associated with, and will do the right thing).
|
||||
The first step is to decide which AudioManager to use and load it.
|
||||
|
||||
Sound, SoundPlayer, and SoundPlaying:
|
||||
Once you have an AudioManager (e.g. effectsManager), a call to
|
||||
get_sound(<file>) on that manager should get you an AudioSound
|
||||
(e.g. mySound = effectsManager.getSound("bang")).
|
||||
|
||||
The prior system took a much larger role in the way alternative (i.e. external, or platform specific) music systems were integrated. The new system, provides an API for the rest of Panda; and leaves a lot of leaway to the low level sound system. This is good and bad. On the good side: it's easier to understand, and it allows for widely varrying low level systems. On the bad side: it may be harder to keep the behavior consistent accross implementations (please try hard to keep them consistent, when adding an implementation), and there is less work already done when starting a new implementation.
|
||||
After getting a sound from an AudioManager, you can tell the sound
|
||||
change its volume, loop, start time, play, stop, etc. There is no
|
||||
need to involve the AudioManager explicitly in these operations.
|
||||
|
||||
In the prior system, there were sounds (that you didn't play), sound playings (that you did play), and sound players (which were lackies for the AudioManager). The newer system has AudioManagers (which manage sounds), and AudioSounds (which play sounds, i.e. they are sound objects).
|
||||
Simply delete the sound when you're done with it. (The AudioSound
|
||||
knows which AudioManager it is associated with, and will do the right
|
||||
thing).
|
||||
|
||||
MIDI Meant Music:
|
||||
|
||||
In the prior system, MIDI files were background music; while wave and mp3 were effects. You couldn't have mp3 background music, for example. In the newer system, you may create any number of categories (i.e. AudioManagers), which are not restricted to the type of sound they manage. You may now have MIDI and mp3 background music, for example.
|
||||
|
||||
AudioManager.loadSound():
|
||||
|
||||
In the newer system, you create an AudioManager (e.g. effectsManager), and call get_sound(<file>) on that manager (e.g. mySound = effectsManager.getSound("bang")).
|
||||
The audio system, provides an API for the rest of Panda; and leaves a
|
||||
lot of leaway to the low level sound system. This is good and bad.
|
||||
On the good side: it's easier to understand, and it allows for widely
|
||||
varrying low level systems. On the bad side: it may be harder to keep
|
||||
the behavior consistent accross implementations (please try to keep
|
||||
them consistent, when adding an implementation).
|
||||
|
||||
|
@ -98,7 +98,7 @@ to have assigned to it a birth parent node and a render parent node.
|
||||
|
||||
The birth parent node, accessed with set/get_birth_node, is the node that
|
||||
the system looks to when transforming a newly-born particle into world-space.
|
||||
If i wanted to attach a particle system to jafar's hands or herc's head, for
|
||||
If I wanted to attach a particle system to jafar's hands or herc's head, for
|
||||
instance, i would call set_birth_node on the appropriate node. This only
|
||||
needs to be set once, but take care that the node doesn't get destroyed (BAD
|
||||
things happen...).
|
||||
|
Loading…
x
Reference in New Issue
Block a user