Commit pour la forme
This commit is contained in:
@@ -96,10 +96,46 @@ void lecture (int nombreChaines, int tempo, Motif* melodie[]) {
|
||||
|
||||
|
||||
//Lecture des motifs
|
||||
for (courant = 0; courant < taille; courant++) {
|
||||
|
||||
Motif* m;
|
||||
|
||||
for (int courant = 0; courant < taille; courant++) {
|
||||
for (int i = 0; i < melodie[courant] -> nbrTmp; i++) {
|
||||
printf("lecture temps %d : N=%d I=%d\n",i,getNote(melodie[courant],0,i),getInstrument(melodie[courant],0,i));
|
||||
lireTick (system, melodie[courant], i, sample, chan, nombreChaines, tempo);
|
||||
|
||||
// D<>BUT DU COPIER COLLER POTENTIELLEMENT FOIREUX
|
||||
|
||||
m = melodie[courant]
|
||||
for (int chaine = 0; chaine < nombreChaines; chaine++) { // On va lire les chaines une <20> une par num<75>ro croissant
|
||||
if (m != NULL) {
|
||||
if (getInstrument(m,0,tmp) == -1) FMOD_Channel_Stop(chan[chaine]); // Si la note est un silence, la chaine s'arr<72>te
|
||||
else {
|
||||
|
||||
if (getNote(m,0,tmp) != 0) {
|
||||
|
||||
FMOD_Channel_Stop(chan[chaine]);
|
||||
FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sample[getInstrument(m,chaine,tmp)], 0, &chan[chaine]);
|
||||
|
||||
//Ici on va s'occuper du pitch
|
||||
FMOD_DSP *pitch;
|
||||
FMOD_System_CreateDSPByType(system, FMOD_DSP_TYPE_PITCHSHIFT, &pitch);
|
||||
FMOD_DSP_SetParameter(pitch, FMOD_DSP_PITCHSHIFT_PITCH, 2.0);
|
||||
FMOD_Channel_AddDSP(chan[chaine], pitch, 0); // C'est quoi chan1 ??? Je l'ai remplac<61> par chan[1], vu que chan1 est as d<>clar<61>...
|
||||
// On va passer une bonne journ<72>e...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* while (SDL_GetTicks() - tempsPrecedent < 125) {} // Si 125 ms se sont <20>coul<75>es (il faudra r<>gler ce temps sur le tempo)
|
||||
tempsPrecedent = tempsPrecedent + 125;
|
||||
Avouez que ce serait con qu'on ait besoin de SDL juste pour la temporisation
|
||||
alors qu'on peut utiliser la fonction native usleep pour <20>a, et beaucoup plus simplement. */
|
||||
usleep(60000000/tempo);
|
||||
|
||||
|
||||
// FIN DU COPIER COLLER POTENTIELLEMENT FOIREUX
|
||||
|
||||
// lireTick (system, melodie[courant], i, sample, chan, nombreChaines, tempo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user