From efea0609a6c927a767dae45572bb847525f7760d Mon Sep 17 00:00:00 2001 From: Jason Van Cleave Date: Tue, 13 Mar 2012 02:58:30 -0400 Subject: [PATCH] cleaned up duplication/corruption in ofSoundPlayer cleaned up what looked like a bad merge --- _documentation/sound/ofSoundPlayer.markdown | 292 ++------------------ 1 file changed, 18 insertions(+), 274 deletions(-) diff --git a/_documentation/sound/ofSoundPlayer.markdown b/_documentation/sound/ofSoundPlayer.markdown index 60bfc8afd..5b8b97d94 100644 --- a/_documentation/sound/ofSoundPlayer.markdown +++ b/_documentation/sound/ofSoundPlayer.markdown @@ -104,35 +104,6 @@ Load a Sound with Folder Path ofSoundPlayer mySound; mySound.loadSound("sounds/beat.mp3"); ~~~~ - - -Loads a sound file given by fileName. Sound files can be in .wav, .aif, .mp3, -.mp2, .ogg or .raw format. The program will look for the file relative to the -data/ folder. If you set the optional 'bool stream' argument to true the file -will be streamed from disk instead of being completely loaded into memory. It -makes a lot of sense to stream files if you are dynamically loading large -sound files into your program, which would normally cause the program to -freeze for a short time as the whole sound is read into memory. - -Examples: - -Load a Sound -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.loadSound("beat.mp3"); -~~~~ - - -Load a Sound with Folder Path -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.loadSound("sounds/beat.mp3"); -~~~~ - @@ -171,20 +142,6 @@ mySound.load("beat.mp3"); mySound.play(); mySound.unloadSound(); //Stops sound from playing, unloads "beat.mp3" ~~~~ -Stops and unloads the current sound. - -Example: -~~~~{.cpp} -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.unloadSound(); //Stops sound from playing, unloads "beat.mp3" -~~~~` @@ -234,38 +191,6 @@ mySound.load("beat.mp3"); mySound.play(); //Plays sound mySound.play(); //Adds new copy of sound to channel and plays over currently playing sound ~~~~ -description -Plays the sound. If setMultiPlay() has been set to true each play() command -will spawn a new copy of the sound on a new channel, letting the existing -sounds continue until they are finished. If setMultiPlay() is set to false it -will restart the playback of the song. - -Examples: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); //Plays sound - - mySound.play(); //Restarts and plays sound -~~~~ - - -Multiplay: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.setMultiPlay(true); - - mySound.load("beat.mp3"); - - mySound.play(); //Plays sound - - mySound.play(); //Adds new copy of sound to channel and plays over currently playing sound -~~~~ @@ -303,19 +228,6 @@ mySound.load("beat.mp3"); mySound.play(); //Begins playback of sound mySound.stop(); //Ends playback, stops audio ~~~~ -Stops the sound currently playing. - -Example: -~~~~{.cpp} -~~~~{.cpp} - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); //Begins playback of sound - - mySound.stop(); //Ends playback, stops audio -~~~~ @@ -353,20 +265,6 @@ mySound.load("beat.mp3"); mySound.play(); mySound.setVolume(0.1f); //Sets volume at 10% of maximum ~~~~ -Sets the volume (vol) of the sound. 0.0 - 1.0 range. 0.0 is silent and 1.0 is -full volume. - -Example: -~~~~{.cpp} -~~~~{.cpp} - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.setVolume(0.1f); //Sets volume at 10% of maximum -~~~~ @@ -406,25 +304,6 @@ mySound.pan(0.2f); //Pans to the left mySound.pan(0.8f); //Pans to the right mySound.pan(0.5f); //Back to center ~~~~ -Sets the pan position (pct) of the sound. 0.0 - 1.0 range. 0.5 is center pan, -0.0 is full left pan and 1.0 is full right pan. - -Example: -~~~~{.cpp} -~~~~{.cpp} - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.pan(0.2f); //Pans to the left - - mySound.pan(0.8f); //Pans to the right - - mySound.pan(0.5f); //Back to center -~~~~ - @@ -463,24 +342,6 @@ mySound.setSpeed(2.0f); //Chipmunk Voice mySound.setSpeed(0.2f); //Isaac Hayes on Muscle Relaxers mySound.setSpeed(1.0f); //Normal again ~~~~ -Sets the playback speed (spd) of the sound. 1.0 is the normal speed. 2.0 is -double the normal speed etc. - -Example: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.loadSound("beat.mp3"); - - mySound.play(); - - mySound.setSpeed(2.0f); //Chipmunk Voice - - mySound.setSpeed(0.2f); //Isaac Hayes on Muscle Relaxers - - mySound.setSpeed(1.0f); //Normal again -~~~~ @@ -519,22 +380,6 @@ mySound.play(); mySound.setPaused(true); //Sound is paused mySound.setPaused(false); //Sound is unpaused, playback continues ~~~~ -Pauses and un-pauses the playback of the sound. - -Example: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.setPaused(true); //Sound is paused - - mySound.setPaused(false); //Sound is unpaused, playback continues -~~~~ - @@ -571,20 +416,6 @@ mySound.load("beat.mp3"); mySound.setLoop(true); //Sound will loop mySound.play(); ~~~~ -Loops the sound if set to true. Does not loop the sound if set to false. -Default is false. - -Example: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.setLoop(true); //Sound will loop - - mySound.play(); -~~~~ @@ -624,25 +455,7 @@ mySound.load("beat.mp3"); mySound.play(); //Plays sound mySound.play(); //Adds new copy of sound to channel and plays over currently playing sound ~~~~ -Allows a sound to be played multiple times at once. When set to true the -play() function will start playing the sound on a new channel, letting the old -channels continue until they are done playing. When set to false the play() -function will stop the channel before playing the sound. - -Example: -~~~~{.cpp} - - - ofSoundPlayer mySound; - - mySound.setMultiPlay(true); - - mySound.load("beat.mp3"); - - mySound.play(); //Plays sound - - mySound.play(); //Adds new copy of sound to channel and plays over currently playing sound -~~~~ + @@ -681,21 +494,7 @@ mySound.play(); mySound.setPosition(0.5f); //Moves the playhead to halfway through the sound mySound.setPosition(0.0f); //Moves the playhead back to the beginning of the sound ~~~~ -Sets the playback-head to the position (pct) specified. 0.0 - 1.0 range. 0.0 -is the beginning of the sound file and 1.0 is the end. - -Example: -~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.setPosition(0.5f); //Moves the playhead to halfway through the sound - - mySound.setPosition(0.0f); //Moves the playhead back to the beginning of the sound + @@ -724,27 +523,14 @@ _advanced: False_ _description: _ -0.0 is the beginning of the sound file and 1.0 is the end. - -Example: - -~~~~{.cpp} -ofSoundPlayer mySound; -mySound.load("beat.mp3"); -mySound.play(); -mySound.getPosition(); //Returns the current position as a percent 0.0-1.0 -~~~~ Returns the current position of the playback-head in the sound. 0.0 - 1.0 range. 0.0 is the beginning of the sound file and 1.0 is the end. Example: ~~~~{.cpp} ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - + mySound.load("beat.mp3"); + mySound.play(); mySound.getPosition(); //Returns the current position as a percent 0.0-1.0 ~~~~ @@ -775,26 +561,14 @@ _advanced: False_ _description: _ -Example: -~~~~{.cpp} -ofSoundPlayer mySound; -mySound.load("beat.mp3"); -mySound.getIsPlaying(); //Returns false -mySound.play(); -mySound.getIsPlaying(); //Returns true -~~~~ Returns true if sound is currently playing, otherwise returns false. + Example: ~~~~{.cpp} - - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.getIsPlaying(); //Returns false - - mySound.play(); - + ofSoundPlayer mySound; + mySound.load("beat.mp3"); + mySound.getIsPlaying(); //Returns false + mySound.play(); mySound.getIsPlaying(); //Returns true ~~~~ @@ -825,30 +599,16 @@ _advanced: False_ _description: _ -0.5 is center pan, 0.0 is full left pan and 1.0 is full right pan. - -Example: -~~~~{.cpp} -ofSoundPlayer mySound; -mySound.load("beat.mp3"); -mySound.getSpeed(); //Returns 1.0 -mySound.setSpeed(2.0f); -mySound.getSpeed(); //Returns 2.0f -~~~~ Returns the pan position of the sound. 0.0 - 1.0 range. 0.5 is center pan, 0.0 is full left pan and 1.0 is full right pan. Example: ~~~~{.cpp} - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.getSpeed(); //Returns 1.0 - - mySound.setSpeed(2.0f); - + ofSoundPlayer mySound; + mySound.load("beat.mp3"); + mySound.getSpeed(); //Returns 1.0 + mySound.setSpeed(2.0f); mySound.getSpeed(); //Returns 2.0f ~~~~ @@ -879,17 +639,6 @@ _advanced: False_ _description: _ -0.5 is center pan, 0.0 is full left pan and 1.0 is full right pan. Default is 0.5 - -Example: -~~~~{.cpp} -ofSoundPlayer mySound; -mySound.load("beat.mp3"); -mySound.play(); -mySound.getPan();//Returns 0.5 -mySound.setPan(0.2f); -mySound.getPan();//Returns 0.2 -~~~~ Returns the pan position of the sound. 0.0 - 1.0 range. 0.5 is center pan, 0.0 is full left pan and 1.0 is full right pan. Default is 0.5 @@ -897,16 +646,11 @@ Returns the pan position of the sound. 0.0 - 1.0 range. Example: ~~~~{.cpp} - ofSoundPlayer mySound; - - mySound.load("beat.mp3"); - - mySound.play(); - - mySound.getPan();//Returns 0.5 - - mySound.setPan(0.2f); - + ofSoundPlayer mySound; + mySound.load("beat.mp3"); + mySound.play(); + mySound.getPan();//Returns 0.5 + mySound.setPan(0.2f); mySound.getPan();//Returns 0.2 ~~~~