private void OutputMoodMessage(track track)
        {
            var skype = new Skype();

            if (!skype.Client.IsRunning)
            {
                return;
            }

            // Get format message
            var msg = ConfigurationManager.AppSettings["MoodMessage"];

            if (msg == null)
            {
                msg = "Now Playing: {0}";
            }

            // Apply match replacements
            msg = Regex.Replace(msg, "%name%", track.name ?? String.Empty);
            msg = Regex.Replace(msg, "%artist%", track.artist ?? String.Empty);
            msg = Regex.Replace(msg, "%album%", track.album ?? String.Empty);
            msg = Regex.Replace(msg, "%date%", track.date ?? String.Empty);
            msg = Regex.Replace(msg, "%url%", track.url ?? String.Empty);

            // Set mood message
            skype.CurrentUserProfile.RichMoodText = msg;
        }
        public async Task <IActionResult> Edit(long id, [Bind("TrackId,Name,AlbumId,MediaTypeId,GenreId,Composer,Milliseconds,Bytes,UnitPrice")] track track)
        {
            if (id != track.TrackId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(track);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!trackExists(track.TrackId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(track));
        }
示例#3
0
        public void SelectPrev()
        {
            track lastTrack = null;

            for (int i = Tracks.Count - 1; i >= 0; i--)
            {
                track track = this.TrackElements[i];
                if (lastTrack != null)
                {
                    track.Selected = true;
                    foreach (track t in this.TrackElements)
                    {
                        if (t != track)
                        {
                            t.Selected = false;
                        }
                    }
                    return;
                }
                if (track.Selected)
                {
                    lastTrack = track;
                }
            }
        }
示例#4
0
        public void SelectNext()
        {
            track lastTrack = null;

            for (int i = 0; i < Tracks.Count; i++)
            {
                track track = this.TrackElements[i];
                if (lastTrack != null)
                {
                    track.Selected = true;

                    foreach (track t in this.TrackElements)
                    {
                        if (t != track)
                        {
                            t.Selected = false;
                        }
                    }
                    if (track.Y + track.Height < this.VerticalScroll.Value)
                    {
                        this.VerticalScroll.Value = track.Y;
                    }
                    if (track.Y + track.Height > this.VerticalScroll.Value + this.Height)
                    {
                        this.VerticalScroll.Value = track.Y - track.Height;
                    }
                    return;
                }
                if (track.Selected)
                {
                    lastTrack = track;
                }
            }
        }
示例#5
0
 public song(Java.IO.FileDescriptor bassFile, string bassFileString, long b1, long b2, Java.IO.FileDescriptor drumsFile, string drumsFileString, long d1, long d2, Java.IO.FileDescriptor instrumentsFile, string instrumentsFileString, long i1, long i2, Java.IO.FileDescriptor vocalsFile, string vocalsFileString, long v1, long v2)
 {
     theBass        = new track(bassFile, bassFileString, b1, b2);
     theDrums       = new track(drumsFile, drumsFileString, d1, d2);
     theInstruments = new track(instrumentsFile, instrumentsFileString, i1, i2);
     theVocals      = new track(vocalsFile, vocalsFileString, v1, v2);
 }
示例#6
0
    /// <summary>
    /// Mute the track passed as param.
    /// </summary>
    static public void Mute(bool mute, track compareTrack)
    {
        float unMuteVolume = 1;

        if (compareTrack == track.BackgroundSound)
        {
            _bkgMuted    = mute;
            unMuteVolume = _bkgVolumeHold;
        }
        else if (compareTrack == track.EffectSound)
        {
            _efxMuted    = mute;
            unMuteVolume = _efxVolumeHold;
        }
        else if (compareTrack == track.VoiceSound)
        {
            _voiceMuted  = mute;
            unMuteVolume = _voiceVolumeHold;
        }
        else if (compareTrack == track.All)
        {
            _efxMuted    = mute;
            _bkgMuted    = mute;
            _voiceMuted  = mute;
            unMuteVolume = _allVolumeHold;
        }

        _allMuted = _efxMuted && _voiceMuted && _bkgMuted;

        InternalVolume((mute)? 0 : unMuteVolume, compareTrack);
    }
示例#7
0
    /// <summary>
    /// Mute the track passed as param.
    /// </summary>
    static public void Mute(bool mute, track compareTrack)
    {
        if (compareTrack == track.BackgroundSound)
        {
            _bkgMuted = mute;
        }
        else if (compareTrack == track.EffectSound)
        {
            _efxMuted = mute;
        }
        else if (compareTrack == track.VoiceSound)
        {
            _voiceMuted = mute;
        }
        else if (compareTrack == track.All)
        {
            _efxMuted   = mute;
            _bkgMuted   = mute;
            _voiceMuted = mute;
        }
        if (_efxMuted && _voiceMuted && _bkgMuted)
        {
            _allMuted = true;
        }
        else
        {
            _allMuted = false;
        }

        Volume((mute)? 0 : 1, compareTrack);
    }
        private track[] openFiles()
        {
            track[] trackList = new track[100];
            int     count     = 0;

            var pathFile     = Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads);
            var absolutePath = pathFile.AbsolutePath;

            foreach (string file in Directory.GetFiles(absolutePath))
            {
                if (file.Contains(".wav"))
                {
                    try
                    {
                        track newTrack = new track(name, file);
                        trackList[count] = newTrack;
                        count++;
                    }
                    catch { }
                }
            }

            fileStrings = new string[count];
            for (int i = 0; i < count; i++)
            {
                string[] currentFile = trackList[i].getSecond().Split("/");
                fileStrings[i] = currentFile[currentFile.Length - 1];
            }
            return(trackList);
        }
示例#9
0
        public void add_sample_data(ChinookDbContext db)
        {
            var digital_download = new media_type()
            {
                Name = "Digital Download"
            };
            var rock_genre = new genre()
            {
                Name = "Rock"
            };
            var new_artist = new artist()
            {
                Name = "Bob Sacamano"
            };
            var new_album = new album()
            {
                Title = "My stuff 2018", Artist = new_artist
            };
            var new_track = new track()
            {
                Name = "Bad Medicine", Album = new_album, Genre = rock_genre, MediaType = digital_download
            };
            var new_playlist = new playlist()
            {
                PlaylistId = 0, Name = "Test playlist"
            };
            var ref_playlist_track = new playlist_track()
            {
                playlist = new_playlist, track = new_track
            };

            new_playlist.tracks.Add(ref_playlist_track);
            db.playlist_tracks.Add(ref_playlist_track);
            db.SaveChanges();
        }
示例#10
0
    /// <summary>
    /// Set the volume of the track passed as Param.
    /// </summary>
    static public void Volume(float volume, track trackCompare)
    {
        volume = Mathf.Clamp01(volume);
        switch (trackCompare)
        {
        case track.VoiceSound:
            _voiceVolumeHold = volume;
            break;

        case track.BackgroundSound:
            _bkgVolumeHold = volume;
            break;

        case track.EffectSound:
            _efxVolumeHold = volume;
            break;

        case track.All:
            _voiceVolumeHold = volume;
            _bkgVolumeHold   = volume;
            _efxVolumeHold   = volume;
            _allVolumeHold   = volume;
            break;
        }

        InternalVolume(volume, trackCompare);
    }
示例#11
0
        public ActionResult InsertRelatedTables(int count)
        {
            List <MeasurementViewModel> results = new List <MeasurementViewModel>();

            for (int i = 0; i < count; i++)
            {
                List <album>     albums     = new List <album>();
                List <genre>     genres     = new List <genre>();
                List <mediatype> mediaTypes = new List <mediatype>();

                using (ChinookContext context = new ChinookContext())
                {
                    for (int j = 0; j < 100; j++)
                    {
                        album newAlbum = context.albums.Create();
                        newAlbum.ArtistId = 1;
                        newAlbum.Title    = "Inserted Album " + j.ToString();
                        albums.Add(newAlbum);

                        genre newGenre = context.genres.Create();
                        newGenre.Name = "Inserted Genre " + j.ToString();
                        genres.Add(newGenre);

                        mediatype newType = context.mediatypes.Create();
                        newType.Name = "Inserted Media Type";
                        mediaTypes.Add(newType);
                    }
                    ;


                    List <track> tracks = new List <track>();
                    for (int j = 0; j < 100; j++)
                    {
                        track newTrack = context.tracks.Create();
                        newTrack.album        = albums[j];
                        newTrack.Bytes        = 123;
                        newTrack.Composer     = "Inseted Composer";
                        newTrack.genre        = genres[j];
                        newTrack.mediatype    = mediaTypes[j];
                        newTrack.Milliseconds = 123;
                        newTrack.Name         = "Inseted Track " + j.ToString();
                        newTrack.UnitPrice    = 99;

                        tracks.Add(newTrack);
                    }

                    measurement.Start();
                    context.tracks.AddRange(tracks);
                    context.SaveChanges();
                    measurement.Stop();
                    results.Add(new MeasurementViewModel()
                    {
                        memory = measurement.memory, milliseconds = measurement.milliseconds
                    });
                }
            }

            return(View("MeasurementResults", results));
        }
示例#12
0
 public void setDrums(track newDrums)
 {
     theDrums = newDrums;
     if (!(bpmSet))
     {
         songBPM = newDrums.getBPM();
         bpmSet  = true;
     }
 }
示例#13
0
 public void setBass(track newBass)
 {
     theBass = newBass;
     if (!(bpmSet))
     {
         songBPM = newBass.getBPM();
         bpmSet  = true;
     }
 }
示例#14
0
 public void setVocals(track newVocals)
 {
     theVocals = newVocals;
     if (!(bpmSet))
     {
         songBPM = newVocals.getBPM();
         bpmSet  = true;
     }
 }
示例#15
0
        public void CreateTableTrack(String ID, String DateTimeListen)
        {
            var db      = GetConnection("ownradio.db");
            var toTrack = new track {
                id = ID, datetimelastlisten = DateTimeListen
            };

            db.CreateTable <track>();
        }
示例#16
0
 public void setInstruments(track newInstruments)
 {
     theInstruments = newInstruments;
     if (!(bpmSet))
     {
         songBPM = newInstruments.getBPM();
         bpmSet  = true;
     }
 }
        protected override void OnStart()
        {
            base.OnStart();


            track[] instrumentsTracks = new track[25];
            track[] tracks            = openFiles();

            int count = 0;

            foreach (track i in tracks)
            {
                if (!(i == null))
                {
                    if (i.getType() == "i" || i.getType() == "v")
                    {
                        instrumentsTracks[count] = i;
                        count++;
                    }
                }
            }

            LinearLayout layout = (LinearLayout)FindViewById(Resource.Id.linearLayout1);

            Button none = new Button(this)
            {
                Text = "NONE"
            };

            layout.AddView(none);
            none.Click += delegate
            {
                menu.theSong.setInstruments(new track(null, null, 0, 0));
                Finish();
            };

            foreach (track i in instrumentsTracks)
            {
                if (!(i == null))
                {
                    Button btn = new Button(this)
                    {
                        Text = i.getName() + " [" + i.getBPM() + " BPM]"
                    };
                    layout.AddView(btn);
                    btn.Click += delegate
                    {
                        menu.theSong.setInstruments(i);
                        Finish();
                    };
                }
            }
            if (instruments.hasStarted)
            {
                menu.theSong.getInstruments().stop();
            }
        }
示例#18
0
 /// <summary>
 /// Set the volume of the track passed as Param.
 /// </summary>
 static public void Volume(float volume, track trackCompare)
 {
     Sound[] snds = GetSounds(trackCompare);
     for (int i = 0; i < snds.Length; i++)
     {
         if (volume >= snds[i].maxVolume)
         {
             snds[i].volume           = snds[i].maxVolume;
             snds[i].lastVolumeSetted = snds[i].maxVolume;
         }
         else
         {
             snds[i].volume           = volume;
             snds[i].lastVolumeSetted = volume;
         }
     }
     for (int i = 0; i < _AllPlaying.Count; i++)
     {
         if (string.Equals(_AllPlaying[i].track.ToString(), trackCompare.ToString()) || trackCompare == track.All)
         {
             if (_AllPlaying[i].track == soundTrack.BackgroundSound && !_bkgMuted ||
                 _AllPlaying[i].track == soundTrack.EffectSound && !_efxMuted ||
                 _AllPlaying[i].track == soundTrack.VoiceSound && !_voiceMuted || !_allMuted)
             {
                 if (volume <= 1.0f)
                 {
                     if (volume > _AllPlaying[i].maxVolume)
                     {
                         _AllPlaying[i].currentSource.volume = _AllPlaying[i].maxVolume;
                         _AllPlaying[i].lastVolumeSetted     = _AllPlaying[i].maxVolume;
                     }
                     else
                     {
                         _AllPlaying[i].currentSource.volume = volume;
                         _AllPlaying[i].lastVolumeSetted     = volume;
                     }
                     if (volume == 0.0f)
                     {
                         _AllPlaying[i].isMuted     = true;
                         _AllPlaying[i].pauseEffect = true;
                     }
                     else
                     {
                         _AllPlaying[i].isMuted     = false;
                         _AllPlaying[i].pauseEffect = false;
                     }
                 }
                 else
                 {
                     _AllPlaying[i].isMuted = false;
                     _AllPlaying[i].currentSource.volume = _AllPlaying[i].lastVolumeSetted;
                 }
             }
         }
     }
 }
示例#19
0
        /// <summary>
        /// Adds the track.
        /// </summary>
        /// <param name="track">The track.</param>
        public int AddTrack(track track)
        {
            using (var db = new musicdbEntities())
            {
                db.tracks.Add(track);
                db.SaveChanges();

                return(track.Id);
            }
        }
示例#20
0
 static private void InternalVolume(float volume, track trackCompare)
 {
     volume = Mathf.Clamp01(volume);
     _AllPlaying.ForEach(x =>
     {
         if (string.Equals(x.track.ToString(), trackCompare.ToString()) || trackCompare == track.All)
         {
             x.currentSource.volume = volume;
         }
     });
 }
        public async Task <IActionResult> Create([Bind("TrackId,Name,AlbumId,MediaTypeId,GenreId,Composer,Milliseconds,Bytes,UnitPrice")] track track)
        {
            if (ModelState.IsValid)
            {
                _context.Add(track);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(track));
        }
示例#22
0
        public void AddManyEntitiesToBigTable()
        {
            const int SizeOfTestCollection = 1000;
            var       conStr = ConfigurationManager.ConnectionStrings["chinookEntities"].ConnectionString;

            conStr = conStr.Replace("%SportFolder%", Environment.GetEnvironmentVariable("SportFolder"));
            var context      = new chinookEntities(conStr);
            var maxId        = context.tracks.Max(v => v.TrackId);
            var sw           = new Stopwatch();
            var totalAddTime = 0.0;

            for (int i = 0; i < SizeOfTestCollection; i++)
            {
                var track = new track {
                    Name = "Test" + i, MediaTypeId = 1, Milliseconds = 1, UnitPrice = 1
                };
                sw.Restart();
                context.tracks.Add(track);
                sw.Stop();
                totalAddTime += sw.ElapsedMilliseconds;
            }
            sw.Restart();
            context.SaveChanges();
            sw.Stop();
            var saveChangesAddTime = sw.ElapsedMilliseconds;

            var totalRemoveTime = 0.0;
            var removeCounter   = 0;

            foreach (var track in context.tracks.Local.ToArray())
            {
                if (track.TrackId > maxId)
                {
                    sw.Restart();
                    context.tracks.Remove(track);
                    sw.Stop();
                    totalRemoveTime += sw.ElapsedMilliseconds;
                    removeCounter++;
                }
            }

            sw.Restart();
            context.SaveChanges();
            sw.Stop();
            var saveChangesRemoveTime = sw.ElapsedMilliseconds;

            Console.WriteLine("Avarage add time:" + (totalAddTime / SizeOfTestCollection));
            Console.WriteLine("Add save changes:" + saveChangesAddTime);
            Console.WriteLine("Avarage remove time:" + (totalRemoveTime / SizeOfTestCollection));
            Console.WriteLine("Remove save changes:" + saveChangesRemoveTime);

            Assert.AreEqual(removeCounter, SizeOfTestCollection);
        }
示例#23
0
    public void StopTrack(track track)
    {
        if (track == track.Ambient)
        {
            return;
        }

        if (usedTracks.Contains(track))
        {
            usedTracks.Remove(track);
            freeTracks.Add(track);
            trackToAudioSourceMap[track][0].Stop();
        }
    }
示例#24
0
        public IHttpActionResult Addtrack([FromBody] track trackInfo)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var addedId = tracksManager.AddTrack(trackInfo);
                return(Ok(addedId));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
示例#25
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            seq.readFile(sequenceFile);
            track      acityTrack = new track();
            timingGrid acityGrid  = new timingGrid();

            acityTrack.name = "Loracity";
            acityGrid.name  = "Loracity";
            acityGrid.type  = timingGridType.freeform;
            acityTrack.totalCentiseconds = seq.totalCentiseconds;             // seq.tracks[0].totalCentiseconds;
            int saveID = seq.timingGrids[seq.timingGridCount - 1].saveID + 1;

            acityGrid.saveID = saveID;

            StreamReader reader = new StreamReader(transformFile);
            string       lineIn = "";

            string[] parts;
            long     timing;
            decimal  position;

            while ((lineIn = reader.ReadLine()) != null)
            {
                parts    = lineIn.Split('\t');
                position = decimal.Parse(parts[1]);
                timing   = (long)(position * 1000 + 5) / 10;
                if (timing > 0)
                {
                    acityGrid.AddTiming(timing);
                }
            }
            reader.Close();

            int gridIndex = seq.AddTimingGrid(acityGrid);

            acityTrack.timingGridIndex  = gridIndex;            //gridIndex
            acityTrack.timingGridSaveID = saveID;
            seq.AddTrack(acityTrack);
            string testFile = sequenceFolder + "\\Loracity Test.lms";

            //seq.WriteFile(testFile);
            seq.WriteFileInDisplayOrder(testFile);
            System.Media.SystemSounds.Exclamation.Play();
            MessageBox.Show("Try opening the test file and check for a new timing grid.", "Test Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
示例#26
0
    public void StartTrack(AudioClip clip, track track)
    {
        Debug.Log("Starting track");
        if (track == track.Ambient)
        {
            return;
        }

        if (freeTracks.Contains(track))
        {
            freeTracks.Remove(track);
            usedTracks.Add(track);
            AudioSource source = trackToAudioSourceMap[track][0];
            source.clip = clip;
            source.Play();
            source.time = background.time;
            StartCoroutine(FadeIn(source));
        }
    }
示例#27
0
        private void add_sample_data_to_db()
        {
            try
            {
                using (var db = new ChinookDbContext())
                {
                    var playlist = db.playlists.Include("tracks").FirstOrDefault();

                    if (playlist == null)
                    {
                        var new_track = new track()
                        {
                            Name = "Bad Medicine"
                        };
                        var new_playlist = new playlist()
                        {
                            PlaylistId = 0, Name = "Test playlist"
                        };
                        var ref_playlist_track = new playlist_track()
                        {
                            playlist = new_playlist, track = new_track
                        };
                        new_playlist.tracks.Add(ref_playlist_track);
                        db.playlists.Add(new_playlist);
                        db.SaveChanges();

                        Tracks.ItemsSource = new_playlist.tracks;
                    }
                    else
                    {
                        Tracks.ItemsSource = playlist.tracks; // db.playlists.Include("tracks").ToList();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Console.WriteLine("Error: \n" + ex.Message);
                if (ex.InnerException != null)
                {
                    System.Console.WriteLine("Inner Exception: \n" + ex.InnerException.Message);
                }
            }
        }
示例#28
0
    /// <summary>
    /// Return an Sound Array of the playing name with the track passed as Param.
    /// </summary>
    static public Sound[] GetSoundPlaying(track trackCompare)
    {
        List <Sound> hold = new List <Sound>();

        for (int i = 0; i < _AllPlaying.Count; i++)
        {
            if (trackCompare == track.All || string.Equals(_AllPlaying[i].track.ToString(), trackCompare.ToString()))
            {
                hold.Add(_AllSounds[i]);
            }
        }

        if (hold.Count == 0)
        {
            Debug.LogWarning("There's no: " + trackCompare.ToString() + " Track set. Check the typo");
        }

        return(hold.ToArray());
    }
示例#29
0
        private void Tracking(string descripcion)
        {
            try
            {
                bool debugService = bool.Parse(System.Configuration.ConfigurationManager.AppSettings["debugService"].ToString());

                if (debugService)
                {
                    workflowServiceEntities dbe = new workflowServiceEntities();
                    track tr = dbe.tracks.Add(new track());
                    tr.descripcion = descripcion;
                    tr.fecha       = DateTime.Now;
                    dbe.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#30
0
        public void PlayNext()
        {
            Track lastTrack = null;

            if (PlayContext != null)
            {
                for (int i = 0; i < PlayContext.Tracks.Count; i++)
                {
                    track track = PlayContext.TrackElements[i];
                    if (lastTrack != null && lastTrack.Status == Track.State.Available)
                    {
                        MusicService.Stop();
                        track.Track.Play();
                        return;
                    }
                    if (track.Track.Playing)
                    {
                        lastTrack = track.Track;
                    }
                }
            }
            try
            {
                foreach (Spider.CListView.CListViewItem t in this.PlayContext.ListView.Items)
                {
                    Track track = t.Track;
                    if (lastTrack != null && lastTrack.Status == Track.State.Available)
                    {
                        track.Play();
                        return;
                    }
                    if (track.Playing)
                    {
                        lastTrack = track;
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
        public async Task FkInsertAsync()
        {
            var db = await GetForeignKeyEnabledConnectionAsync();

            var artist = new artist()
            {
                artistid = 100,
                artistname = "Who Cares"
            };

            await db.InsertAsync(artist);

            var track = new track()
            {
                trackid = 1000,
                trackname = "Song - What Song?",
                trackartist = 100
            };

            await db.InsertAsync(track);

            var trackInViolation = new track()
            {
                trackid = 1000,
                trackname = "Hey, I'll violate the FK",
                trackartist = 1
            };

            try
            {
                await db.InsertAsync(trackInViolation);
            }
            catch (Exception ex)
            {
                var exMessage = ex.Message;
            }

            // Do the cascaded delete - 
            await db.DeleteAsync(artist);
        }
示例#32
0
    public static Boolean push(track traki)
    {
        if (HttpContext.Current.Session["lifo"] != null)
            {
                ((Stack)HttpContext.Current.Session["lifo"]).Push(traki);
                 return true;
            }
            else
            {
                // creamos la stack
                Stack sta = new Stack();
                HttpContext.Current.Session["lifo"] = sta;
                ((Stack)HttpContext.Current.Session["lifo"]).Push(traki);

                return false;
            }
    }
示例#33
0
    private static Sound[] GetSounds(track trackCompare)
    {
        Sound[] toReturn;
        List<Sound> hold = new List<Sound>();
        switch(trackCompare){
        case track.BackgroundSound:
        case track.EffectSound:
        case track.VoiceSound:
            for(int i = 0; i < _AllSounds.Length;i++){
                if(string.Equals(_AllSounds[i].track.ToString(), trackCompare.ToString())){
                    hold.Add(_AllSounds[i]);
                }
            }
            break;
        case track.All:
            for(int i = 0; i < _AllSounds.Length;i++){
                hold.Add(_AllSounds[i]);
            }
            break;
        }
        toReturn = new Sound[hold.Count];
        for(int i = 0; i<hold.Count;i++){
            toReturn[i] = hold[i];
        }

        if(toReturn == null || toReturn.Length == 0)
            Debug.LogWarning("There's no: "+trackCompare.ToString()+" Track set. Check the typo");

        return toReturn;
    }
示例#34
0
    /// <summary>
    /// Set the volume of the track passed as Param.
    /// </summary>
    public static void Volume(float volume, track trackCompare)
    {
        Sound[] snds = GetSounds(trackCompare);
        for(int i = 0; i<snds.Length;i++){
            if(volume <= 1.0f){
                snds[i].volume = volume;
                if(volume > 0.0f)
                    snds[i].lastVolumeSetted = volume;
            }
        }
        for(int i=0;i<_AllPlaying.Count;i++){
            if(string.Equals(_AllPlaying[i].track.ToString(), trackCompare.ToString()) || trackCompare == track.All)
            {
                if(_AllPlaying[i].track == soundTrack.BackgroundSound && !bkgMuted ||
                    _AllPlaying[i].track == soundTrack.EffectSound && !efxMuted ||
                    _AllPlaying[i].track == soundTrack.VoiceSound && !voiceMuted){

                    if(volume <= 1.0f){
                        _AllPlaying[i].currentSource.volume = volume;
                        if(volume == 0.0f) _AllPlaying[i].isMuted = true;
                        else _AllPlaying[i].isMuted = false;
                        if(volume > 0.0f)
                            _AllPlaying[i].lastVolumeSetted = volume;
                    }else{
                        _AllPlaying[i].isMuted = false;
                        _AllPlaying[i].currentSource.volume = _AllPlaying[i].lastVolumeSetted;
                    }
                }
            }
        }
    }
示例#35
0
    /// <summary>
    /// Mute the track passed as param.
    /// </summary>
    public static void Mute(bool mute, track compareTrack)
    {
        Volume((mute)? 0 : 999, compareTrack);
        if(compareTrack == track.BackgroundSound)
            _bkgMuted = mute;
        else if(compareTrack == track.EffectSound)
            _efxMuted = mute;
        else if(compareTrack == track.VoiceSound)
            _voiceMuted = mute;
        else if(compareTrack == track.All){
            _efxMuted = mute;
            _bkgMuted = mute;
            _voiceMuted = mute;
            _allMuted = mute;
        }

        if(!mute)
            Volume((mute)? 0 : 999, compareTrack);
    }