Example #1
0
	// Called when a theme has finished loading.
	public void ThemeLoaded(ref Elias.Theme theme) {
		gameObject.GetComponent<Renderer>().material.color = themeLoadedColor;
		nr_loop_tracks = theme.AudioLoopTrackCount;
		nr_stinger_tracks = theme.AudioStingerTrackCount;
		greatestTrigger = (uint)theme.GreatestTrigger;
		Debug.Log(string.Format("ELIASMusicSwitcher - A theme with {0} loop tracks was loaded.", nr_loop_tracks));
	}
Example #2
0
File: Theme.cs Project: NoaAka/P6
		public bool ActionPresetValidInMode(string preset_name, Elias.Modes mode)
		{
			IntPtr s = UTF8MarshallingHelpers.ConvertToNativeUTF8 (preset_name);
			int presetValidInt = 0;
			int res = elias_theme_action_preset_valid_in_mode(this.Handle, s, (int)mode, ref presetValidInt);
			UTF8MarshallingHelpers.FreeStringPointer (s);
			if(res != 0)
			{
				ErrorCode e = (ErrorCode)res;
				throw new Exception(e.ToString());
			}
			return (presetValidInt != 0);
		}
Example #3
0
	public static void ThemeWasLoaded(ref Elias.Theme theme) {
		if (OnThemeLoaded != null) {
			OnThemeLoaded(ref theme);
		}
	}
Example #4
0
	static int EnumerateSourcesCB(ref Elias.Source source, ref IntPtr source_user_data, IntPtr user_data) {
	
		string sourceString = string.Format("track {0}, File {1}, key {2}, source nr {3}", source.track_id, Elias.UTF8MarshallingHelpers.ConvertFromNativeUTF8(source.filename), source.key, source.source);
		Debug.Log (sourceString);

		int key = source.track_id;
		if (source.track_type == (int)Elias.TrackType.AudioLoop) {
			if (!loopTrackDict.ContainsKey(key)) {
				loopTrackDict[key] = new List<int>();
			}
			List<int> triggerList = loopTrackDict[source.track_id];
			triggerList.Add(source.source);  // Loop track trigger at level source.source
		} else if (source.track_type == (int)Elias.TrackType.AudioStinger) {
			if (!stingerTrackDict.ContainsKey(key)) {
				stingerTrackDict[key] = new List<int>();
			}
			List<int> stingerList = stingerTrackDict[source.track_id];
			// When playing a stinger, a track is supplied as argument and the engine choose variation based on a progression setting.
			// Therefore we save the track_id as an identifier here.
			stingerList.Add(source.track_id); 
		}

		return 1;
	}
Example #5
0
	// Called when a theme has finished loading.
	public void ThemeLoaded(ref Elias.Theme theme) {
		uint triggerLevels = (uint)theme.GreatestTrigger;

		// So, a theme is loaded. Now get some information about it ...
		//	All this currently does is output the info into the debug log, but if we wanted to we could use the
		//	data to show what actual sources are playing, and not only what track nr is.
		EnumerateSources(ref theme);
		
		// ... and create some representative geometry.
		CreateStingerGeometry();
		CreateLoopTrackGeometry(triggerLevels);
	}
Example #6
0
	/*
	 * While the theme.EnumerateSources utilizes a callback, it's a blocking thread safe operation
	 * 	that calls back on the same thread it was called from. So no problems with thread safety here
	 * 	as long as you call it on the main thread!
	 */
	void EnumerateSources(ref Elias.Theme theme) {
		uint number_of_loop_tracks = theme.AudioLoopTrackCount;
		uint number_of_stinger_tracks = theme.AudioStingerTrackCount;
		
		loopTrackDict = new Dictionary<int, List<int>>();
		stingerTrackDict = new Dictionary<int, List<int>>();

		Debug.Log("Number of loop tracks: " + number_of_loop_tracks.ToString());
		Debug.Log("Number of stinger tracks: " + number_of_stinger_tracks.ToString());
		
		theme.EnumerateSources(this.EnumerateSourcesCB);
	}
Example #7
0
 public AlienGlyphGenerator(RNG rng)
 {
     this.rng = rng;
     los      = new Elias();
 }