Mod play questions
Moderator: Moderators
Mod play questions
Hi iv'e been having some issues with playing mod files in my z game (the same game I was working on before)
Iv'e had a look at the mod play example and I've gotten a mod to play on start up of my game, but for some reason I get an error message when I put the initialize code in the "on start" of an app state.
It says unknown function.
also I'd like to know what z expression to use to stop a mod from playing.
Is it possible to have a mod set to looping? and how is it possible to check if a particular mod is playing?
any comments welcome.
Iv'e had a look at the mod play example and I've gotten a mod to play on start up of my game, but for some reason I get an error message when I put the initialize code in the "on start" of an app state.
It says unknown function.
also I'd like to know what z expression to use to stop a mod from playing.
Is it possible to have a mod set to looping? and how is it possible to check if a particular mod is playing?
any comments welcome.
Re: Mod play questions
Hi jinxtengu,
int BASS_ChannelPause(int handle) {}
int BASS_ChannelFlags(int handle, int flags, int mask) {}
To check playing of a channel is achieved by the BASS_ChannelIsActive function; also to be added to external library:
int BASS_ChannelIsActive(int handle) {}
BTW Ville, cannot you extend the embedded external BASS library component by these functions (or maybe some more useful functions/constants which can be translated to ZGE's type system easily)? If I find some free time, I can help with this. Maybe it would be better to use the definition file as for Bullet or OpenGL...
I did not have this problem with BASS. Cannot you send your project or some part of it which demonstrates the problem?jinxtengu wrote:but for some reason I get an error message when I put the initialize code in the "on start" of an app state.
BASS_Stop() or BASS_ChannelPause(channel_handle) just to pause channel playing. I think BASS_ChannelPause is not in the built-in version of the external library, so you should add it by yourself:jinxtengu wrote:also I'd like to know what z expression to use to stop a mod from playing.
int BASS_ChannelPause(int handle) {}
I think it's looping by default, isn't it? If not, then you can use the BASS_SAMPLE_LOOP (4) flag in the BASS_ChannelFlags() function, which also should be added manually:jinxtengu wrote:Is it possible to have a mod set to looping? and how is it possible to check if a particular mod is playing?
int BASS_ChannelFlags(int handle, int flags, int mask) {}
To check playing of a channel is achieved by the BASS_ChannelIsActive function; also to be added to external library:
int BASS_ChannelIsActive(int handle) {}
BTW Ville, cannot you extend the embedded external BASS library component by these functions (or maybe some more useful functions/constants which can be translated to ZGE's type system easily)? If I find some free time, I can help with this. Maybe it would be better to use the definition file as for Bullet or OpenGL...
the code I'm trying to run is copied from the mod play demo.
this works if it is in the "on loaded" file tree but not if I place it under an app state.
I don't know why this happens.
even running this code :
under an app state give an error message when the program is run, but the code editor doesn't register an error.
I should point out that I am still using version 1.9.9
of z game editor. I didn't want to upgrade until I finish the current game i'm working on because loading it in newer versions causes some problems with the 3d models.
Code: Select all
int ok;
//Start music
ok=BASS_Init(-1, 44100, 0, 0, 0);
if(!ok) {
App.Caption="Error init: " + intToStr(BASS_ErrorGetCode());
return;
}
//Music downloaded from http://modarchive.org/
string musicFile = "398vcf.mod";
int musicId = BASS_MusicLoad(0,musicFile,0,0,0,0,0);
if(!musicId) {
App.Caption="Error load music: " + intToStr(BASS_ErrorGetCode());
return;
}
MusicHandle=musicid;
if(!BASS_ChannelPlay(musicId, 0)) {
App.Caption="Error play music: " + intToStr(BASS_ErrorGetCode());
return;
}
App.Caption="Music is playing!";
this works if it is in the "on loaded" file tree but not if I place it under an app state.
I don't know why this happens.
even running this code :
Code: Select all
BASS_Free();
I should point out that I am still using version 1.9.9
of z game editor. I didn't want to upgrade until I finish the current game i'm working on because loading it in newer versions causes some problems with the 3d models.
The code is correct. In ZGE 3.0.0b it's working also from AppState's OnStart section. Anyway I have one suspicion: did you move also the ZExternalLibrary component to AppState? It should remain in the OnLoaded section of ZApplication.
Is it too difficult to migrate your project to the latest ZGE version (or at least to stable release 2.0.1)?
Is it too difficult to migrate your project to the latest ZGE version (or at least to stable release 2.0.1)?
I fixed the problem with the mod play in my game:
after moving the Zexternal library bass.dll to the top of the "on loaded" file tree the code for playing mods works when placed in the app states.
also
I tried migrating the project to z game version 3 beta but as soon as the game was run I got an error message from this line of code:
return healthy.value<=0;
"error in expression for node: Condition.
Could not determine type: value(line:1, col: 25)"
i don't understand why this happens.
also i'd really appreciate if someone could explain to me how to use the BASS_SAMPLE_LOOP (4) flag to get Mod files looping.
I have manually added "int BASS_ChannelFlags(int handle, int flags, int mask) {}" to the bass library, however I don't understand how to use the functions properly.
after moving the Zexternal library bass.dll to the top of the "on loaded" file tree the code for playing mods works when placed in the app states.
also
I tried migrating the project to z game version 3 beta but as soon as the game was run I got an error message from this line of code:
return healthy.value<=0;
"error in expression for node: Condition.
Could not determine type: value(line:1, col: 25)"
i don't understand why this happens.
also i'd really appreciate if someone could explain to me how to use the BASS_SAMPLE_LOOP (4) flag to get Mod files looping.
I have manually added "int BASS_ChannelFlags(int handle, int flags, int mask) {}" to the bass library, however I don't understand how to use the functions properly.
Just usejinxtengu wrote:return healthy.value<=0;
Code: Select all
return healthy<=0;
Just download the bass24.zip file and this contains bass.chm help - everything is described there; it's not too difficult to understand. Of course, I can help you in the case of further questions.jinxtengu wrote:also i'd really appreciate if someone could explain to me how to use the BASS_SAMPLE_LOOP (4) flag to get Mod files looping.
I have manually added "int BASS_ChannelFlags(int handle, int flags, int mask) {}" to the bass library, however I don't understand how to use the functions properly.
jinxtengu, instead of "App.CollidedCategory==22;" you should use Model.CollidedWith property which is set to the model that the current model has collided with. Ville discussed this change here (point 6.).