Salve a tutti,
ho il seguente problema: devo sentire un suono per 10 o 5 millisecondi e siccome alcune volte non lo sento ho pensato che cambiando la priorità del thread in THREAD_PRIORITY_TIME_CRITICAL , mi sarebbe stata garantita la sicurezza di sentire il suono, della durata di 10 ms, ogni volta che lo suonavo.
Dato che non mi sembra che sia cambiato molto, vi chiedo gentilmente di dare un occhiata al mio codice e vedere se realmente ho impostato la priorità che voluta. Il thread che voglio rendere prioritario è FSOUND_SetMute().
Le librerie che ho usato son le FMOD:
grazie .Codice:int main() { void *hCT=0; DWORD priority =0; FSOUND_SAMPLE *sample_1; FSOUND_Init(48000, 32, 0); sample_1 = FSOUND_Sample_Load(FSOUND_FREE, PATH_1, FSOUND_STEREO|FSOUND_LOOP_NORMAL, 0, 0); FSOUND_PlaySound(1, sample_2); FSOUND_SetMute(1,TRUE); /****cambio priorità al thread FSOUND_SetMute()****/ hCT = GetCurrentThread(); SetThreadPriority(hCT,15); priority=GetThreadPriority(hCT); /*********************************************/ FSOUND_SetMute(1,FALSE); for(i=0;i<2000000;i++){ } FSOUND_StopSound(1); FSOUND_Close(); }



Rispondi Citando


