Вот пример (кстати, создай три кнопки):
#include <mmsystem.h>
...
DWORD wav[0x1000B] = { 0x46464952,0x00040024,0x45564157,0x20746D66,
0x00000010,0x00020001,0x00005622,0x00015888,
0x00100004,0x61746164,0x00040000 };
//-----------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
for( int i = 0; i < 0x10000; i += 0x800 ) {
wav[i+11] = 0x7FFF;
wav[i+11+100] = 0x7FFF0000;
}
PlaySound( LPCSTR(wav), 0, SND_LOOP | SND_ASYNC | SND_MEMORY );
Sleep( 10000 );
}
//-----------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)
{
for( int i = 0; i < 0x10000; i += 0x800 ) {
wav[i+11] = 0x7FFF;
wav[i+11+(i - 0x8000)*100/0x8000] |= 0x7FFF0000;
}
PlaySound( LPCSTR(wav), 0, SND_LOOP | SND_ASYNC | SND_MEMORY );
Sleep( 10000 );
}
//-----------------------------
void __fastcall TForm1::Button3Click(TObject *Sender)
{
int drift=200;
for( int i = 0; i < 0x10000; i += 0x800 ) {
wav[i+11] = 0x7FFF;
wav[i+11+drift] = 0x7FFF0000;
drift -= 10;
}
PlaySound( LPCSTR(wav), 0, SND_LOOP | SND_ASYNC | SND_MEMORY );
Sleep( 10000 );
}
//-----------------------------
Предыдущий вопрос
|
|
Следующий вопрос
источник
by jenyok
|