April 25, 2024, 10:07:52 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


EAE Demo

Started by Ionic Wind Support Team, July 05, 2009, 06:04:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ionic Wind Support Team

July 05, 2009, 06:04:37 PM Last Edit: May 21, 2011, 05:01:41 PM by LarryMc
Just a (smallish) demo of the Emergence Audio Engine in its current state (pre beta), which is actually one of the test programs the beta testers and I have been using to run the library through its paces during development.


it's a bit over 4MB zipped as I included a .wma we use for testing, sorry if you are on a dialup.

Screenshot of the demo attached.

The test program can play a mod and two streams simultaneously.  The channel and spectrum displays currently only work for a few file types, they will be blank for .wma files for example.  We're working on it.

Paul.
Ionic Wind Support Team

chris

okay this is way cool  ;D i can't wait to see the library!

Duffer

Works well on my systems, even my Eee  ;D

Ionic Wind Support Team

Good to know ;)

Another FYI...the spectrum display is taking most of the CPU usage, since the test program is updating it 10 times a second.  Without it cpu usage on my system is 1-2% with all three playing at once. 

Paul.



Ionic Wind Support Team

Ionic Wind Support Team

Attached is an updated demo program with preliminary XM mod support, along with a single .xm for testing.  The test program allows 32 channels now, and the channel VU display is a bit better.

Put it in the same directory as the original demo.

Paul.
Ionic Wind Support Team

Duffer

I will play with this in a bit.

Duffer

July 10, 2009, 10:56:46 AM #6 Last Edit: July 10, 2009, 11:22:20 AM by BriceManuel
Very nice. ;D

*edit*  Works properly on all of my systems (XP SP2) including me Eee.

Ionic Wind Support Team

Here is the source of the demo program, for the reserve purchasers to play with ;)


$include "windows.inc"
window w
pointer m,s1,s2
int c1=-1,c2=-1,modplay=0
float levels[64]
int reverb = 0
OpenWindow w,0,0,575,293,@caption|@minbox|@sysmenu|@hidden,0,"EAE Test",&w_handler
CONTROL w,@STATIC,"MOD file:",9,30,56,20,0,5
CONTROL w,@EDIT,"Edit1",75,24,183,25,0x50800080,10
CONTROL w,@STATIC,"Stream1:",13,66,47,20,0,6
CONTROL w,@EDIT,"Edit2",75,61,183,25,0x50800080,11
CONTROL w,@STATIC,"Stream2:",13,105,52,20,0,7
CONTROL w,@EDIT,"Edit3",75,98,183,25,0x50800080,12
CONTROL w,@STATIC,"Channels",8,163,47,20,0,8
CONTROL w,@SYSBUTTON,"...",266,24,30,25,0x50000000,20
CONTROL w,@SYSBUTTON,"...",266,61,30,25,0x50000000,21
CONTROL w,@SYSBUTTON,"...",266,99,30,25,0x50000000,22
CONTROL w,@SYSBUTTON,"Play",306,24,70,25,0x50000000,30
CONTROL w,@SYSBUTTON,"Play",306,61,70,25,0x50000000,31
CONTROL w,@SYSBUTTON,"Play",306,100,70,25,0x50000000,32
CONTROL w,@CHECKBOX,"Reverb", 390,24,70,20,0,50
int x
for x = 5 to 8
Setfont w,"Ariel",10,400,0,x
SetControlColor w,x,0,w.m_cWindow
next x
for x = 10 to 12
Setfont w,"Ariel",10,400,0,x
next x
for x = 20 to 22
Setfont w,"Ariel",10,400,0,x
next x
for x = 30 to 32
Setfont w,"Ariel",12,400,0,x
next x
'initialize the eae engine
eaSndInit(44100,33,EASND_OUTPUTDSOUND|EASND_ENABLEFFT|EASND_ENABLEDXFX,w.hwnd)
SetControlText(w,10,GetStartPath()+"guitarslinger.mod")
SetControlText(w,11,GetStartPath()+"applause.wav")
SetControlText(w,12,GetStartPath()+"music.wma")
m=eaModLoad(GetStartPath()+"guitarslinger.mod")
s1=eaStreamOpenFile(GetStartPath()+"APPLAUSE.WAV",0,0)
s2=eaStreamOpenFile(GetStartPath()+"music.wma",0 ,0)
'
rect w,75,128,183,100,0,0
starttimer w,100
centerwindow w
showwindow w,@swshow
waituntil IsWindowClosed(w)
end

sub w_handler
string filename
select @message
case @idclosewindow
'stop all sounds
if(m)
eaModStop(m)
eaModFree(m)
endif
if(s1) then eaStreamClose(s1)
if(s2) then eaStreamClose(s2)
'free memory
'close the EAE engine
eaSndClose()
Closewindow w
case @idtimer
'ea3DUpdate()
'updated stopped buttons
if(modplay) and !eaModIsPlaying(m)
SetControlText w,30,"Play"
modplay = FALSE
endif
if(c1 > -1) and !eaSndIsPlaying(c1)
SetControlText w,31,"Play"
c1 = -1
endif
if(c2 > -1) and !eaSndIsPlaying(c2)
SetControlText w,32,"Play"
c2 = -1
endif
'update channel display
uint hdc=GetHDC(w),tempdc
uint hbitmap = _CreateCompatibleBitmap(hdc,200,100)
uint memdc = _CreateCompatibleDC(hdc)
uint hbmold = _SelectObject(memdc,hBitmap)
tempdc = w.m_hCacheDC
w.m_hCacheDC = memdc
rect w,0,0,183,100,0,0
float fw = 183/32,r,l,v
for x = 0 to 31
if eaSndIsPlaying(x) or (levels[x] > 0.001f)
eaSndGetCurrentLevels(x,l,r)
if (l>0.001f) and (r>0.001f)
v = (l+r)/2f * 100f
else
v = (l+r) * 100f
endif
if v > levels[x]
levels[x] = v
else
levels[x] = (levels[x] + v) / 2
endif
rect w,x*fw,(100-levels[x]),fw,levels[x],255,rgb(255,240,0)
endif
next x
_bitblt(hdc,75,128,183,100,memdc,0,0,SRCCOPY)
'update spectrum display
'268
rect w,0,0,200,100,0,rgb(0,27,0)
fw = 200/256f
if(modplay) or (c1 > -1) or (c2 > -1)
pointer pSpec = eaSndGetSpectrum()
if(pSpec)
for x=0 to 255
line w,x*fw,100, x*fw, (100-(#<float>pSpec[x] * 100f)), rgb(x,255-x,70)
next x
endif
endif
_bitblt(hdc,268,128,200,100,memdc,0,0,SRCCOPY)
w.m_hCacheDC = tempdc
_SelectObject(memdc,hbmold)
_DeleteObject(memdc)
_DeleteObject(hBitmap)
ReleaseHDC(w,hdc)

case @idcontrol
if @notifycode = 0
select @controlid
case 20
filename = filerequest("Select .MOD file",w,1,"MOD files|*.mod;*.xm|All Files|*.*||","mod",0,GetStartPath)
if(len(filename))
if(m)
eaModStop(m)
eaModFree(m)
m=NULL
SetControlText w,30,"Play"
endif
m = eaModLoad(filename)
if(!m)
MessageBox w,"Unrecognized MOD format","Error"
SetControlText(w,10,"")
EnableControl w,30,FALSE
else
SetControlText(w,10,filename)
EnableControl w,30,TRUE
endif
endif
case 21
filename = filerequest("Select Stream",w,1,"All Files|*.*||","",0,GetStartPath)
if(len(filename))
if(s1)
eaStreamStop(s1)
eaStreamClose(s1)
s1=NULL
c1=-1
SetControlText w,31,"Play"
endif
s1=eaStreamOpenFile(filename,0,0)
if(!s1)
MessageBox w,"Unrecognized Stream format","Error"
SetControlText(w,11,"")
EnableControl w,31,FALSE
else
SetControlText(w,11,filename)
EnableControl w,31,TRUE
endif
endif

case 22
'browse and open a new file
filename = filerequest("Select Stream",w,1,"All Files|*.*||","",0,GetStartPath)
if(len(filename))
if(s2)
eaStreamStop(s2)
eaStreamClose(s2)
s2=NULL
c2=-1
SetControlText w,32,"Play"
endif
s2=eaStreamOpenFile(filename,0,0)
if(!s2)
MessageBox w,"Unrecognized Stream format","Error"
SetControlText(w,12,"")
EnableControl w,32,FALSE
else
SetControlText(w,12,filename)
EnableControl w,32,TRUE
endif
endif

case 30
if (m)
if(eaModIsPlaying(m))
eaModStop(m)
SetControlText w,30,"Play"
modplay = FALSE
else
modplay = TRUE
eaModPlay(m)
SetControlText w,30,"Stop"
endif
endif
case 31
if(c1 > -1)
if(eaSndIsPlaying(c1))
SetControlText w,31,"Play"
eaStreamStop(s1)
c1 = -1
endif
else if(s1)
c1 = eaStreamPlay(-1,s1)
SetControlText w,31,"Stop"
endif

case 32
if(c2 > -1)
if(eaSndIsPlaying(c2))
SetControlText w,32,"Play"
eaStreamStop(s2)
c2 = -1
endif
else if(s2)
c2 = eaStreamPlay(-1,s2)
SetControlText w,32,"Stop"
endif
case 50
reverb = getstate(w,50)
if(reverb)
eaDXFXEnable(EASND_OUTPUTCHANNEL,DXFX_WAVES_REVERB)
else
eaDXFXDisable(EASND_OUTPUTCHANNEL)
endif

endselect
endif
endselect
endsub
Ionic Wind Support Team