Forum Jump :

Author Message


Posts: 250
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name: austinXmedic

 
#1 Posted at 2014-07-26 15:22        
     
So I'm running into a bit of an issue when trying to add music into the game through a config.cpp.

heres what it looks like:
class CfgPatches
{
	class AUSMDMusic
	{
		units[] = {};
		weapons[] = {};
		requiredVersion = 0.1;
		requiredAddons[] = {"A3_Music_F"};
	};
};
class CfgMusic
{
	class SadMusic
	{
		name = "Tragic End";
		sound[] = {"\test\test2\test3\sadmusic.ogg",1.0,1.0};
		duration = 60;
		musicClass = "Calm"; // needed for it to show up in the Zeus Module
	};
};

Basically a straight copy paste from Bohemia's music config.cpp's, just a few things renamed.

I use format factory to compress my sound track into a .ogg file.

Once it's ingame however, there are no errors at all, but when trying to play my music, it doesn't play at all, its like its a blank track with silence and nothing else (though it isn't blank).

Any idea of what I need to do differently to get this working?



EDIT: It also works just fine if I use it inside a mission with description.ext, so whats the difference between description.ext cfgMusic setup and config.cpp cfgMusic? Other than the fact that one adds classes to missionconfigfile and the other adds to configfile

Some of my work:
http://steamcommunity.com/sharedfiles/filedetails/?id=287343671 -- Unit Play/ Unit Capture Functions Guide
http://steamcommunity.com/sharedfiles/filedetails/?id=265454265 -- Zeus Guide
add me on steam: austin_medic

Author Message


Posts: 635
Rank:


Level: Member

Country: uk
Location: N.W.
Occupation:
Age: 29
In-game name: big_wilk

 
#2 Posted at 2014-07-26 18:08        
     
Looks fine to me. Probably something small or something obvious we cant see, this is my .cpp for a sound mod I made it works so you can just use this as template:

1. BW_Chen_Sound is the name of the pbo the files are contained in
2. You wanted to be careful what command you use as some only work if they are configed useing the correct cfg class. (PlayMusic needs CfgMusic).
3. Use the PlaySound3D command to test your sounds work as you can just use the file path to play the .oggs with that.
class CfgPatches {
	class BW_Chen_Sound
	{
		units[] = {};
		weapons[] = {};
		requiredAddons[] = {};	
		author[]= {"Big_Wilk"}; 		
	};
};

class CfgSounds
{
	sounds[] = {};
	class J1Speaks
	{
		name = "J1_Speaks";
		sound[] = {"BW_Chen_Sound\AmbSounds\Misc\j1tALK2.ogg", 1, 1};

	};
};

class CfgMusic
{
	tracks[]={};

	class IntroRadio2
	{
		name = "";
		sound[] = {"BW_Chen_Sound\AmbSounds\Misc\navi.ogg", db+0, 1.0};
	};
	class IntroRadio1
	{
		name = "";
		sound[] = {"BW_Chen_Sound\AmbSounds\Misc\StalionDown.ogg", db+10, 1.0};
	};
};



Advertisement


Author Message


Posts: 13
Rank:


Level: Member

Country: tr
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2017-02-13 23:53        
     
sorry for necroing thread from few years ago.. but I am very confused and I cant find any solution. I hope I don't steal your time.

MISSION_ROOT = call {
    private "_arr";
    _arr = toArray str missionConfigFile;
    _arr resize (count _arr - 15);
    toString _arr
};

player addEventHandler["reloaded", {
    private _weapon = param[1];
    if !(_weapon in ["hgun_Pistol_heavy_01_snds_F", "hgun_Pistol_heavy_01_F", "srifle_EBR_F", "srifle_DMR_02_F", "launch_RPG32_F"]) exitWith {};
    _soundArr = [MISSION_ROOT + "ssubo\ re1.ogg", MISSION_ROOT + "ssubo\ re2.ogg", MISSION_ROOT + "ssubo\ re3.ogg", MISSION_ROOT + "ssubo\ re4.ogg", MISSION_ROOT + "ssubo\ re5.ogg"];
    _n = count _soundArr;
    _selectSound = _soundArr select(floor(random _n));
    playsound3d[_selectsound, player, false, getPosASL player, 6, 1, 35];
}];

this is the code that works when I put in missions. I can put bunch of other eventhandlers like weaponrested and play other sounds too. but when I wanted this to be a mission-independent modd or add-on, everything is confusing. what should I do with eventhandlers? seperate it to config.cpp, config.hpp, or what? what am I going to do make it work as add-on totally seems impossible.

playsound needs "mission root" defined. and method here needs a description.ext at mission folder, for game to know where this folder is..how am I suppose to define mission root when there wont be a description.ext??
I tried to download cba and see documentations, to get some idea about what - how eventhandlers can be transformed into modlike *.cpp stuff, and how this code can be transformed from sqf...but no mods I unpbo'd so far helped me understand. all I see is seperated folders, seperated files and nothing makes any sense.

anyway. sorry again for necroing posts or wasting time. admin can ban if I did something wrong. thanks for reading.

between somewhat-full retarded





Tags: Config, Music