Need help to translate c++ -> PB
Posted: Sun Sep 14, 2003 12:26 am
Hi !
I try to play some music via the audiere sound library(audiere.sourceforge.net. Unfortunately i had some problems with that. I need help to translate c++ code to PB. The OpenDevice function works fine but I get always 0 when I call the OpenSound function.
Is someone able to help me ?
Thanks ....WolfgangS
OpenDevice declarations in audiere.h
OpenSound declarations in audiere.h
The PB source UPDATED
I try to play some music via the audiere sound library(audiere.sourceforge.net. Unfortunately i had some problems with that. I need help to translate c++ code to PB. The OpenDevice function works fine but I get always 0 when I call the OpenSound function.
Is someone able to help me ?
Thanks ....WolfgangS
OpenDevice declarations in audiere.h
Code: Select all
/**
* Open a new audio device. If name or parameters are not specified,
* defaults are used. Each platform has its own set of audio devices.
* Every platform supports the "null" audio device.
*
* @param name name of audio device that should be used
* @param parameters comma delimited list of audio-device parameters;
* for example, "buffer=100,rate=44100"
*
* @return new audio device object if OpenDevice succeeds, and 0 in case
* of failure
*/
inline AudioDevice* OpenDevice(
const char* name = 0,
const char* parameters = 0)
{
return hidden::AdrOpenDevice(name, parameters);
}
OpenSound declarations in audiere.h
Code: Select all
* @param device AudioDevice in which to open the output stream.
*
* @param source SampleSource used to generate samples for the sound
* object. OpenSound takes ownership of source, even
* if it returns 0. (In that case, OpenSound immediately
* deletes the SampleSource.)
*
* @param streaming If false or unspecified, OpenSound attempts to
* open the entire sound into memory. Otherwise, it
* streams the sound from the file.
*
* @return new output stream if successful, 0 otherwise
*/
inline OutputStream* OpenSound(
const AudioDevicePtr& device,
const SampleSourcePtr& source,
bool streaming = false)
{
return hidden::AdrOpenSound(device.get(), source.get(), streaming);
}
Code: Select all
#getName= #20
Debug 1
device.l=OpenDevice(@"directsound",@"buffer=100,rate=44100")
If device.l=0
MessageRequester("","Error open Device",0):End:EndIf
Debug PeekS(CallDX(#getName,device.l)) ; = debug device->getName() ... wow, looks cool ;)
; the above line works fine. It shows "directsound"
Debug 2
sound.l=OpenSound(device.l,@"E:\@Projekte\Audiere Player\04_Shadows_Of_Mine.mp3",#True)
If sound.l=0 ; Unfortunately sound.l is always 0 :cry:
MessageRequester("","Error OpenSound",0):End:EndIf
Debug 3