PDA

View Full Version : IrrKlang 4 delphi



djoker
21-03-2008, 02:24 PM
hi ppl my new wrapper ;)

irrKlang is a powerful high level API for playing back sound in 3D and 2D applications like games, scientific visualizations and multimedia applications.
irrKlang is free for non commercial use.

irrKlang's current features are:

* Plays multiple file formats, .WAV, .MP3, .OGG, .MOD, .XM, .IT, .S3M...
* Buffered and streamed audio playback, in 2D and 3D.
* High level resource management and autodetection: The engine can do everything for you. Just tell it to play a sound file, and it will load, cache and/or stream sound data for you automaticly, depending on what is best for performance and memory usage. But if you want to specify how the engine should handle this, you can do this as well.
* Sophisticated 3D sound engine designed to be used in games.
* Extendable: Possibility to write own file format readers/decoders to extend the engine with it.
* Sound effects such as the doppler effect for 3D sounds or 2D effects like echo, reverb, distortion, flanger and more.
* Exact seeking and position retrieval in streams and buffered sounds.
* Plugin System: Simply copy external created plugins to the place where irrKlang is being used and extend its functionality with it.
* Multi/Singlethreaded modes: The engine can run both multithreaded or singlethreaded in the same thread as your application, to make it possible to debug your application easier for example.
* Low level audio output manipulation: Possibility to alter any aspect of a playing sound like panning, volume and 3d position.
* Sound event call backs.
* File reading functionality can be overwritten by the user, of course, making it possible to let irrKlang read from own file archives for example.



http://depositfiles.com/files/4257518

http://aycu34.webshots.com/image/47313/2005800123973513985_th.jpg (http://allyoucanupload.webshots.com/v/2005800123973513985)



unit IrrKlang;

interface
uses windows;

const IRRK_DLL='irrKlangFrameWork.dll';
type

KVEC3=record
x,y,z:single;
end;
E_SOUND_OUTPUT_DRIVER=(
ESOD_AUTO_DETECT,//'Autodetects the best sound driver for the system
ESOD_DIRECT_SOUND,//'DirectSound sound outout driver, windows only
ESOD_NULL,//'Null driver, creating no sound output
ESOD_COUNT,//'Amount of built-in sound engine types
ESOD_FORCE_32_BIT = $7fffffff);



E_SOUND_ENGINE_OPTIONS=(
ESEO_MULTI_THREADED = $01,
ESEO_MUTE_IF_NOT_FOCUSED = $02,
ESEO_LOAD_PLUGINS = $04,
ESEO_USE_3D_BUFFERS = $08,
ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER = $10,
ESEO_LINEAR_ROLLOFF = $20,
ESEO_DEFAULT_OPTIONS = ESEO_MULTI_THREADED or ESEO_LOAD_PLUGINS or ESEO_USE_3D_BUFFERS or ESEO_PRINT_DEBUG_INFO_TO_DEBUGGER,
ESEO_FORCE_32_BIT = $7fffffff);





E_STREAM_MODE=(
ESM_AUTO_DETECT = 0,// ' Autodetects the best stream mode for a specified audio data
ESM_STREAMING , // ' Streams the audio data when needed
ESM_NO_STREAMING , // ' Loads the whole audio data into the memory
ESM_FORCE_32_BIT ); // ' compile these enumeration values to 32 bit.


IRRKType=class
end;

ICHANNEL=^IRRKType;
ISOUND=^IRRKType;
IFXS=^IRRKType;





procedure IRRKEngine_Start(driver:E_SOUND_OUTPUT_DRIVER;Opti on:E_SOUND_ENGINE_OPTIONS;scale:single=0.5);cdecl ;external IRRK_DLL;
procedure IRRKEngine_End;cdecl ;external IRRK_DLL;
procedure IRRKEngine_Update;cdecl ;external IRRK_DLL;

function IRRKEngine_AddSoundFromFile(cptrFile:pchar;streamM ode:E_STREAM_MODE;preload:boolean=false):ISOUND;cd ecl ;external IRRK_DLL;
function IRRKEngine_AddSoundFromMemory(memory:pointer;sizeI nBytes:integer;SoundName:pchar;copyMemory:boolean= true):ISOUND;cdecl ;external IRRK_DLL;

procedure IRRKEngine_StopAllSounds;cdecl ;external IRRK_DLL;
procedure IRRKEngine_SetAllSoundsPaused(bPaused:boolean=true );cdecl ;external IRRK_DLL;

function IRRKEngine_IsPlayingEx(const soundName:pchar):boolean;cdecl ;external IRRK_DLL;
function IRRKEngine_IsPlaying(source:ISOUND):boolean;cdecl ;external IRRK_DLL;

procedure IRRKEngine_SetMaxDistance(value:single);cdecl ;external IRRK_DLL;
procedure IRRKEngine_SetMInDistance(value:single);cdecl ;external IRRK_DLL;

procedure IRRKEngine_RemoveSoundEx(SoundName:pchar);cdecl ;external IRRK_DLL;
procedure IRRKEngine_RemoveAllSounds;cdecl ;external IRRK_DLL;

procedure IRRKEngine_SetVolume(volume:single);cdecl ;external IRRK_DLL;
function IRRKEngine_GetVolume:single;cdecl ;external IRRK_DLL;

procedure IRRKEngine_SetListenerPosition(pos,lookdir ,velPerSecond,upVector:KVEC3);cdecl ;external IRRK_DLL;

function IRRKEngine_Play2D (source:ISOUND;playLooped:boolean=false;startPause d:boolean=false;track:boolean=true; enableSoundEffects:boolean=false):ICHANNEL;cdecl ;external IRRK_DLL;
function IRRKEngine_Play2DEx (const SoundName:pchar;playLooped:boolean=false;startPaus ed:boolean=false;track:boolean=true;streamMode:E_S TREAM_MODE=ESM_AUTO_DETECT; enableSoundEffects:boolean=false):ICHANNEL;cdecl ;external IRRK_DLL;
function IRRKEngine_Play3D (source:ISOUND;POS:KVEC3;playLooped:boolean=false; startPaused:boolean=false;track:boolean=true; enableSoundEffects:boolean=false):ICHANNEL;cdecl ;external IRRK_DLL;
function IRRKEngine_Play3DEx (const SoundName:pchar;POS:KVEC3;playLooped:boolean=false ;startPaused:boolean=false;track:boolean=true;stre amMode:E_STREAM_MODE=ESM_AUTO_DETECT; enableSoundEffects:boolean=false):ICHANNEL;cdecl ;external IRRK_DLL;
//************************************************** ******************************+
//************************************************** ******************************+
//************************************************** ******************************+
//************************************************** ******************************+
procedure IRRKSound_Drop (Sound:ICHANNEL);cdecl ;external IRRK_DLL;
procedure IRRKSound_Stop (Sound:ICHANNEL);cdecl ;external IRRK_DLL;
function IRRKSound_IsPaused (Sound:ICHANNEL):boolean;cdecl ;external IRRK_DLL;
function IRRKSound_IsFinished (Sound:ICHANNEL):boolean;cdecl ;external IRRK_DLL;
procedure IRRKSound_Pause (Sound:ICHANNEL;value:boolean);cdecl ;external IRRK_DLL;
procedure IRRKSound_SetVolume (Sound:ICHANNEL;value:single);cdecl ;external IRRK_DLL;
procedure IRRKSound_SetPan (Sound:ICHANNEL;value:single);cdecl ;external IRRK_DLL;
procedure IRRKSound_SetMinDistance (Sound:ICHANNEL;value:single);cdecl ;external IRRK_DLL;
procedure IRRKSound_SetMaxDistance (Sound:ICHANNEL;value:single);cdecl ;external IRRK_DLL;
function IRRKSound_SetPlayPosition (Sound:ICHANNEL;value:integer):boolean;cdecl ;external IRRK_DLL;
function IRRKSound_GetPlayPosition (Sound:ICHANNEL ):integer;cdecl ;external IRRK_DLL;
procedure IRRKSound_SetPlaybackSpeed (Sound:ICHANNEL;value:single=1.0);cdecl ;external IRRK_DLL;
function IRRKSound_GetPlayLength (Sound:ICHANNEL ):integer;cdecl ;external IRRK_DLL;
procedure IRRKSound_Set3DPosition (Sound:ICHANNEL; Pos:KVEC3);cdecl ;external IRRK_DLL;
procedure IRRKSound_Set3DVelocity (Sound:ICHANNEL; Vel:KVEC3);cdecl ;external IRRK_DLL;
//************************************************** ******************************+
//************************************************** ******************************+
//************************************************** ******************************+
//************************************************** ******************************+

function IRRKFX_CreateEffect (sound:ISound):IFXS;cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableAllEffects (fx:IFXS);cdecl ;external IRRK_DLL;

function IRRKFX_IsChorusEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsCompressorEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsEchoEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsFlangerEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsGargleEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsReverbEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsParamEqEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;
function IRRKFX_IsWavesReverbEnabled (fx:IFXS):boolean;cdecl ;external IRRK_DLL;


procedure IRRKFX_DisableChorus(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableCompressor(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableDistortion(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableEcho(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableFlanger(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableGargle(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableReverb(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableParamEq(fx:IFXS);cdecl ;external IRRK_DLL;
procedure IRRKFX_DisableWavesReverb(fx:IFXS);cdecl ;external IRRK_DLL;


function IRRKFX_SetChorus(fx:IFXS;
fWetDryMix:single= 50;
fDepth :single = 10;
fFeedback :single = 25;
fFrequency:single = 1.1;
sinusWaveForm:boolean = true;
fDelay:single = 16;
lPhase:integer = 90):boolean;cdecl ;external IRRK_DLL;


function IRRKFX_SetCompressor(fx:IFXS;
fGain :single= 0;
fAttack:single = 10;
fRelease:single = 200;
fThreshold:single = -20;
fRatio:single = 3;
fPredelay:single = 4):boolean;cdecl ;external IRRK_DLL;


function IRRKFX_SetDistortion(fx:IFXS;
fGain:single= -18;
fEdge:single = 15;
fPostEQCenterFrequency :single= 2400;
fPostEQBandwidth:single = 2400;
fPreLowpassCutoff :single= 8000):boolean;cdecl ;external IRRK_DLL;



function IRRKFX_SetEcho(fx:IFXS;
fWetDryMix:single = 50;
fFeedback:single = 50;
fLeftDelay:single = 500;
fRightDelay:single = 500;
lPanDelay:integer = 0):boolean;cdecl ;external IRRK_DLL;



function IRRKFX_SetFlanger(fx:IFXS;
fWetDryMix:single = 50;
fDepth:single = 100;
fFeedback:single = -50;
fFrequency :single= 0.25;
triangleWaveForm:boolean = true;
fDelay:single = 2;
lPhase:integer = 0):boolean;cdecl ;external IRRK_DLL;

function IRRKFX_SetGargle(fx:IFXS;
rateHz:integer = 20;
sinusWaveForm:boolean = true):boolean;cdecl ;external IRRK_DLL;

function IRRKFX_SetReverb(fx:IFXS;
lRoom:integer = -1000;
lRoomHF:integer = -100;
flRoomRolloffFactor:single = 0;
flDecayTime:single = 1.49;
flDecayHFRatio :single= 0.83;
lReflections:integer = -2602;
flReflectionsDelay:single = 0.007;
lReverb:integer = 200;
flReverbDelay :single= 0.011;
flDiffusion:single = 100.0;
flDensity :single= 100.0;
flHFReference :single= 5000.0):boolean;cdecl ;external IRRK_DLL;

function IRRKFX_SetParamEq(fx:IFXS;
fCenter :single= 8000;
fBandwidth :single= 12;
fGain :single= 0):boolean;cdecl ;external IRRK_DLL;

function IRRKFX_SetWavesReverb(fx:IFXS;
fInGain :single= 0;
fReverbMix :single= 0;
fReverbTime :single= 1000;
fHighFreqRTRatio :single= 0.001):boolean;cdecl ;external IRRK_DLL;



function kvec(x,y,z:single):KVEC3;

implementation
function kvec(x,y,z:single):KVEC3;
begin
result.x:=x;
result.y:=y;
result.z:=z;

end;

end.

arthurprs
21-03-2008, 05:37 PM
great :)

savage
22-03-2008, 10:30 AM
great stuff, bumped to news item.

marmin
22-03-2008, 11:21 AM
Looks great, have to try it out.
Edit: Too bad irrklang is not free..

lordzero
22-03-2008, 05:52 PM
do u dont join with frequency on MSN? i never see you online

great work!

thanks man...

lordzero
22-03-2008, 05:58 PM
Looks great, have to try it out.
Edit: Too bad irrklang is not free..


why not free?

Robert Kosek
22-03-2008, 06:27 PM
irrKlang is free for non commercial use. I don't see the trouble. If you're going to make money using someone else's component then there's nothing wrong with him getting a slice. The obsession with "ONLY FREE!" is silly, as I'd like to see you work a 40 hour job for free every week without having millions in the bank.

Either give him a slice, if you want to sell, or do it yourself.

marmin
23-03-2008, 09:19 AM
It just feels wrong to me, To me, it's commercial or not-commercial, not both... But it's very off-topic, so i'll stop it right here. :D

djoker
23-03-2008, 03:10 PM
do u dont join with frequency on MSN? i never see you online

great work!

thanks man...

sim desculpa eu na ligo muito o msn ...
tenho poco temp no pc

djoker
29-03-2008, 08:15 AM
great stuff, bumped to news item.

AND ir4 delphi ???

Luuk van Venrooij
02-04-2008, 09:04 PM
Awsome stuff. Looks easy to use. Might start using this instead of FMod.

Luuk van Venrooij
02-04-2008, 09:04 PM
Awsome stuff. Looks easy to use. Might start using this instead of FMod.