Gucio Napisano Sierpień 8, 2018 Autor Zgłoś Udostępnij Napisano Sierpień 8, 2018 Co do odtwarzania midi z pliku to zmajstrowalem cos takiego: int PlayMIDI(LPSTR lpsFile) { DWORD err; MCI_PLAY_PARMS playParams; MCI_STATUS_PARMS statusParams; /* Check if device is open and plaing song. */ statusParams.dwItem = MCI_STATUS_MODE; if((err = mciSendCommand(midiParams.wDeviceID, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPVOID)&statusParams))) { /* Exit on error other than "Device not open" */ if(err != 0x0101) return FALSE; } else { /* Exit if song is still beeing played. */ if(statusParams.dwReturn == MCI_MODE_PLAY) return FALSE; }; /* Close a Sequencer device associated with file just in case that it was opened before */ mciSendCommand(midiParams.wDeviceID, MCI_CLOSE, MCI_WAIT, (DWORD)(LPVOID)&midiParams); /* Open a Sequencer device associated with file */ midiParams.lpstrDeviceType = (LPCSTR)MCI_DEVTYPE_SEQUENCER; midiParams.lpstrElementName = lpsFile; if((err = mciSendCommand(0, MCI_OPEN, MCI_WAIT|MCI_OPEN_ELEMENT|MCI_OPEN_TYPE|MCI_OPEN_TYPE_ID, (DWORD)(LPVOID)&midiParams))) { /* Error */ char chbuf[80], buff[MAX_PATH]; LoadString(hInstance,9250,chbuf,80); LoadString(hInstance,9251,buff,MAX_PATH); MessageBox(NULL,buff,chbuf,MB_OK|MB_ICONERROR); if(mciGetErrorString(err, &buff[0], sizeof(buff))) { sprintf(buff,"%s", &buff[0]); MessageBox(NULL,buff,chbuf,MB_OK|MB_ICONERROR); }; return FALSE; }; /* The device opened successfully. midiParams.wDeviceID now contains the device ID */ if((err = mciSendCommand(midiParams.wDeviceID, MCI_PLAY, MCI_NOTIFY, (DWORD)(LPVOID)&playParams))) { /* Error */ char chbuf[80], buff[MAX_PATH]; LoadString(hInstance,9250,chbuf,80); LoadString(hInstance,9252,buff,MAX_PATH); MessageBox(NULL,buff,chbuf,MB_OK|MB_ICONERROR); if(mciGetErrorString(err, &buff[0], sizeof(buff))) { sprintf(buff,"%s", &buff[0]); MessageBox(NULL,buff,chbuf,MB_OK|MB_ICONERROR); }; return FALSE; }; /* The device will be close on exit (see DeInitialize_()) or on begining of new song */ return TRUE; }; (zasoby) STRINGTABLE BEGIN 9250, "MCI Error" 9251, "Can't open MCI device" 9252, "Can't play file" END Pytanie jak przemielic ta funkcje i zmosic ja do odtwazania midi (wave'a tez mozna po niewielkiej modyfikacji otworzyc) z zasobow? Probowalem wiele razy i na rozne sposoby (nawet w roznych pozycjach :) ) ale nic z tego. P.S. Nie chcialo mi sie obcinac funkcji wiec ja wrzucilem zywcem z progsa a midiParams to globalna zmienna MCI_OPEN_PARMS Moze ktos to rozgryzie. Cytuj Link do komentarza Udostępnij na innych stronach More sharing options...
Gucio Napisano Sierpień 16, 2018 Autor Zgłoś Udostępnij Napisano Sierpień 16, 2018 Przydaloby sie to wiedziec, jestem w stu procentach pewien, ze da sie to zrobic. Cytuj Link do komentarza Udostępnij na innych stronach More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.