Inserimento suoni
authorunknown <Manu@.(none)>
Sat, 27 Feb 2010 13:08:17 +0000 (14:08 +0100)
committerunknown <Manu@.(none)>
Sat, 27 Feb 2010 13:08:17 +0000 (14:08 +0100)
Sono stati inseriti dei suoni wav quando si cliccano i bottoni
TODO:linkare i wave in file qrc
PS: Sotto Windows copiare la cartella dei suoni in Release/debug
altrimenti viene eseguito il suono di sistema

13 files changed:
crazybutton.h
mainwindow.cpp
sounds/bleeeh.wav [new file with mode: 0644]
sounds/cat.wav [new file with mode: 0644]
sounds/cow.wav [new file with mode: 0644]
sounds/crow.wav [new file with mode: 0644]
sounds/dog.wav [new file with mode: 0644]
sounds/donkey.wav [new file with mode: 0644]
sounds/duck.wav [new file with mode: 0644]
sounds/goat.wav [new file with mode: 0644]
sounds/rosteer.wav [new file with mode: 0644]
testThread.cpp
ui_mainwindow.h

index d32310d..f197c75 100644 (file)
@@ -13,6 +13,7 @@ public:
 
 public slots:
      void changeColor();
 
 public slots:
      void changeColor();
+     bool getStateColor(){return col;}
 protected:
      void mousePressEvent(QMouseEvent *e);
      void mouseReleaseEvent(QMouseEvent *e);
 protected:
      void mousePressEvent(QMouseEvent *e);
      void mouseReleaseEvent(QMouseEvent *e);
index abad199..a508562 100644 (file)
@@ -2,6 +2,7 @@
 #include "ui_mainwindow.h"
 #include <QMessageBox>
 #include <QDebug>
 #include "ui_mainwindow.h"
 #include <QMessageBox>
 #include <QDebug>
+#include <QSound>
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
 
 MainWindow::MainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -95,30 +96,48 @@ void MainWindow::cliccaBottone(int id)
 {
     switch(id){
         case 0:
 {
     switch(id){
         case 0:
+                if(ui->pushButton->getStateColor())
+                    QSound::play("sounds/dog.wav");
                 ui->pushButton->changeColor();
                 break;
         case 1:
                 ui->pushButton->changeColor();
                 break;
         case 1:
+                if(ui->pushButton_2->getStateColor())
+                    QSound::play("sounds/cat.wav");
                 ui->pushButton_2->changeColor();
                 break;
         case 2:
                 ui->pushButton_2->changeColor();
                 break;
         case 2:
+                if(ui->pushButton_3->getStateColor())
+                    QSound::play("sounds/cow.wav");
                 ui->pushButton_3->changeColor();
                 break;
         case 3:
                 ui->pushButton_3->changeColor();
                 break;
         case 3:
+                if(ui->pushButton_4->getStateColor())
+                    QSound::play("sounds/duck.wav");
                 ui->pushButton_4->changeColor();
                 break;
         case 4:
                 ui->pushButton_4->changeColor();
                 break;
         case 4:
+                if(ui->pushButton_5->getStateColor())
+                    QSound::play("sounds/goat.wav");
                 ui->pushButton_5->changeColor();
                 break;
         case 5:
                 ui->pushButton_5->changeColor();
                 break;
         case 5:
+                if(ui->pushButton_6->getStateColor())
+                    QSound::play("sounds/donkey.wav");
                 ui->pushButton_6->changeColor();
                 break;
         case 6:
                 ui->pushButton_6->changeColor();
                 break;
         case 6:
+                if(ui->pushButton_7->getStateColor())
+                    QSound::play("sounds/crow.wav");
                 ui->pushButton_7->changeColor();
                 break;
         case 7:
                 ui->pushButton_7->changeColor();
                 break;
         case 7:
+                if(ui->pushButton_8->getStateColor())
+                    QSound::play("sounds/rosteer.wav");
                 ui->pushButton_8->changeColor();
                 break;
         case 8:
                 ui->pushButton_8->changeColor();
                 break;
         case 8:
+                if(ui->pushButton_9->getStateColor())
+                    QSound::play("sounds/bleeeh.wav");
                 ui->pushButton_9->changeColor();
                 break;
     }
                 ui->pushButton_9->changeColor();
                 break;
     }
@@ -129,39 +148,48 @@ MainWindow::~MainWindow()
     delete ui;
 }
 void MainWindow::clickA(){
     delete ui;
 }
 void MainWindow::clickA(){
+    QSound::play("sounds/dog.wav");
     emit cliccatoIlBottone(0);
 
 }
 
 void MainWindow::clickB(){
     emit cliccatoIlBottone(0);
 
 }
 
 void MainWindow::clickB(){
+    QSound::play("sounds/cat.wav");
     emit cliccatoIlBottone(1);
 
 }
 void MainWindow::clickC(){
     emit cliccatoIlBottone(1);
 
 }
 void MainWindow::clickC(){
+    QSound::play("sounds/cow.wav");
     emit cliccatoIlBottone(2);
 
 }
 void MainWindow::clickD(){
     emit cliccatoIlBottone(2);
 
 }
 void MainWindow::clickD(){
+    QSound::play("sounds/duck.wav");
     emit cliccatoIlBottone(3);
 
 }
 void MainWindow::clickE(){
     emit cliccatoIlBottone(3);
 
 }
 void MainWindow::clickE(){
+    QSound::play("sounds/goat.wav");
     emit cliccatoIlBottone(4);
 
 }
 void MainWindow::clickF(){
     emit cliccatoIlBottone(4);
 
 }
 void MainWindow::clickF(){
+    QSound::play("sounds/donkey.wav");
     emit cliccatoIlBottone(5);
 
 }
 void MainWindow::clickG(){
     emit cliccatoIlBottone(5);
 
 }
 void MainWindow::clickG(){
+    QSound::play("sounds/crow.wav");
     emit cliccatoIlBottone(6);
 
 }
 void MainWindow::clickH(){
     emit cliccatoIlBottone(6);
 
 }
 void MainWindow::clickH(){
+    QSound::play("sounds/rosteer.wav");
     emit cliccatoIlBottone(7);
 
 }
 void MainWindow::clickI(){
     emit cliccatoIlBottone(7);
 
 }
 void MainWindow::clickI(){
+    QSound::play("sounds/bleeeh.wav");
     emit cliccatoIlBottone(8);
 
 }
     emit cliccatoIlBottone(8);
 
 }
diff --git a/sounds/bleeeh.wav b/sounds/bleeeh.wav
new file mode 100644 (file)
index 0000000..a22d13d
Binary files /dev/null and b/sounds/bleeeh.wav differ
diff --git a/sounds/cat.wav b/sounds/cat.wav
new file mode 100644 (file)
index 0000000..8fc3ee9
Binary files /dev/null and b/sounds/cat.wav differ
diff --git a/sounds/cow.wav b/sounds/cow.wav
new file mode 100644 (file)
index 0000000..91095ab
Binary files /dev/null and b/sounds/cow.wav differ
diff --git a/sounds/crow.wav b/sounds/crow.wav
new file mode 100644 (file)
index 0000000..a6e3414
Binary files /dev/null and b/sounds/crow.wav differ
diff --git a/sounds/dog.wav b/sounds/dog.wav
new file mode 100644 (file)
index 0000000..5d3b3ab
Binary files /dev/null and b/sounds/dog.wav differ
diff --git a/sounds/donkey.wav b/sounds/donkey.wav
new file mode 100644 (file)
index 0000000..f8dc15b
Binary files /dev/null and b/sounds/donkey.wav differ
diff --git a/sounds/duck.wav b/sounds/duck.wav
new file mode 100644 (file)
index 0000000..312d482
Binary files /dev/null and b/sounds/duck.wav differ
diff --git a/sounds/goat.wav b/sounds/goat.wav
new file mode 100644 (file)
index 0000000..b214b36
Binary files /dev/null and b/sounds/goat.wav differ
diff --git a/sounds/rosteer.wav b/sounds/rosteer.wav
new file mode 100644 (file)
index 0000000..fd6d0a0
Binary files /dev/null and b/sounds/rosteer.wav differ
index 1d52705..fcdf34a 100644 (file)
@@ -16,6 +16,7 @@ TestThread::~TestThread(){
 
 }
 void TestThread::run(){
 
 }
 void TestThread::run(){
+    sleep(1);
     while(true){
 
     qsrand(QDateTime::currentDateTime().toTime_t());
     while(true){
 
     qsrand(QDateTime::currentDateTime().toTime_t());
@@ -28,9 +29,9 @@ void TestThread::run(){
     {
       emit generate(sequenza.at(i));
       qDebug()<<sequenza.at(i);
     {
       emit generate(sequenza.at(i));
       qDebug()<<sequenza.at(i);
-      msleep(500 - (_score*5));
+      msleep(500 - (_score*2));
       emit generate(sequenza.at(i));
       emit generate(sequenza.at(i));
-      msleep(500 - (_score*5));
+      msleep(500 - (_score*2));
       i++;
     }
     i=0;
       i++;
     }
     i=0;
@@ -55,6 +56,7 @@ void TestThread::updateCaption(int inputUser){
             _score++;
             emit score(_score);
             if(index==sequenza.size()){
             _score++;
             emit score(_score);
             if(index==sequenza.size()){
+                sleep(1);
                 attendiInputUtente=false;
                 index=0;
             }
                 attendiInputUtente=false;
                 index=0;
             }
index ed062e7..bd820d5 100644 (file)
@@ -1,7 +1,7 @@
 /********************************************************************************
 ** Form generated from reading UI file 'mainwindow.ui'
 **
 /********************************************************************************
 ** Form generated from reading UI file 'mainwindow.ui'
 **
-** Created: Sat 27. Feb 10:40:53 2010
+** Created: Sat 27. Feb 14:00:09 2010
 **      by: Qt User Interface Compiler version 4.6.2
 **
 ** WARNING! All changes made in this file will be lost when recompiling UI file!
 **      by: Qt User Interface Compiler version 4.6.2
 **
 ** WARNING! All changes made in this file will be lost when recompiling UI file!