Пример #1
0
        public int NoteOn()
        {
            var sound  = audContent.GetSFX(Patch);
            int length = ((byte[])sound.Target).Length;

            if (length != 1) //1 byte length array is returned when no sound is found
            {
                IntPtr pointer = sound.AddrOfPinnedObject();
                int    channel = Bass.BASS_StreamCreateFile(pointer, 0, length, BASSFlag.BASS_DEFAULT | BASSFlag.BASS_STREAM_AUTOFREE);
                Bass.BASS_ChannelSetAttribute(channel, BASSAttribute.BASS_ATTRIB_VOL, Volume);
                Bass.BASS_ChannelSetAttribute(channel, BASSAttribute.BASS_ATTRIB_PAN, Pan);
                Bass.BASS_ChannelPlay(channel, false);

                var entry = new HITNoteEntry(channel);
                Notes.Add(entry);
                NotesByChannel.Add(channel, entry);
                return(Notes.Count - 1);
            }
            return(-1);
        }
Пример #2
0
        /// <summary>
        /// Plays a note and loops it.
        /// </summary>
        /// <returns>-1 if unsuccessful, or the number of notes in this thread if successful.</returns>
        public int NoteLoop() //todo, make loop again.
        {
            var sound = audContent.GetSFX(Patch);

            if (sound != null)
            {
                var instance = sound.CreateInstance();
                instance.Volume = Volume;
                instance.Pan    = Pan;
                instance.Play();

                var entry = new HITNoteEntry(sound, instance, Patch, TickN);
                Notes.Add(entry);
                NotesByChannel.Add(instance, entry);
                return(Notes.Count - 1);
            }
            else
            {
                Debug.WriteLine("HITThread: Couldn't find sound: " + Patch.ToString());
            }
            return(-1);
        }
Пример #3
0
        public int NoteOn()
        {
            var sound = audContent.GetSFX(Patch);

            if (sound != null)
            {
                var instance = sound.CreateInstance();
                instance.Volume = Volume;
                instance.Pan = Pan;
                instance.Play();

                var entry = new HITNoteEntry(instance, Patch);
                Notes.Add(entry);
                NotesByChannel.Add(instance, entry);
                return Notes.Count - 1;
            }
            else
            {
                Debug.WriteLine("HITThread: Couldn't find sound: " + Patch.ToString());
            }

            return -1;
        }