Hi!!
I have a little problem with datatypes: I don't know how to play a sound sample with datatypes. I have been testing without any result.
I tried with this source:
APTR obj;
struct Library *DataTypesBase;
DataTypesBase = OpenLibrary("datatypes.library",0);
obj = NewDTObject("ram:lolo",DTA_GroupID,GID_SOUND,TAG_DONE);
if (!obj) return;
DoDTMethod(obj,NULL,NULL,DTM_TRIGGER,0,STM_PLAY,TAG_DONE);
DisposeDTObject(obj);
CloseLibrary(DataTypesBase);
In Ram: i have a sample file called 'lolo'
If someone can help me, if it is posible with a working source example I will be very grateful O:-)
--
Greetings, Pep
====================================================================
____
AMIGA / / / HTTP: www.redestb.es/personal/multitaskers/
____ / / / *IRC: MetalGear or Pep*
\ \ \/ / / *E-mail: pep-mu...@redestb.es*
\ \/ / / *josepru...@geocities.com*
\/_/_/ SPANISH-CATALAN A.T.O. TRANSLATOR
Using Amiga 4000/040, 18Mb Ram, 1Gb HD, CyberVision64, VLAB, CD-ROM
====================================================================
--
Greetings, Pep
====================================================================
____
AMIGA / / / HTTP: www.redestb.es/personal/multitaskers/
____ / / /
>I have a little problem with datatypes: I don't know how to play a sound
> sample with datatypes. I have been testing without any result.
>I tried with this source:
> APTR obj;
> struct Library *DataTypesBase;
> DataTypesBase = OpenLibrary("datatypes.library",0);
> obj = NewDTObject("ram:lolo",DTA_GroupID,GID_SOUND,TAG_DONE);
> if (!obj) return;
> DoDTMethod(obj,NULL,NULL,DTM_TRIGGER,0,STM_PLAY,TAG_DONE);
> DisposeDTObject(obj);
> CloseLibrary(DataTypesBase);
>In Ram: i have a sample file called 'lolo'
>If someone can help me, if it is posible with a working source example I will
>be very grateful O:-)
I haven't looked closely at your source, but it seems you have done the same
mistake I once did.. The sound is played asynch, so you are disposing your dt
obj before it gets a chance to make a sound.. Try inserting a Delay(xxx) after
the DoDTMethod() call.
T r o e l s W a l s t e d H a n s e n
tro...@stud.cs.uit.no - http://www.cs.uit.no/~troels
>I haven't looked closely at your source, but it seems you have done the same
>mistake I once did.. The sound is played asynch, so you are disposing your dt
>obj before it gets a chance to make a sound.. Try inserting a Delay(xxx) after
>the DoDTMethod() call.
Or see http://www.execpc.com/~innuendo/amiga/os/datatypes/src/Playsound.c
to find out how to wait for the sound to finish. :-)
--
Jonathan Gapen <no spam, please>
Some lead. Others follow. I'm lost.
>I have a little problem with datatypes: I don't know how to play a sound sample with datatypes. I have been testing without any result.
>I tried with this source:
> APTR obj;
> struct Library *DataTypesBase;
> DataTypesBase = OpenLibrary("datatypes.library",0);
> obj = NewDTObject("ram:lolo",DTA_GroupID,GID_SOUND,TAG_DONE);
> if (!obj) return;
> DoDTMethod(obj,NULL,NULL,DTM_TRIGGER,0,STM_PLAY,TAG_DONE);
> DisposeDTObject(obj);
> CloseLibrary(DataTypesBase);
Everything is correct except that DisposeDTObject causes the sound to
stop immediately. In NewDTObject, you need to tell it to signal you
when it has finished playing, and then do a Wait() on it.
obj = NewDTObject("ram:lolo",DTA_GroupID,GID_SOUND,SDTA_SignalTask,
(ULONG)FindTask(NULL),SDTA_SignalBit,(ULONG)SIGBREAKF_CTRL_D,
TAG_DONE);
if (NULL != obj)
{
/* Play the sound */
DoMethod(obj, DTM_TRIGGER, NULL, STM_PLAY, NULL);
Wait (SIGBREAKF_CTRL_D);
/* Get rid of the object */
DisposeDTObject (obj);
} /* if NewDTObject() suceeded */
I have just uploaded version 1.2 of my own sound datatype player to
aminet, as mus/play/PlayDT.lha.
Regards,
Tak
TT> obj = NewDTObject("ram:lolo",DTA_GroupID,GID_SOUND,SDTA_SignalTask,
TT> (ULONG)FindTask(NULL),SDTA_SignalBit,(ULONG)SIGBREAKF_CTRL_D,
TT> TAG_DONE);
SignalTask and SignalBit are V40+, so if you want to be compatible with 3.0 you
should ask datatype the length of the sound, open the timer.device, send a
timerequest as long as the sound and wait for it...
Ciao,
Gabry (ggr...@iol.it)