private void Start() { log("-Press Space for toggle music-\n"); try { int ver = SunVox.sv_init("0", 44100, 2, 0); if (ver >= 0) { int major = (ver >> 16) & 255; int minor1 = (ver >> 8) & 255; int minor2 = (ver) & 255; log(String.Format("SunVox lib version: {0}.{1}.{2}", major, minor1, minor2)); SunVox.sv_open_slot(0); log("Loading SunVox song from memory..."); loadBinaryAsset(getDataPath("test.sunvox"), onBinaryFileLoaded); } else { log("sv_init() error " + ver); } } catch (Exception e) { log("Exception: " + e); } }
private void InitFX() { if (Disabled) { return; } SunVox.sv_open_slot((int)Slot.FX); }
private void InitMusic() { if (Disabled) { return; } SunVox.sv_open_slot((int)Slot.Music); }
private void InitAnnounce() { SunVox.sv_open_slot((int)Slot.Announce); Logger.LogTrace("Loading Announce project from file", Category.SunVox); // var path = "Assets/StreamingAssets/announcement2.sunvox"; var path = GetDataPath("announcement2.sunvox"); if (SunVox.sv_load((int)Slot.Announce, path) == 0) { // log( "Loaded." ); } else { Logger.LogWarning($"Announce project load error: {path}", Category.SunVox); // SunVox.sv_volume( (int)Slot.Announce, 256 ); } }
public static int OpenUnusedSlot() { if (!init) { Debug.Log("SunVox init"); init = true; // TODO: what if there are a different number of channels?? int version = SunVox.sv_init("0", AudioSettings.outputSampleRate, 2, SunVox.SV_INIT_FLAG_USER_AUDIO_CALLBACK | SunVox.SV_INIT_FLAG_AUDIO_FLOAT32); if (version < 0) { Debug.LogError("Error initializing SunVox"); return(-1); } int major = (version >> 16) & 255; int minor1 = (version >> 8) & 255; int minor2 = (version) & 255; Debug.Log(System.String.Format("SunVox lib version: {0}.{1}.{2}", major, minor1, minor2)); } if (audioOutput == null) { audioOutput = new GameObject("SunVox out"); audioOutput.AddComponent <SunVoxFilter>(); } int slot = 0; while (true) { if (!openSlots.Contains(slot)) { break; } slot++; } Debug.Log("SunVox: open slot " + slot); SunVox.sv_open_slot(slot); openSlots.Add(slot); return(slot); }
void Start() { try { int ver = SunVox.sv_init("0", 44100, 2, 0); if (ver >= 0) { int major = (ver >> 16) & 255; int minor1 = (ver >> 8) & 255; int minor2 = (ver) & 255; log(String.Format("SunVox lib version: {0}.{1}.{2}", major, minor1, minor2)); SunVox.sv_open_slot(0); StartCoroutine(ModuleCoroutine()); } else { log("sv_init() error " + ver); } } catch (Exception e) { log("Exception: " + e); } }
private void Start() { log("-Press Space for toggle music-\n"); try { int ver = SunVox.sv_init("0", 44100, 2, 0); if (ver >= 0) { int major = (ver >> 16) & 255; int minor1 = (ver >> 8) & 255; int minor2 = (ver) & 255; log(String.Format("SunVox lib version: {0}.{1}.{2}", major, minor1, minor2)); SunVox.sv_open_slot(0); log("Loading SunVox song from file..."); var path = "Assets/StreamingAssets/test.sunvox"; // This path is correct only for standalone if (SunVox.sv_load(0, path) == 0) { log("Loaded."); } else { log("Load error."); SunVox.sv_volume(0, 256); } SunVox.sv_play_from_beginning(0); } else { log("sv_init() error " + ver); } } catch (Exception e) { log("Exception: " + e); } }
private void InitFX() { SunVox.sv_open_slot((int)Slot.FX); }
private void InitMusic() { SunVox.sv_open_slot((int)Slot.Music); }