0
0

[url=http://host-a.net/icuurd12b42/sines.zip:25d0g7u0]Download sines.zip[/url:25d0g7u0]

I made 2 sine waves,

wave 1- 1000hz for 1000ms, so, 1000 cycles in the file.
wave 2- 1000hz for 1ms, so, 1 cycle in the file.

OK, I play the sound looped, and I get a tic at the end of the file, or at the begining, I really cant tell, it happens so fast.

In WavePad, playing looped, I hear no ticking for the 1000ms… But I can’t play the 1ms in it, it freaks out…

In FMOD, the 1000ms sound ticks every second and the 1ms sound, well, it plays (thumbs up for that), but I get 1000 ticks/s with it, so, at that rate, it really come out as distortion.

Using latest FMOD….well, build minor 08, on windows with realtek sound card. Sounds are played in software mode, not streamed.

  • You must to post comments
0
0

I just played both those sounds in the fmod playsound example and they sound perfect.

result = system->createSound("/temp/public/sine2_1000hz_1ms.wav", FMOD_SOFTWARE | FMOD_LOOP_NORMAL, 0, &sound2);

this one sounds exactly the same as the 1 second version, there are no clicks.

  • You must to post comments
0
0

True but not this way

result = FMOD_System_CreateSound(system, "Samples/sine_1000hz_1000ms.wav", FMOD_SOFTWARE, 0, &sound2);
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &channel);
FMOD_Channel_SetLoopCount(channel,5);
FMOD_Channel_SetMode(channel,FMOD_LOOP_NORMAL);

I decide on the fly if the sound instance, I mean channel is looped.

Creating the sound, software with the loop flag works flawlessly… Like your code…

However, it is not the way I have implemented my setup as I decide to play a sound or later loop the same sound to my liking.

I though it might be related to the sleep at the bottom of the main loop… but no…

  • You must to post comments
0
0

That’s not the way to do it. FMOD has to correct the sound data before it loops, and if you dont do it on the sound it wont do it at all.

Use FMOD_Sound_SetMode before the playsound, not FMOD_Channel_SetMode.

edit: Actually – you’re better off turning on looping when it loads the sound, then call channel_setmode off/on at runtime and then it will be set up correctly for looping in advance on the sound side of things.

edit2 : i’m updating the docs for the next version for Channel::setMode to describe this in more detail.

  • You must to post comments
0
0

The other thing you could do is play the sound paused (as a parameter to PlaySound), set the Channel’s looping flag, and then unpause it.

  • You must to post comments
0
0

[quote="Adiss":lun2j57m]The other thing you could do is play the sound paused (as a parameter to PlaySound), set the Channel’s looping flag, and then unpause it.[/quote:lun2j57m]

I already tried that.

[quote="brett":lun2j57m]That’s not the way to do it. FMOD has to correct the sound data before it loops, and if you dont do it on the sound it wont do it at all.

Use FMOD_Sound_SetMode before the playsound, not FMOD_Channel_SetMode.

edit: Actually – you’re better off turning on looping when it loads the sound, then call channel_setmode off/on at runtime and then it will be set up correctly for looping in advance on the sound side of things.

edit2 : i’m updating the docs for the next version for Channel::setMode to describe this in more detail.[/quote:lun2j57m]

you mean like this?
result = FMOD_System_CreateSound(system, "Samples/sine_1000hz_1000ms.wav", FMOD_SOFTWARE |FMOD_LOOP_NORMAL, 0, &sound2);

//to loop
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &channel);
FMOD_Channel_SetLoopCount(channel,5);
FMOD_Channel_SetMode(channel,FMOD_LOOP_NORMAL);

//to play once
result = FMOD_System_PlaySound(system, FMOD_CHANNEL_FREE, sound2, 0, &channel);
FMOD_Channel_SetMode(channel,FMOD_LOOP_OFF); <<Not sure of the flag

or perhapse set the loop count to 1 for single play… Will 1 play once or play twice??

Would going back and forth between loop off and loop normal reintroduce the tics though…

Answer if you like, I’ll test it tomorow anyway.

I also found another tic anoyance when starting a 1 note mid, or that 1 second sine wave. the pcode is like this. Assume the note lasts for 1 second in the mid file too.

sound = createsound(midifile, FMOD_LOOP_OFF | FMOD_2D | FMOD_SOFTWARE|FMOD_ACCURATETIME)

time = GetTicCount() + 500;
loop
{
if(time<GetTickGount())
{
playsound (sound)
time = GetTicCount() + 500;
}
fmod update()
sleep(16)
}

Perhaps the chage you suggest will fix that too.

  • You must to post comments
0
0

yes creating the sound looping first , then turning it off when you dont want it should solve the problem.

  • You must to post comments
0
0

Yes, it is solved thank you.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.