Dark Bit Factory & Gravity
PROGRAMMING => Freebasic => Topic started by: slippy on June 09, 2007
-
Hey dudes,
I finally found some time to finish a first releaseable (still kinda beta) version of my OSMEngine ... find attached a package with some samples, the library and a readme ... O0
Have fun using it ...
As always - any comments are welcome and appreciated ... :||
Cheers,
SLiPPY
-
Works very nicely for me here on Vista! Have some karma!
Jim
-
slippy773 , did not work in my system , XP SP2.
-
Worked here, XP SP2, really really excellent work, have some Karma! I'm gutted that I never included this in the last newsletter!
Once question... How easy to one file it all into the finished product if something like bin2bas was used to convert the fc song?
-
Heh, sorry I just realised that you'd included an example of that already!
-
thanks for your comments so far ...
@emil_hamil: what exactly did you do? and what version of DirectX have you installed?
... just realized that there are some problems with proper looping of some of the musics ... gonna fix it asap :)
cheers,
SLiPPY
-
Ah, well I have been playing with this a little, it's really good Slippy, well done mate!
But...
' simple in-mem test
#include "osmereplayer.bi"
#include "media/dthings.bi"
#define ptc_win
#include "tinyptc.bi"
#include "windows.bi"
dim shared buffer(640*480) as uinteger
IF (PTC_OPEN("WWW.DEFACTO2.NET",640,480)=0) THEN
END-1
END IF
dim shared info as osme_music_info_t
playOSMEMusicMem(@zaxxs(0), 1007, 1)
info = getOSMEMusicInfo()
print "Now playing " + info.title + " by " + info.author
while(GetAsyncKeyState(VK_F1)<>-32767)
ptc_update@buffer(0)
wend
stopOSMEMusic()
ptc_close
end
Causes the console window to crash horribly.
Is this library dependant somehow on having the console window open?
-
Here's an example of it dying slightly on exit in an intro I am working on (unfinished).
-
Hey shocky,
I'm afraid ... on my Vista and on my Win XP SP2 it works ... both the intro (btw. cool as usual *g*) and your small sample ...
How does it look like, when it crashes?
???
Cheers,
SLiPPY
-
Well, the tinyptc window closes as normal, however the console window is left open and will not close, it needs to be killed with the task manager here (XP SP2).
Thanks for comments about the intro. The intro will more than likely use ufmod as I have an xm module for it already, but if I can get your library to exit properly I will be using it in the next thing I make for S!P :) Will credit you fully of course.
-
Ah, well I have been playing with this a little, it's really good Slippy, well done mate!
But...
' simple in-mem test
#include "osmereplayer.bi"
#include "media/dthings.bi"
#define ptc_win
#include "tinyptc.bi"
#include "windows.bi"
dim shared buffer(640*480) as uinteger
IF (PTC_OPEN("WWW.DEFACTO2.NET",640,480)=0) THEN
END-1
END IF
dim shared info as osme_music_info_t
playOSMEMusicMem(@zaxxs(0), 1007, 1)
info = getOSMEMusicInfo()
print "Now playing " + info.title + " by " + info.author
while(GetAsyncKeyState(VK_F1)<>-32767)
ptc_update@buffer(0)
wend
stopOSMEMusic()
ptc_close
end
Causes the console window to crash horribly.
Is this library dependant somehow on having the console window open?
I found the problem, because you are using tiny_ptc internal 'escape key' check when you press it this command "stopOSMEMusic()" won't be executed. In the code above if you press F1 everything will work fine.
To fix this use "ptc_allowclose(0)" and change the while command to "while(GetAsyncKeyState(VK_ESCAPE)<>-32767)"
Btw, nice work slippy773
:cheers:
-
thanks for your comments so far ...
@emil_hamil: what exactly did you do? and what version of DirectX have you installed?
... just realized that there are some problems with proper looping of some of the musics ... gonna fix it asap :)
cheers,
SLiPPY
I have DirectX9 installed, and it always exit after a short period without producing any sound !!!!
-
Hey emil_halim,
in case it says something like
OSME library v0.87 (2007/06/09) by SLiPPY/VeCTRONiX! ...
========================================================
OSME:: error while trying to initialize...
you may try to call it like for example with "osmengineplayer.exe media/do_things_loader.sndh" or such ...
are there any other error messages, the lib produces?
cheers,
SLiPPY
-
Well I got it working fine :) It was my own fault, the problem was that I was not checking for esc :( I was checking F1 by accident. Thanks for sorting the bugs out folks!
A few small examples of using the VU bars would be really nice now Slippy if you get the time :D Cheers!
-
Hey emil_halim,
in case it says something like
OSME library v0.87 (2007/06/09) by SLiPPY/VeCTRONiX! ...
========================================================
OSME:: error while trying to initialize...
you may try to call it like for example with "osmengineplayer.exe media/do_things_loader.sndh" or such ...
are there any other error messages, the lib produces?
cheers,
SLiPPY
Hi slippy773.
Thanks for your help, it works ok now , agian thank you. :)
-
Hey Shocky ...
here's a little method how to use the channel vu
sub channelVU()
dim blank as integer
snval=50*COS(GADD2/200)
snval2=30*COS(GADD2/173)
blank = SCR_WIDTH / info.channels + snval
For ch=0 To info.channels-1
channel = getOSMEChannelVU(ch)
' magnify the volume a bit :)
For y=300+(channel*4) To 300 + (info.max_vu*8)
y1=(y+snval2) * SCR_WIDTH + snval*2
' paint one bar with 40px width
For x=0 To 40 + channel
BUFFER(y1+x+blank)=RGB((255-info.max_vu*4)+channel*2,0,0)
Next x
Next y
snval=50*COS(GADD/200)
snval2=30*COS(GADD2/173)
blank = blank + 80 + snval
Next ch
end sub
and here's how it looks like :)
Basically you can query the info object for the amount of available channels via
info.channels (integer)
and the maximum volume at
info.max_vu (which is 16 for Atari YM-2149 and 64 for Amiga Paula)
to get the current volume per channel just call getOSMChannelVU(channel)
take care that you first call "playOSMEMusic..." and then "info = getOSMEMusicInfo()"
cheers,
SLiPPY
-
That is really excellent Slippy and thank you very much indeed for posting the example! Very helpful, just the ticket in fact so have some good karma!
I will definately be putting this most excellent lib to use.
In fact now that we have this library and also Rbraz's excellent PTC_EXT, Ogremagic etc, some organisation would perhaps be a good idea of the forum so that these gems are easier to find!
-
thanks dude ...
perhaps you should make a new category for libs or so with bigger file-upload slots :)
Soon (today or tomorrow) I'll release a slightly fixed / size-reduced version of the lib ... question is how can I handle the 300kb upload quota without opening a new topic for this? or should I replace the attachment from the first posting with the current version from now on?
Just let me know ...
Cheers,
SLiPPY
-
Well, the upload size could be whatever size we want to set it at, Slippy. It's set up as 300kb right now as a compromise measure, there is not unlimited file space and believe it or not, we have over 400mb of files on this board already!
Eventually something is going to have to be done to increase the file storage capacity. We're on shared hosting at the moment, there are lots of possibilities but I don't want to migrate this site to a shit provider so things will be changed in time, but very carefully.
A new forum category for libs would be a great idea. We have a lot of forums that could probably be merged too.
It needs looking at in the near future.
I'm looking forward to testing your lib, it's best to replace the original attachment with the new one, you can do that by editing your post. This way you'll make sure people have the latest version of your very useful lib!
Thanks again for your work on this, it's excellent.
-
is osme exists as C static lib ?
great work
I hope to see new formats like DM, SA, SID...
-
Slippy,
Cool lib - been waiting for something like this . . . I have a tonne (of old skool tunes from all formats including the speccy!!!)
If your lib could also play SID tunes now that would be something!
Have some karma+
Drew
-
that is BRILLIANT!
nice one, have some karma! :goodpost:
-
It really is Brilliant. I am going to use it soon :)
All it needs to be perfect is to be smaller but I am not sure if that is possible.
-
Dudes,
thanks again for your support ... it definately keeps me motivated to work on it :)
Currently I'm setting up a project page on my blog for it where you may find all new versions and source code (yes, it'll be available) as well as samples ...
... and soon I'll release a new version which will be a bit more comfortable regarding the supported oldskool-music-formats ...
Size DOES matter for me as well ... my current lib compiles (under C++ and packed with Kkrunchy afterwards) to somewhat less than 40kb ...
Let's see if I can tweak another few kilobytes ... :)
I'll keep you informed about any news on this !!! ^^
Cheers,
SLiPPY
-
How would I go about using this in devc++ ?
-
I mean, I need a .h and a .lib file right?
And if so, how can I get hold of them? :) Pretty please!
-
Hey Shocky ...
really easy going around with it ...
check this one here :)
let's call it "osme-funcs.h" or such ... (it's from my current source-package)
/*
* OldSkoolMusaxxsEngine - API
* Copyright (C) 2007 SLiPPY/VeCTRONiX! <slippy@vectronixhq.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef _OSME_FUNCS_H_
#define _OSME_FUNCS_H_
#define OSME_SUCCESS 0;
#define OSME_FILE_ERROR -1001;
#define OSME_FILE_READ_ERROR -1002;
#define OSME_FILE_MEMORY_ERROR -1003;
#define OSME_FILE_NOT_FOUND_ERROR -1004;
#define OSME_UNKNOWN_REPLAYER -2001;
#define OSME_INITIALIZATION_ERROR -3001;
#define OSME_SOUNDSUBSYSTEM_ERROR -3002;
#define OSME_DISK_VALIDATION_FAILED -3003;
#define OSME_USER_ERROR -4000;
#ifdef IS_DLL
#define EXPORT_DECL extern "C" __declspec(dllexport)
#else
#define EXPORT_DECL extern "C"
#endif
#ifdef USE_DLL
#undef EXPORT_DECL
#define EXPORT_DECL extern "C" __declspec(dllimport)
#endif
EXPORT_DECL typedef struct {
char title[80]; /**< Disk or track title. */
char author[60]; /**< Author name. */
char composer[60]; /**< Composer name. */
char replay[40]; /**< Replay name. */
char hwname[20]; /**< Hardware description. */
unsigned int time_ms; /**< Duration in ms. */
unsigned int rate; /**< Replay rate. */
unsigned int addr; /**< Load address. */
unsigned int channels; /**< Channels for VU */
unsigned int max_vu; /**< max. amount of volume per channel */
} osme_music_info_t;
EXPORT_DECL int playOSMEMusicMem(void *pMusic, unsigned int length, int trackId);
EXPORT_DECL int playOSMEMusicFile(const char * filename, int trackId);
EXPORT_DECL void stopOSMEMusic();
EXPORT_DECL void pauseOSMEMusic();
EXPORT_DECL void resumeOSMEMusic();
EXPORT_DECL unsigned char getOSMEChannelVU(int i);
EXPORT_DECL void setQualityFilter(bool onoff);
EXPORT_DECL int getProcResult();
EXPORT_DECL void setOSMEVolume(int vol);
EXPORT_DECL void fadeOutOSMEVolume(int fadeOutTimeMS);
EXPORT_DECL osme_music_info_t getOSMEMusicInfo();
#endif
and the lib you already have ... it's the same one used for the FreeBasic stuff ...
-
Thanks mate :)
K++
-
I know I am probably pushing my luck here, but is there any chance of a quick example of getting this working with devc please?
-
Hey,
here's a little DevCPP project using the engine ... hope this might help mate :)
Ahh ... you'll need DX SDK9 by hand ... pretty sure you already have it installed, eh?
and perhaps you need to change the paths within the project settings ^^
Cheers,
SLiPPY
-
Perfect :)
Your efforts are really well appreciated, more than you know!
Both I and Alpha One thank you :D
Have some more Karma.