Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
fauwara committed Aug 1, 2022
1 parent 0668261 commit 7808c40
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 63 deletions.
4 changes: 2 additions & 2 deletions Graphic/Bar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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,
Expand Down
51 changes: 0 additions & 51 deletions Graphic/sky.hpp

This file was deleted.

Binary file modified a.out
Binary file not shown.
59 changes: 49 additions & 10 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <vector>
// #include <vector>
#include <string.h>
#include <fftw3.h> // fast fourier transform
#include <GL/glut.h> //
#include <SFML/System.hpp>
#include "stb/stb_image.h"

#include "Audio.hpp"
#include "Graphic/Bar.hpp"
#include "Graphic/Stars.hpp"
#include "Graphic/DescriptionPage.hpp"


// const char *audioFilePath = "Audio/freq-test.wav";




// clock
sf::Clock clock_;
sf::Time timeElapsed = sf::milliseconds(0);
Expand Down Expand Up @@ -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;
Expand All @@ -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();

Expand Down Expand Up @@ -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:",
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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



Expand Down

0 comments on commit 7808c40

Please sign in to comment.