// XXX: Would it make sense to convert motif and band to container types? /// <summary> /// Gets the default band associated with the style. /// </summary> /// <returns>The style's default band.</returns> public string GetDefaultBand() { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetDefaultBand(buffer, _pointer); return(buffer.ToString()); }
MusicEngine() { Ppmusau.MT_LoadMusicEngine(); _style = null; _personality = null; _band = null; }
/// <summary> /// Gets the default personality associated with the style. /// </summary> /// <returns>The style's default personality.</returns> public Personality GetDefaultPersonality() { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetDefaultPersonality(buffer, _pointer); return(new Personality(this, buffer.ToString())); }
internal Personality(Style style, string name) { _name = name; _style = style; StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetPersonalityFilename(buffer, name); _filename = buffer.ToString(); }
/// <summary> /// Starts the music with the last style specified. /// </summary> public void ResumeMusic() { // sanity check if (Style == null || Personality == null || Band == null || Band == "") { throw new InvalidOperationException("Can't resume playback without it being previously set"); } // XXX: Why not Queue? Ppmusau.MT_StartMusic(Style.Pointer, Personality.Name, Band); }
/// <summary> /// Returns a list of styles. /// </summary> /// <param name="category">The category to pull the styles from.</param> /// <returns>A list of styles.</returns> public ArrayList GetStyles(string category) { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetFirstStyle(buffer, category); ArrayList al = new ArrayList(); al.Add(new Style(category, buffer.ToString())); while (Ppmusau.MT_GetNextStyle(buffer, category, buffer.ToString()) > 0) { al.Add(new Style(category, buffer.ToString())); } return(al); }
// XXX: Iterators // XXX: Consider refactoring so categories are an object /// <summary> /// Returns a list of categories that have styles. /// </summary> /// <returns>A list of categories that have styles.</returns> public ArrayList GetCategories() { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetFirstCategory(buffer); ArrayList al = new ArrayList(); al.Add(buffer.ToString()); while (Ppmusau.MT_GetNextCategory(buffer, buffer.ToString()) > 0) { al.Add(buffer.ToString()); } return(al); }
internal Style(string category, string guid) { _guid = guid; _category = category; StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetStyleName(buffer, category, guid); _name = buffer.ToString(); Ppmusau.MT_GetStyleFilename(buffer, category, guid); _filename = buffer.ToString(); _pointer = Ppmusau.MT_GetStylePtr(category, guid); }
/// <summary> /// Gets a list of motifs associated with the style. /// </summary> /// <returns>A list of motifs associated with the style</returns> public ArrayList GetMotifs() { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetFirstMotif(buffer, _pointer); ArrayList al = new ArrayList(); al.Add(buffer.ToString()); while (Ppmusau.MT_GetNextMotif(buffer, _pointer, buffer.ToString()) > 0) { al.Add(buffer.ToString()); } return(al); }
/// <summary> /// Gets a list of personalities associated with the style. /// </summary> /// <returns>A list of personalities associated with the style</returns> public ArrayList GetPersonalities() { StringBuilder buffer = new StringBuilder(0x100); Ppmusau.MT_GetFirstPersonality(buffer, _pointer); ArrayList al = new ArrayList(); al.Add(new Personality(this, buffer.ToString())); while (Ppmusau.MT_GetNextPersonality(buffer, _pointer, buffer.ToString()) > 0) { al.Add(new Personality(this, buffer.ToString())); } return(al); }
/// <summary> /// Starts the music with the specified parameters. /// </summary> /// <param name="style">The style of music to play.</param> /// <param name="personality">The personality that the music takes on.</param> /// <param name="band">The band that plays the instruments.</param> public void StartMusic(Style style, Personality personality, string band) { // sanity check if (style != personality.Style) { throw new ArgumentException("Personality style doesn't match"); } if (band == null || band == "") { throw new ArgumentNullException("Band cannot be empty"); } _style = style; _personality = personality; _band = band; // XXX: Why not Queue? Ppmusau.MT_StartMusic(style.Pointer, personality.Name, band); }
/// <summary> /// Stops the music from being played. /// </summary> public void StopMusic() { Ppmusau.MT_StopMusic(); }
/// <summary> /// Plays a non-repeating motif. /// </summary> /// <param name="motif">The motif to play.</param> public void PlayMotif(string motif) { // XXX: Why not Queue? Ppmusau.MT_PlayMotif(Style.Pointer, motif); }