PDA

View Full Version : Delphi Audio Library..



Voltrox
26-09-2006, 04:12 AM
Hello,

I am looking for a very easy to use, but good Audio Library for Delphi, but NOT FMOD NOR Audiolab, lol, those were horrible and I couldn't get FMOD working.

Could someone help me find a library or component/component suite that I could use to enable me to play audio and video files in Delphi?

Thank you very much.

I've been trying to make this Media Player for a very long time now and haven't succeeded.

Zenophran
26-09-2006, 06:11 AM
I've used openal before, it seemed to work ok. Have you tried it?

JSoftware
26-09-2006, 07:43 AM
Delfi has made one which sounds pretty nice

JernejL
26-09-2006, 10:20 AM
see:
http://www.pascalgamedevelopment.com/forums/viewtopic.php?t=3503&postdays=0&postorder=asc&start=0

it is not complete, but works great so far when testing.

cairnswm
26-09-2006, 11:36 AM
JEDI-SDL includes SDL_mixer.

Voltrox
26-09-2006, 01:23 PM
I've tried OpenAl before, it didn't work, I can't reemember what happened :(


I'm going to try Delfi's.

But is there anything easy to use that's good?

I've tried a few and can't seem to find anymore :(

Voltrox
26-09-2006, 01:30 PM
Ok, i'm trying OpenAl again.

I ran the installer and all I see is OpenALWEAX.exe, and nothing else, how do i use it?

JernejL
26-09-2006, 02:40 PM
Ok, i'm trying OpenAl again.

I ran the installer and all I see is OpenALWEAX.exe, and nothing else, how do i use it?

try my wrapper to use openal, but if you want raw openal you need noeska's pascal headers: http://www.noeska.com/doal/

Voltrox
26-09-2006, 03:07 PM
I tried Delfi's and I can't get it to work, it's beyond me...

Any suggestions on an easy to use good Audio Library?

WILL
26-09-2006, 03:31 PM
Now here is a man on a quest for knowlage. Nice to see. :)

I'd recommend using Noeska's (Official?) OpenAL translated headers. They are extremely easy to use I found and the demos on his sight provide perfect examples on how to use it. (Again very simple and 3D capable with little or no effort!)

Nitrogen
26-09-2006, 05:10 PM
There's also an audio library known as Bass:

http://www.un4seen.com/

It's pretty similar to FMOD, but easier to use :)

Voltrox
26-09-2006, 06:37 PM
Ok, I have Bass now, but I see several folders and none of them say anything like "play mp3's" how do I set it up in Delphi?

Does it use components?

Or do I have to do the uses thing?

Thanks.

Nitrogen
26-09-2006, 08:25 PM
From the website:

C/C++, Delphi, Visual Basic and MASM APIs are provided, with several examples to get you started

Just look for one of the example programs, it should have a delphi example with sourcecode.

You have to do the 'uses' thing...

Voltrox
26-09-2006, 08:26 PM
I did, and I didn't understand it.

I need to learn how it's done, and I don't see any tutorials that show me how to do it in Delphi.

Could someone show methe simplest example of how to play an MP3 file in BASS but without all the extra things in the basstest example...


thanks.

JernejL
26-09-2006, 09:45 PM
I did, and I didn't understand it.

I need to learn how it's done, and I don't see any tutorials that show me how to do it in Delphi.

Could someone show methe simplest example of how to play an MP3 file in BASS but without all the extra things in the basstest example...


thanks.

you can take a look at glscene, it has sound examples including mp3s..

Voltrox
27-09-2006, 04:05 AM
Ok, Thanks.

Well I am currently trying to implement BASS in my project, but it's not working.

unit UHXDMMPLAY1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Bass, jpeg, ExtCtrls, Buttons;

type
TForm2 = class(TForm)
Image1: TImage;
FPATHTE1: TEdit;
BTPLAYSTRM1: TSpeedButton;
PSTRM1: TSpeedButton;
STSTRM1: TSpeedButton;
MMFLSTB1: TListBox;
procedure FormCreate(Sender: TObject);
procedure BTPLAYSTRM1Click(Sender: TObject);
private
mods: array[0..128] of HMUSIC;
modc: Integer;
sams: array[0..128] of HSAMPLE;
samc: Integer;
strs: array[0..128] of HSTREAM;
strc: Integer;
public
{ Public declarations }
end;

var
Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.BTPLAYSTRM1Click(Sender: TObject);
var i: integer;
var f: PChar;
begin


i := MMFLSTB1.ItemIndex;

// Play the stream from the beginning
if i >= 0 then
BASS_ChannelPlay(strs[i], True);
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
modc := 0; // music module count
samc := 0; // sample count
strc := 0; // stream count

// check the correct BASS was loaded
if (HIWORD(BASS_GetVersion) <> BASSVERSION) then
begin
MessageBox(0,'An incorrect version of BASS.DLL was loaded',0,MB_ICONERROR);
Halt;
end;

// Initialize audio - default device, 44100hz, stereo, 16 bits
if not BASS_Init(-1, 44100, 0, Handle, nil) then
begin
Error('Error initializing audio!');
end;

end;

end.

Could someone please help me?

Thank you.

Relfos
27-09-2006, 02:26 PM
My LEAF2 engine has some easy to use audio objects(WAV & OGG). Its portable and built on top of OpenAL. Also theres video support (AVI).
Check out the tutorials, and see for yourself if it is what you need :wink:

bigsofty
27-09-2006, 02:55 PM
My LEAF2 engine has some easy to use audio objects(WAV & OGG). Its portable and built on top of OpenAL. Also theres video support (AVI).
Check out the tutorials, and see for yourself if it is what you need :wink:

Is their a source version of you engine available?

Ian

Relfos
28-09-2006, 04:52 PM
Not yet, but I can send you the source if you want. Note that it doesnt support MP3, but supports OGG instead, a similar patent free format.

Voltrox
29-09-2006, 03:49 AM
Could someone show me how to use Bass?

Voltrox
13-10-2006, 09:37 PM
How do I convert the time in Bass from the 4594554 to the regular 3:46:00 ?

Voltrox
14-10-2006, 05:56 PM
Leaf didn't work, it gave me several undeclared identifier messages.

JernejL
14-10-2006, 08:05 PM
Leaf didn't work, it gave me several undeclared identifier messages.

what kind of messages?

Voltrox
14-10-2006, 10:43 PM
It says "GLScene.inc not found"


So I copied it from the source folder in to the Delphi 2005 folder, and it installed, but I don't see any video out components, only AVI record


what do I do?

Relfos
15-10-2006, 06:38 PM
Are you talking about my LEAF engine? You're probably made some mistakes, and mixed some file from others engines, since that message "GLScene.inc not found" is probably caused from some GLScene file, and not from LEAF.

Note that LEAF uses some common libraries like DirectX and JPG that you may have installed from other sources, and that may cause problems.
About the components, its true that you wont find anything, because LEAF is not a component based library. One of the tutorials in my site show how to play video from files.

Also, if you're trying to use GLScene, I dont think it includes AVI playback, only recording, at least the last version I used didnt have one.

Lowercase
15-10-2006, 09:04 PM
I tried OpenAL, and I think it's pretty cool with Opengl.

But There's something I still haven't understood (I tried googling without success) :

* You can play Ogg music

* You can play Wave samples

In all the examples i've seen, the sound buffers are generated at the same time, some times using an array. But how can I load sound for a particulary event ?

for example :

playing another music when the current one has ended
[/list]

WILL
15-10-2006, 09:44 PM
Get the headers at: http://www.noeska.com/doal/

Then click on the Tutorials (http://www.noeska.com/doal/tutorials.aspx) link.

Lowercase
16-10-2006, 11:42 AM
[quote="WILL"]Get the headers at: http://www.noeska.com/doal/

Then click on the Tutorials (http://www.noeska.com/doal/tutorials.aspx) ]

It's exactly what I've done.

I'm just trying to understand how buffers are working.

Do you need to create all your buffer in the same time or can you generate some buffer when you need them ?

tpascal
16-10-2006, 03:58 PM
OpeanAl is a low level api for play sound samples in allocated soundbuffers; it dosent have procedures for open and play OGG or MP3 files automatically; it allow to open a WAV file automatically but that is most like an utility procedure; it is not compared to libs like FMod where you just pass the file name and the play the sound.

In OpenAL the users is responsable for Open the sound files, like a OGG or MP3, or big WAV files, then you allocate one or more sound buffers with openal, then the user is responsable to extract a chunk of the sound from compressed Ogg or MP3 in uncompresed sample sound data into the alocated sound buffer; then you can play, stop, pause, rewind, etc the sound buffer; you can play several sound buffers at the same time.

OpenAL allow you to check the current sound buffers state, mean it tells you if the sound buffer is curently playing, paused, stoped, or finished, it also tells you the current position of the sample been played; that info is usuful for you for to code a sound manager.

The technique used for play OGG files with OpenAL is:
- you allocate two sound buffer chained, (let's called "front" and "back" sound buffers).
- You load a Ogg file and file and you put about 1 minute of audio data into front and back sound buffers.
- Then you tells Openal to start playing front sound buffers, and when finished then start playing the back buffers.
- meanwhile the soundbuffers are playing you can do somthing else in your app but you have to keep checking the current front buffer state, when the state returns finished then it mean back buffers is now playing, so you have now to load from Ogg another minute of audio and fill again the front buffer; then you move the front buffers back in the chain so now it is a backbuffer and the current playing buffers is now front buffer.
- you keep doing that until all audio in the ogg (or Mp3 or big WAv) is played.

Like you see, OPENAL is not a ready to use sound manager lib, (neither directx sound i thik), you have to code your own sound manager on top of openal.


good luck.

tp.

Firlefanz
30-10-2006, 06:35 AM
Hi!

Maybe this has been asked before.

I am looking for a simple Audio engine, that can play Oggs for Music and also Oggs for SFX, it would be nice if I could set a 3D position for SFX and if I can load and play the SFX from a list.

PS: And it has to be free for commercial use.

I used Audiere last time, it had no positioning but instead of that it was okay.

Thanks,
Firle

JernejL
30-10-2006, 08:52 AM
Hi!

Maybe this has been asked before.

I am looking for a simple Audio engine, that can play Oggs for Music and also Oggs for SFX, it would be nice if I could set a 3D position for SFX and if I can load and play the SFX from a list.

PS: And it has to be free for commercial use.

I used Audiere last time, it had no positioning but instead of that it was okay.

Thanks,
Firle

check out this:

http://www.noeska.com/doal/lesson9.aspx
edit: that extension is not so popularly supported, try this instead:
http://www.delphigl.de/files/OpenAL_OggStream.zip

You can that demo, to use ogg/vorvis with openal, and it can work simutanously with my 3d openal virtual sound manager: http://www.pascalgamedevelopment.com/forums/viewtopic.php?p=25428#25428

Firlefanz
30-10-2006, 09:00 AM
Hi Delfi,

you again lol. :D
Thanks a lot for those links.
But the user won't have to install anything, it is just some DLLs in the programs folder, right?

Can I set 3D position in real time? I will have a look at your sample, thank you :D

Firlefanz
31-10-2006, 07:44 AM
Hi!

So I only need that OpenAL.dll and nothing else?

In the sample I saw there is no code in the FormCreate or FormClose needed?

Just load it and play it, is that right?

Looks pretty simple and the sample sounds very good.

Are there more samples?

I would like to play one OGG file streaming music,
and have a list of SFX OGG files I load one time and play from memory always.

Thanks a lot,
Firle

PS: I found something in another topic: http://www.noeska.com/doal/tutorials.aspx