Skip to content

Commit

Permalink
[SOUND] Implementing some test sounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mandarancio committed Jun 25, 2012
1 parent 455fd65 commit cbbc126
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion goo.cpp
Expand Up @@ -3,6 +3,8 @@

#include <QDebug>

#include "publicclass.h"

Goo::Goo( int radius, QObject *parent) :
QObject(parent)
{
Expand Down Expand Up @@ -200,7 +202,18 @@ void Goo::drag(){
info.speed=body->GetLinearVelocity();
info.aForce=body->GetAngularVelocity();
}
if (!hasJoint()) body->SetActive(false);
if (!hasJoint()) {
if (!dragging){
ALbyte name[100]="resources/sounds/drag.wav";
QPair<unsigned int,unsigned int> source =soundSystem.createSource(name);
soundSystem.setPitch(source.first,float(radius)/20.0);
soundSystem.setVolume(source.first,radius/24.0);
soundSystem.setPosition(source.first,getPPosition());
soundSystem.playSource(source.first);
soundSystem.addSource(source);
}
body->SetActive(false);
}
body->SetLinearVelocity(b2Vec2(0,0));
body->SetAngularVelocity(0);
dragging=true;
Expand Down Expand Up @@ -255,6 +268,15 @@ void Goo::checkForConnection(Goo *goo){
}

void Goo::fallDown(){
if (!falling){
// ALbyte name[100]="resources/sounds/scream.wav";
// QPair<unsigned int,unsigned int> source =soundSystem.createSource(name);
// soundSystem.setPitch(source.first,float(radius)/20.0);
// soundSystem.setVolume(source.first,radius/24.0);
// soundSystem.setPosition(source.first,getPPosition());
// soundSystem.playSource(source.first);
// soundSystem.addSource(source);
}
onGround=false;
falling=true;
stopFollow();
Expand Down
Binary file added resources/sounds/drag.wav
Binary file not shown.
Binary file added resources/sounds/scream.wav
Binary file not shown.

0 comments on commit cbbc126

Please sign in to comment.