still cant get the frickin music to worrk!

Started by , Mon 21/04/2003 00:10:18

Previous topic - Next topic

CelebritySkin

Ok, ive put the music file name music0.mp3 into the compiled folder...then in the room setting script wrote PlayMusic(0); }  also ticked the box "play music on room load" and selected 0. Clicked on rebuild vox files and something shoots up so fast i cant even see it and when i test the game nothing plays......it doesnt even come up with an error msg when i exit IT JUST DOESNT WORK!!!!!!!! its driving me mad. Please help!

miguel

try to put music0.mp3 on your compiled folder, then do rebuild vox files, it should work

Privateer Puddin'

not this if this applies here but, from the manual...

When the game loads, music 0 will be played if it exists in the game directory. You can change the music later by setting "Play music on room load" in a room, by using the PlayMusic text script command, or by using the "Play sound" interaction command. If you use the interaction command, you must add 1000 to the music number so that AGS recognises it as music and not a sound effect. For example, to play music 23, use "Play sound 1023".


CelebritySkin

nope its still not working. i tried the last suggestion about the 1000 in front but im at a loose end.

i really dont know what i am doing wrong!


scotch


Timosity

#6
DON'T put it in the COMPILED folder, put it in the main game folder which contains all the crm files etc

it will create a music.vox file in the compiled folder

Scorpiorus

Ok, let me clarify that music playing thingy:

Suppose you have a number of MP3 files:
song.mp3
rock.mp3
music0.mp3
music1.mp3

and want them to be played from AGS game.
There is a couple of function you can use:
PlayMusic (int music_number)
PlayMP3File (string filename)


PlayMusic (int music_number)

Changes the currently playing background music to MUSICx.OGG, MUSICx.MP3, MUSICx.MID, MUSICx.MOD or MUSICx.XM (where X is MUSIC_NUMBER). The game will search for the files in that order until it finds one to play.
Example:

PlayMusic(2);

will play music2.

You see a music number is passed to that function. What is it? When you call PlayMusic() function (by the way this function works as Play music option in the interaction editor) it searches for music.vox located in the \COMPILED folder. The music.vox file is the archive file containing all music files.
How to build this music.vox file?
First rename all the mp3 files (also OGG or midi if you want them to be played too) to
music0.mp3
music1.mp3
music2.mp3
music3.mid
music4.ogg
etc.

and place them !into your \GAME folder! (NOT to \Compiled one).
Ok. you done it. but that is not enough. To make music.vox file you have to choose from the editor's main menu: Rebuild vox files. So AGS will look for all musicX.mp3, musicX.mid, musicX.ogg, etc. files located in the \GAME folder and build one music.vox file and place it into the game\compiled folder. Now when you distribute your game you don't need any of musicX.* files but only the music.vox one. Some people mistakenly deliver musicX.* files and music.vox file together which results in doubling the size of the music files.




PlayMP3File (string filename)

Changes the currently playing background music to FILENAME, which must be an MP3 or OGG file.
Since normally MP3 files are built into the MUSIC.VOX file, there may be occasions where you want one MP3 (for example, the intro music) to be distributed with your main game rather than the music pack. So, this function allows you to play any named MP3 or OGG file. However, you will have to bundle the file seperately in your game distribution (it is not automatically compiled into the EXE).

Example:

PlayMP3File ("chesney.mp3");

will play "chesney.mp3" as the background music.

This function doesn't use music.vox file at all. Instead it searches for particular .mp3 file in the \compiled folder. For example if you have file called song.mp3 you have two different ways to include it into the AGS game:

1st. You can rename it to music3.mp3 for example then place into \game folder and rebuild vox files. As result it will be included into music.vox archive and you can play it with PlayMusic(3) function.

2nd. You can just place this file (without renaming) directly into the game\compiled folder. If you rebuild vox files this (song.mp3) file will NOT be included into music.vox archive because of it's name. To play such a file you can use PlayMP3File("song.mp3") function.



Some obstacles:

1. When renaming the files check it's extension because it may be something like music4.mp3.mp3 instead of music4.mp3 because such file as music4.mp3.mp3 will never be included into music.vox archive.

2. If you decided to use PlayMP3File() function and placed all appropriate songs.mp3 files into game\compiled folder be sure you didn't copy it as music6.mp3 into \game folder as in this case if you rebuild vox files you will get 2 different copies of them in the final game pack: one as song.mp3 file and another as a part of music.vox file.

If you have any questions just ask ;)

-Cheers

SMF spam blocked by CleanTalk