Hi Christian,
I want to use a slightly changed run method that you have in your example (PortAudio)
I want to present two sinus sonds with a given duration with a pause between them. After playing a sinus sound I got always something like a stopping “click” in the sound. The sinus sound does not end with silence it ends with something like a “click” or “crack”. Is there a possibility to prevent this (or why does this happens?).
At the moment I use XOJO Version 2016 1.1 on my Mac but I also want to use the sinus sound presentation on Windows OS.
This is my currently code:
dim e as integer
p=new PortAudioMBS
s1=new MyPortAudioGenerateStreamMBS
for i as integer = 0 to aSinusPitch.Ubound
tones.pitch = aSinusPitch(i) // e.g. 1000 Hz
tones.duration = aDuration(i) // e.g. 0.3 seconds
tones.pauseBetween = aPauseBetween(i) // e.g. 0.5 seconds
// tones.paFloat32 ==> const paFloat32 = 1
// tones.rate ==> 48000
e=s1.OpenDefaultStream(0,2,tones.paFloat32, tones.rate, 0, 0)
System.DebugLog( "OpenDefaultStream: "+str(e) )
if e=0 then
e=s1.Start
SetSoundMuteMBS( false )
System.DebugLog( "Start: "+str(e) )
e=s1.IsStreamActive
System.DebugLog( "Active: "+str(e) )
s1.UseSafeThreading=false
SleepMBS(aDuration(i))
SetSoundMuteMBS( true )
SetSoundVolumeMBS(0)
e=s1.Stop
e=s1.Close
SleepMBS(aPauseBetween(i))
else
System.DebugLog( "Host Error: "+str(s1.HostError) )
end if
next i
Any help is appreciated. Thank you.
Thomas