Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
148 user(s) are online (135 user(s) are browsing Forums)

Members: 2
Guests: 146

LiveForIt, trixie, more...

Support us!

Headlines

 
  Register To Post  

*Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
Hi,

I encounter a problem on which I have no solution.
Due to the structure of the AmiDARK Engine, audio is defined this way :

1. Function to load an object : DELoadSound( File, ID )
2. Function to play/pause/resume/stop object : DEPlaySound( ID ), DEPauseSound( ID ), DEResumeSound( ID ), DEStopSound( ID )
3. Function to delete object : DEDeleteSound( ID )

I can load an audio using datatype, delete it without problem.
The problem is when I want to play it.
I copy the functions there to show you :

Quote:

void DELoadSound( char *szFilename, int iID ){
// ULONG res;
// uint32 longueur ;
if ( iID > 0 ){
if ( iID < 257 ){
if ( DESoundExist( iID ) == 0 ){
if( DEFileExist( szFilename ) == TRUE ){
AESound[ iID ].ObjectPTR = IDataTypes->NewDTObject( (STRPTR)szFilename,
DTA_SourceType, DTST_FILE,
DTA_GroupID, GID_SOUND,
SDTA_Volume, 63,
// SDTA_SignalTask, (ULONG)IExec->FindTask(NULL),
// SDTA_SignalBitMask, END_SOUND_SIGNAL,
TAG_END );
if ( AESound[ iID ].ObjectPTR != NULL ){
AESound[ iID ].Exist = TRUE;
AESound[ iID ].Loop = FALSE;
AESound[ iID ].Playing = 0;
AESound[ iID ].FileName = LCreateString( 256 );
LCopyString( szFilename, AESound[ iID ].FileName );
AESound[ iID ].Audio3D = 0 ; // This sound IS NOT a 3D Audio sound.
}else{
printf( "DELoadSound Warning : Object not created\n" );
AESound[ iID ].Exist = FALSE;
}
}
}
}
}
}

void DEPlaySound( int iID ){
if ( DESoundExist( iID ) == 1 ){
if ( AESound[ iID ].Playing != 0 ){
DEStopSound( iID );
}
mydtt.MethodID = DTM_TRIGGER;
mydtt.dtt_GInfo = NULL;
mydtt.dtt_Function = STM_PLAY;
mydtt.dtt_Data = NULL;
AESound[ iID ].dores = IDataTypes->DoDTMethodA( AESound[ iID ].ObjectPTR, NULL, NULL, (Msg)&mydtt );
IExec->Wait( SIGBREAKF_CTRL_C );
AESound[ iID ].Playing = 1;
}
}


So, everything compiles ok in the libAmiDARK.a file.
When I use these functions from a fresh project (that'll use the libAmiDARK.a lib), here is the problem I encounter.

1. With the line "IExec->Wait( SIGBREAKF_CTRL_C );" removed : No audio playback.
2. With the line "IExec->Wait( SIGBREAKF_CTRL_C );" not revmoed : audio playbak but program lock infinitely. and I cannot quit the application nor doing anything from the moment the sample started to play.

Here the source code I use to test the DEPlaySound function :
Quote:

#include "libamidark.h"
int InKey;
void DarkLoop( void ){
// Setup Display.
DESetDisplayMode( 640, 480, 32 );
DESyncOn();
DESyncRate( 60 );
// Load the 4 samples using DataTypes.
DELoadSound( "Medias/oceanwave.wav", 1 );
DELoadSound( "Medias/break.wav", 2 );
DELoadSound( "Medias/DREAM.WAV", 3 );
DELoadSound( "Medias/electricarc.wav", 4 );
DELoadImageEx( "Medias/AmiDARK_Engine_Logo v2.png", 1, 1 );
InKey = 0;
while( !DELoop() ){
DECls();
DESetCursor( 0, 0 );
DEPrint( "AmiDARK Engine now play Audio Sounds using DATATYPES" );
DEPrint( "Press default QUIT KEY to stop this demonstration example." );
DEPrint( " " );
DEPrint( "Press 1 to play OceanWave.wav" );
DEPrint( "Press 2 to play Break.wav" );
DEPrint( "Press 3 to play Dream.wav" );
DEPrint( "Press 4 to play ElectricArc.wav" );
// Keyboard key 1 to 4 start replay of a sound.
InKey = DEScancode(); InKey--;
if ( InKey > 0 ){
if ( InKey < 5 ){
DEPlaySound( InKey );
}
}
DEPasteImageEx( 1, DEBitmapWidth( 0 ) - ( DEImageWidth( 1 ) + 4 ), 4, 1 );
DESync();
}
// We delete sounds from memory.
for ( InKey = 0; InKey < 5; InKey++ ){
DEStopSound( InKey );
DEDeleteSound( InKey );
}
}

As you can see, I load 4 samples.
when you press a key from 1-4 it start play a sample.
So, due to this way of working, I cannot use Wait functions to wait the sound finished.
(do you see in a game a ship fire a projectyle and the game pause until the sound is finished ? :p)
So, Does someone have an idea on how I can fix this problem ?

Thank you.

Kindest Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: *Urgent* Need help for audio datatype.
Home away from home
Home away from home


See User information
Looks to me like your sound is stopping straight away as you just fall straight through to stopsound

I woudn't use dataypes to play the sound myself, just to load it. Use AHI directly to play it, much more control.

check the aweb source on os4depot look at aweb/soundcopy.c


Go to top
Re: *Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
BroadBlues,
Yes, but AHI is far more complex to use and I don't understand how I can do all the needed functions ( DELoadSound, DEStopSound, DEPauseSound, DEResumeSound, DeDeleteSound ) using AHI directly.
I tried but ... all DOCS are in English ... and English is not my native language ... this makes things a bit harder ...
And I didn't find how to do all these...
So I am obliged to use DataTypes ... no other solution

Kindest Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: *Urgent* Need help for audio datatype.
Home away from home
Home away from home


See User information
@AmiDARK

When I wrote the Composite3DDemo, I used OpenAL for playing sounds, and libAIFF for loading (I only used AIFF files, so that was fine). This was easier than using AHI directly, and writing my own audio routines. OpenAL can do all of the things that you want, so it's an option that is worth considering.

BTW, one major downside of audio datatypes is that they only provide 8-bit audio data. The audio datatype specification was never updated to allow modern 16/32-bit sounds let alone surround sound (i.e., audio with more than two channels).

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: *Urgent* Need help for audio datatype.
Just popping in
Just popping in


See User information
@AmiDARK:

I could explain AHI to you by email, if you like. May take some time, but in the end youre able to use AHI and do sound coding at a higher level.

I used AHI sound for AmijeweledRTG, and after some experimentation, it was quite easy to use for simple playback of sounds (multichannel, btw.).

The advantage of using AHI is that youre able to play, interrupt and stop sounds (even modify, if you dare to use the library interface of AHI) at any time.

And yes, you could wait for a sound finished. But with action in the meantime

@Hans:

So it is time for an updated sound.datatype, isnt it?

Go to top
Re: *Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
Hans, thank you for your answer, I will take a look at this library but it may make a "generic engine" support only 1 audio file format ... that's not top :(.

Whose, I send you a PM with my e-mail informations.
Thank you for your help proposal :)

Kindest Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: *Urgent* Need help for audio datatype.
Just can't stay away
Just can't stay away


See User information
@whose

If you agree, we could put the text you are about to write into the SDK so that it will help all developers.

If you agree, tell me and Amidark will send me the file.

Philippe 'Elwood' FERRUCCI
Sam460ex 1.10 Ghz
http://elwoodb.free.fr
Go to top
Re: *Urgent* Need help for audio datatype.
Home away from home
Home away from home


See User information
@whose

Quote:

whose wrote:
So it is time for an updated sound.datatype, isnt it?


Yes, it is. Actually, someone already wrote a prototype years ago (link), but it was never made official. Until it's the official new standard, it's next to useless for app/game developers.


@AmiDARK
Quote:
Hans, thank you for your answer, I will take a look at this library but it may make a "generic engine" support only 1 audio file format ... that's not top :(.


There are libraries for loading other formats on os4depot too. There are, for example, mp3 and ogg-vorbis decoder libraries. OpenAL itself doesn't support any file formats, so you will always need external audio file handlers.

You can use the 8-bit sound data loaded using datatypes with OpenAL. It's just sad that you won't be able to load full-quality 16-bit+ audio with datatypes.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: *Urgent* Need help for audio datatype.
Just popping in
Just popping in


See User information
@elwood:

Well, Im no AHI expert, that is I dont know if my knowledge of AHI is deep enough to make up some SDK-quality documentation and examples. I will try my best, and if it suits for SDK documentation/examples, youre free to use it for this purpose.

I tried to understand the AHI examples and managed to use AHI for AmijeweledRTG at last. And I made some tests using AHIs library interface. They were successful. So I think I understand AHI good enough to explain the simple things about it

@Hans:

It seems that it didnt become standard because nothing has happened after the alpha release?

Do you know if theres any chance to get the source code of this work to improve it in a way that it will become standard in the near future? Datatype is a (still) nice system for the handling of all computer art related data, and it should support modern hardware for sound, too...

Go to top
Re: *Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
Hans, I understand.
Sad to see that efforts made for Datatypes evolution were never considered as officials ... :(
I second Whose concerning the source code of this project.

Whose, thank you for all your informations :)

I've sent an e-mail to the author (his domain is now http://www.droolsoft.co.uk/ so his e-mail may be changed as the one in os4depot is wrong nog (it was previously .ltd.uk domain ... ) )

Kindest Regards,
AmiDARK

All we have to decide is what to do with the time that is given to us.
Go to top
Re: *Urgent* Need help for audio datatype.
Home away from home
Home away from home


See User information
Quote:

whose wrote:

Do you know if theres any chance to get the source code of this work to improve it in a way that it will become standard in the near future? Datatype is a (still) nice system for the handling of all computer art related data, and it should support modern hardware for sound, too...


You'd have to email its author. If he's prepared to give the OS4 dev team the source-code, then it could still become an official standard.

Hans

Join Kea Campus' Amiga Corner and support Amiga content creation
https://keasigmadelta.com/ - see more of my work
Go to top
Re: *Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
Hans,

As I said :
I've sent an e-mail to the author (his domain is now http://www.droolsoft.co.uk/ so his e-mail may be changed as the one in os4depot is wrong nog (it was previously .ltd.uk domain ... ) )

Already done ;)
Waiting for an answer.

All we have to decide is what to do with the time that is given to us.
Go to top
Re: *Urgent* Need help for audio datatype.
Just popping in
Just popping in


See User information
@AmiDARK:

Have a look at os4depot, too. Theres is some datatype example code in the upload queue right now. It might help you understanding the messaging system of AmigaOS in conjunction with sound.datatype.

@Elwood:

I believe youre interested in some explanation of AHI double buffered replay, too? Thats a part I used myself, too (with InsanePlaya, a CD player). It was a quite complex task, as I used a separate player process and the messaging grew into a message mess, but I think I understood the concepts...

Go to top
Re: *Urgent* Need help for audio datatype.
Just can't stay away
Just can't stay away


See User information
If you want to use the datatype_sound_signal on upload queue of OS4Depot.
Please use the datatype_sound_signal____1____.lha.
Because I reuploaded it few minutes ago, it had a bug (thank Thomas Rapp for the resolution).

Nevertheless, AmiDark still shows this source on french site amiga-ng.org and it was not OK for him.

I'm interrested too by your AHI samples, impatient to read this in the wiki !

Go to top
Re: *Urgent* Need help for audio datatype.
Just can't stay away
Just can't stay away


See User information
@whose

Quote:
I dont know if my knowledge of AHI is deep enough to make up some SDK-quality documentation and examples.

We'll see
and other developers will have a look at it and improve on it. If required of course

Philippe 'Elwood' FERRUCCI
Sam460ex 1.10 Ghz
http://elwoodb.free.fr
Go to top
Re: *Urgent* Need help for audio datatype.
Just can't stay away
Just can't stay away


See User information
@Hans

Quote:

There are libraries for loading other formats on os4depot too. There are, for example, mp3 and ogg-vorbis decoder libraries.


To add to this I'm going to upload an updated port of libsndfile soon. This library supports reading and writing a lot of sound formats.

Quote:

You can use the 8-bit sound data loaded using datatypes with OpenAL. It's just sad that you won't be able to load full-quality 16-bit+ audio with datatypes.


If you look in the latest public SDK in SDK:Include/include_h/datatypes/soundclass.h there is actually:
Quote:

/* (UBYTE) The actual bitrate of the sample. 8, 16 or 32. New in 53.2 */
#define SDTA_BitsPerSample (SDTA_Dummy + 18)


Don't expect too many subclasses to support it yet though. I haven't updated any of mine to use it yet.


Go to top
Re: *Urgent* Need help for audio datatype.
Quite a regular
Quite a regular


See User information
Thank you Salass00.
Will check this.

Kindest Regards,

All we have to decide is what to do with the time that is given to us.
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project