I solved my problem: a global variable is not affected by this side
effect, so I replaced:
PlayForeground(beep500)
with:
PlayForeground(gbeep500)
and now it works properly.
Cheers,
Giuseppe
On 22/12/2013 13:08, Giuseppe.Cabras wrote:
> Dear Shane,
> I have found the reason of my problem but I don't know how to solve it:
>
> if you use PlayForeground inside a function, it works the first time you
> call that function but not the following, if you look the stderr.txt you
> get:
>
> Loading Sound Data. Specs:
> Frequency: [44100]
> Format: [AUDIO_U8]
> Channels: []
> Silence: [€]
> Samples: [4096]
> Size: [1129270338]
> ------------------------------------
> ------------------------------------
> Loading Sound Data. Specs:
> Frequency: [44100]
> Format: [AUDIO_U8]
> Channels: []
> Silence: [€]
> Samples: [4096]
> Size: [4096]
> ------------------------------------
> Couldn't open audio: Audio device is already opened
> ------------------------------------
>
> in the first call, which is good and audio play as expected, but in the
> second call you get:
>
> ------------------------------------
> Loading Sound Data. Specs:
> Frequency: [1441791]
> Format: [UNKNOWN]
> Channels: [ ]
> Silence: [ ]
> Samples: [65535]
> Size: [0]
> ------------------------------------
> Couldn't open audio: Audio device is already opened
> ------------------------------------
> Loading Sound Data. Specs:
> Frequency: [1441791]
> Format: [UNKNOWN]
> Channels: [ ]
> Silence: [ ]
> Samples: [65535]
> Size: [0]
> ------------------------------------
> Couldn't open audio: Audio device is already opened
> ------------------------------------
>
> ... which is obviously wrong for all audio parameters.
> Closing the audio device before second call, probably solve the problem,
> but I don' know how.
>
> Any suggestion?
>
> Best,
> Giuseppe
>
>
> On 21/12/2013 20:28, Giuseppe.Cabras wrote:
>> Dear Shane,
>> I have a strange effect with PlayForeground() function. Inside a loop I
>> have this code:
>>
>> beep500 <- MakeSineWave(300+pointsadded*10, 500, 0.7)
>> if(IsAudioOut(beep500))
>> {
>> PlayForeground(beep500)
>> Print("beep ="+pointsadded)
>> }
>>
>>
>> which make a 500 ms beep at a frequency 350Hz<f<1300Hz, since
>> 5<pointsadded<100 are the points that the player win. And the first time
>> I call the loop it works properly and the audio is clear and loud. But
>> then second time I call the same loop, there is no audio output,
>> although I get in the stdout.txt:
>>
>> ...
>> using preloaded sound spec
>> beep =5
>> ...
>> using preloaded sound spec
>> beep =100
>> ...
>>
>> so that I am sure that PlayForeground(beep500) was called as in the
>> first loop and if I comment out the call of the first loop, I hear again
>> the audio in the second loop!
>> Some ideas on this strange behavior?
>>
>> Cheers,
>> Giuseppe
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Pebl-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pebl-list