Lire un .mid en boucle (Command MCI) [C++] - Programmation
Marsh Posté le 06-01-2002 à 19:08:37
include <windows.h> 
#include <stdio.h> 
 
HWND hWndMain; 
 
BOOL PlayMidi(char *sFileName) 
{ 
 char buf[256]; 
 
 sprintf(buf, "open %s type sequencer alias MUSIC", sFileName); 
  
 if (mciSendString("close all", NULL, 0, NULL) != 0) 
 { 
 	return(FALSE); 
 } 
 
 if (mciSendString(buf, NULL, 0, NULL) != 0) 
 { 
 	return(FALSE); 
 } 
 
 if (mciSendString("play MUSIC from 0", NULL, 0, hWndMain) != 0) 
 { 
 	return(FALSE); 
 } 
  
 return TRUE; 
} 
 
BOOL PauseMidi() 
{ 
 if (mciSendString("stop MUSIC", NULL, 0, NULL) != 0) 
 { 
 	return(FALSE); 
 } 
 return TRUE; 
} 
 
BOOL ResumeMidi() 
{   
 if (mciSendString("play MUSIC notify", NULL, 0, hWndMain) != 0) 
 { 
 	return(FALSE); 
 } 
 
 return TRUE; 
} 
 
BOOL StopMidi() 
{ 
 if (mciSendString("close all", NULL, 0, NULL) != 0) 
 { 
 	return(FALSE); 
 }  
 
 return TRUE; 
} 
 
BOOL ReplayMidi() 
{ 
 if (mciSendString("play MUSIC from 0 notify", NULL, 0, hWndMain) != 0) 
 { 
 	return(FALSE); 
 } 
 
 return TRUE; 
} 
Marsh Posté le 06-01-2002 à 20:43:17
Ca marche très bien seulement je voudrais mettre le son en boucle, donc il faut utiliser "repeat" mais je ne sais ou le placer dans la commande mci ! 
"play MUSIC from 0 repeat" ne marche pas, "play MUSIC repeat from 0" non plus... 
Marsh Posté le 06-01-2002 à 16:42:01
Je souhaite lire un fichier midi .mid. Je pense qu'il faut utiliser les fonctions midixxx() tel midiStreamOpen().. mais je n'arrive pas à m'en sortir. Quelqu'un aurait-il un exemple simple de code pour lire un .mid ? Merci
[jfdsdjhfuetppo]--Message édité par antsite--[/jfdsdjhfuetppo]