diff --git a/Graphic/Bar.hpp b/Graphic/Bar.hpp index 341e09c..dd525e8 100644 --- a/Graphic/Bar.hpp +++ b/Graphic/Bar.hpp @@ -6,7 +6,7 @@ class Bar { public: - const int count = 60; // number of bars + const int count = 30; // number of bars float scaleBar; // value to scale the bars float barGap = 0.06; float maxScale = 4.5; @@ -30,7 +30,7 @@ class Bar { // 0.5647, 0.9333, 0.5647, // light green // 0.5647, 0.9333, 0.5647, // light green - 0.2314, 0.2824, 0.2039, + 0.2314, 0.2824, 0.2039, //default 0.2314, 0.2824, 0.2039, 0.2314, 0.2824, 0.2039, 0.2314, 0.2824, 0.2039, diff --git a/Graphic/sky.hpp b/Graphic/sky.hpp deleted file mode 100644 index e42ec9b..0000000 --- a/Graphic/sky.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include - - -class Sky { - - public: - // const int count = 30; // number of bars - // float scaleBar; // value to scale the bars - // float barScale[]; - - GLfloat vertices[8] = { - -1, 1, - -1, 1, - -1, -1, - -1, -1, - }; - - // color format: CMY - GLfloat colors[12] = { - // 0.6275, 0.7059, 0.2863, // purple - // 0.6275, 0.7059, 0.2863, - // 0.1451, 0.0000, 0.5098, // green - // 0.1451, 0.0000, 0.5098, - // 0.2314, 0.2824, 0.2039, // light purple - // 0.2314, 0.2824, 0.2039, - 1.0, 0.0, 0.0, //white - 1.0, 0.0, 0.0, //white - 1.0, 0.0, 0.0, //white - 1.0, 0.0, 0.0, //white - // 1.0, 1.0, 1.0, - // 0.4078, 0.0824, 0.1765, // mint bllue - // 0.4078, 0.0824, 0.1765, - }; - - // bar indices - GLubyte indices[4] = { - 0, 1, - 2, 3, - }; - - // initialize barScale - // void initBarScale() { - // for ( int i = 0; i < numBar; i++) { - // barScale[i] = 0; - // } - // } - - -}; diff --git a/a.out b/a.out index e603e00..06dfa06 100644 Binary files a/a.out and b/a.out differ diff --git a/main.cpp b/main.cpp index e31bc4a..18ce713 100644 --- a/main.cpp +++ b/main.cpp @@ -1,12 +1,11 @@ #include #include #include -#include +// #include #include #include // fast fourier transform #include // #include -#include "stb/stb_image.h" #include "Audio.hpp" #include "Graphic/Bar.hpp" @@ -14,11 +13,6 @@ #include "Graphic/DescriptionPage.hpp" -// const char *audioFilePath = "Audio/freq-test.wav"; - - - - // clock sf::Clock clock_; sf::Time timeElapsed = sf::milliseconds(0); @@ -183,6 +177,7 @@ void displayStars() { glVertexPointer(2, GL_FLOAT, 0, star.vertices); + float incx, incy; // if ( maxChunkFreq > 0.35*maxFreq ) // glColorPointer(3, GL_FLOAT, 0, star.colorsOn); // std::cout << maxChunkFreq << " " << 0.35*maxFreq << std::endl; @@ -195,11 +190,29 @@ void displayStars() { glPushMatrix(); for ( float y = -0.9; y <= 1; y += 0.1) { for ( float x = -0.9; x <= 1; x += 0.1) { + // for ( float y = -1.7; y <= 1.7; y += 0.1) { + // for ( float x = -1.7; x <=1.7; x += 0.1) { glRotatef( 1000, 0.0, 0.0, 1.0); glRotatef( star.displace, 0.0, 0.0, 1.0); glPushMatrix(); glTranslatef( x, y, 0.0 ); + + // glTranslatef( 0.0, 0.0, star.displace ); + // if ( x < 0 ) + // incx = -1; + // else + // incx = 1; + + // if ( y < 0 ) + // incy = -1; + // else + // incy = 1; + + // if ( !(x-(star.displace*incx) == 0 || y-(star.displace*incy) == 0) ) + // glTranslatef( x-(star.displace*incx), y-(star.displace*incy), 0.0 ); + // glTranslatef( x-(star.displace*incx), y-(star.displace*incy), 0.0 ); + glDrawElements(GL_POINTS, 1, GL_UNSIGNED_BYTE, star.indices); glPopMatrix(); @@ -266,6 +279,7 @@ void displayMenuPage() { glDrawElements(GL_POLYGON, 4, GL_UNSIGNED_BYTE, dp.indices); + glColor3f( 1.0, 1.0, 1.0 ); std::string menuPage[6] = { "Choose the audio file:", @@ -302,13 +316,13 @@ void displayMenuPage() { } void rotateStars() { - star.displace += normalize( maxChunkFreq, 0, maxFreq, 0.04); + star.displace += normalize( maxChunkFreq, 0, maxFreq, 0.05); // star.displace += 0.01; // star.displaceY += 0.01; } -void initMusic( std::string audioFile) { +void initMusic( std::string audioFile ) { audio.loadBuffer(audioFile); @@ -351,13 +365,38 @@ void display() { displayStars(); displayBars(); + if (!audio.played) { + + initMusic("Audio/tabla.wav"); + + } + + } else if ( scene == 3 ) { + // audio.loadBuffer(audioFilePath); + + displayStars(); + displayBars(); + if (!audio.played) { initMusic("Audio/ichika-nito.wav"); } - } + } else if ( scene == 4 ) { + // audio.loadBuffer(audioFilePath); + sf::Time song_delay = sf::milliseconds(800); + + displayStars(); + displayBars(); + + if (!audio.played) { + + initMusic("Audio/vocals.wav"); + + } + + } else