Author Topic: MCI library, (WIN32), All multimedia, Play, Pause, Resume, Stop, Volume  (Read 11603 times)

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1639
  • Particle Hawk
    • View Profile
Play any multimedia, once. Including, midi.
Control any supported multimedia device, including waveform-audio devices, MIDI sequencers, CD audio devices, and digital-video (video playback) devices.
WIN32 only i think.

PAUSE RESUME STOP VOLUME:
NOTE: For compressed files like .avi:
These additional commands, Only work with the MCI_PLAY() command.
These wont work with MCI_PLAYMOVIE(), this one is standalone, see sample in zip file.

Midi/Sound Notes:
MCI_PLAY(filename$,FALSE) // The BOOL(true/false) expression is for movies only, fullscreen option
Midi can only use play and stop.


FOR MORE INFO CHECK THE UPDATE LOG, IT IS POSTED IN MY BLOG!

-Hemlos
PS. if you want more support for this library, let me know, ill add/change/edit.

HERE IS THE SAMPLE AND LIBRARY ZIPPED BELOW, MCI_LIBRARY.ZIP:

[attachment deleted by admin]
« Last Edit: 2008-Oct-29 by Hemlos »
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

momosxp

  • Guest
seems to be win32 only..

when i try to compile it for wiz:

Code: (glbasic) [Select]
compile+link:
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o: In function `__GLBASIC__::MCI_VOLUME(__GLBASIC__::DGStr, float)':
gpc_temp0.cpp:(.text+0x1d8): undefined reference to `mciSendStringA'
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o: In function `__GLBASIC__::MCI_PLAY(__GLBASIC__::DGStr, float)':
gpc_temp0.cpp:(.text+0x330): undefined reference to `mciSendStringA'
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o: In function `__GLBASIC__::MCI_PLAYMOVIE(__GLBASIC__::DGStr, float, float)':
gpc_temp0.cpp:(.text+0x500): undefined reference to `mciSendStringA'
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o: In function `__GLBASIC__::MCI_STOP(__GLBASIC__::DGStr)':
gpc_temp0.cpp:(.text+0x8b8): undefined reference to `mciSendStringA'
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o: In function `__GLBASIC__::MCI_PAUSE(__GLBASIC__::DGStr)':
gpc_temp0.cpp:(.text+0x9d8): undefined reference to `mciSendStringA'
/cygdrive/c/Users/Mohammed/AppData/Local/Temp/cckY43XR.o:gpc_temp0.cpp:(.text+0xaf8): more undefined references to `mciSendStringA' follow
*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren
_______________________________________
*** Fertig ***
Dauer: 2.7 sek. Zeit: 18:53
Erstellen: 0 erfolgreich.
*** 1 FEHLGESCHLAGEN ***

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10746
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
MCI is windows, only. Try PLAYMUIC for Wiz.


Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10746
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
play with the sample rate. The Wiz can play ogg and mp3.

momosxp

  • Guest
yes ogg and mp3 work on wiz but ogg crashes the wiz after 3 played ogg (not played on same time) files and mp3 stutters

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1639
  • Particle Hawk
    • View Profile
yes ogg and mp3 work on wiz but ogg crashes the wiz after 3 played ogg (not played on same time) files and mp3 stutters

That sounds like memory issues.
1. Try setting your sample rate, lower....to use less compression. This will reduce the size of the file.
2. Are you using buffers # in the project options? if you are, try using 0.
3. Are you reusing the original memory slot and loading the new song in the old memory position?

Sound/Music is an age old problem, Escpecially with machines getting smaller, and music files getting bigger.
This is why midi was introduced ages ago, and now, for obvious reasons, it is actually desireable.
Unfortunetly you dont have access to these solutions with a WIZ, so you will need to dive into the problem at the rawest levels...sound compression, memory/buffer allocation, and reusing the memory.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

MrTAToad

  • Guest
Does FMOD work on the WIZ ?

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10746
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
no. On the wiz I use SDL_mixer for sound. It really should work.
I can try changing some of the buffer parameters if there's really that much problems. But Ian had music in his game and it played nicely.
His settings were:
ogg/vorb, stereo, 22050Hz, Bit rate 88kb/s.

momosxp

  • Guest
i don't think it's a memory problem. The whole game (including exe + gpe file) has 6,5mb.
But how to use Buffers? And how to reuse the memory with playmusic?
Now i just use it like this

Code: (glbasic) [Select]
newmusic:
if blabla 1
 stopmusic
 playmusic ""
 playmusic "bla1.mp3"
elseif blabla 2
 stopmusic
 playmusic ""
 playmusic "bla1.mp3"
endif

Offline Hemlos

  • To boldy go where no pixel has gone before!
  • Global Moderator
  • Prof. Inline
  • *******
  • Posts: 1639
  • Particle Hawk
    • View Profile
Does that work momo? Or is it still problems?

Post your song as an attachment here.
Volume_of_Earth(km^3) = 4/3*3.14*POW(6371.392896,3)

momosxp

  • Guest
mp3 still stutters.. tried even with 16bit rate (doen't even play) and 32bit stutters a bit.. but still stutters and in some levels there are problems with the whole game performance because of that.

Tried ogg again with low quality and it works now. The 4 Soundfiles for Backgroundmusic are as big as the half size of the game but it works. That counts now.

Thanx for help :)

But i think that's a basic problem of GLBasic. Sound is a very important thing for Game Development.
And GLBasic adverts with Multiplatform compatibility. So it should have full compatibility for mp3 or at least for midi on WIZ/GP2X.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10746
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Well, what should I do? Others have the same limitation. I'm just using the SDL library.
I'll see if others initialize with a bigger/smaller buffer, though. But I really remember that I tweaked these values for a whole day, since playing WAV did stutter otherwise. The sound output of the Wiz is, well, sub-optimal.

momosxp

  • Guest
Ohh i know that it's not that easy fixing that. But i only wanted to say that it should be fixed as fast as possible :)

But now i have to say sorry because ogg is really working well now. The filesize is bigger than mp3 or midi. But because of the crashs.. it only crash on my computer. I don't know why. On WIZ it's working well. I think i have some codec problems on winvista with ogg. But now i split it up in two projects.
One with mp3 for pc and one with ogg for wiz/gp2x.
What's about sound on GP2X. I don't own one. I think i have to look for some betatesters before uploading the gp2x version to filearchiv :)

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4158
  • On the shoulders of giants.
    • View Profile
    • My Apps
I have .ogg codec problems on my laptop under XP - I can't hear a thing. Works fine on my main pc and Wiz though.
I came. I saw. I played.