Exemplo n.º 1
0
 private static void RemoveSyncFromStream(AudioStream audioStream, AudioSync sync)
 {
     if (sync.Id == int.MinValue)
     {
         return;
     }
     BassMix.BASS_Mixer_ChannelRemoveSync(audioStream.ChannelId, sync.Id);
     sync.Id = int.MinValue;
 }
Exemplo n.º 2
0
        private AudioSection GetAudioSectionBySync(int channel, AudioSync audioSync)
        {
            var streamSection = GetStreamSectionByChannel(channel);

            lock (streamSection)
            {
                return(audioSync.SyncType == SyncType.AudioStreamEvent
                    ? null
                    : streamSection.AudioSections.FirstOrDefault(a => a.AudioSyncs.Any(x => x.Id == audioSync.Id)));
            }
        }
Exemplo n.º 3
0
        private static AudioSync AddSync(AudioStream audioStream, SyncType syncType, double position)
        {
            if (position == double.MinValue)
            {
                return(null);
            }

            var samplePosition = GetSamplePosition(audioStream, position);
            var audioSync      = new AudioSync {
                SyncType = syncType, Position = samplePosition
            };

            AddSyncToStream(audioStream, audioSync);

            return(audioSync);
        }
Exemplo n.º 4
0
        private static void AddSyncToStream(AudioStream audioStream, AudioSync audioSync)
        {
            lock (audioStream)
            {
                audioStream.AudioSyncs.Add(audioSync);
            }

            if (audioSync.SyncType == SyncType.Start || audioStream.DisableSyncs)
            {
                return;
            }

            audioSync.Id = BassMix.BASS_Mixer_ChannelSetSync(audioStream.ChannelId,
                                                             BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME,
                                                             audioSync.Position,
                                                             audioStream.SyncProc,
                                                             new IntPtr((int)audioSync.SyncType));
        }
Exemplo n.º 5
0
        private static void AddSyncToStream(AudioStream audioStream, AudioSync audioSync)
        {
            lock (audioStream)
            {
                audioStream.AudioSyncs.Add(audioSync);
            }

            if (audioSync.SyncType == SyncType.Start)
                return;

            audioSync.Id = BassMix.BASS_Mixer_ChannelSetSync(audioStream.Channel,
                BASSSync.BASS_SYNC_POS | BASSSync.BASS_SYNC_MIXTIME,
                audioSync.Position,
                audioStream.SyncProc,
                new IntPtr((int) audioSync.SyncType));
        }
Exemplo n.º 6
0
 private static void RemoveSyncFromStream(AudioStream audioStream, AudioSync sync)
 {
     if (sync.Id == int.MinValue) return;
     BassMix.BASS_Mixer_ChannelRemoveSync(audioStream.Channel, sync.Id);
     sync.Id = int.MinValue;
 }
Exemplo n.º 7
0
 private AudioSection GetAudioSectionBySync(int channel, AudioSync audioSync)
 {
     var streamSection = GetStreamSectionByChannel(channel);
     lock (streamSection)
     {
         return (audioSync.SyncType == SyncType.AudioStreamEvent)
             ? null
             : streamSection.AudioSections.FirstOrDefault(a => a.AudioSyncs.Any(x => x.Id == audioSync.Id));
     }
 }
Exemplo n.º 8
0
        private static AudioSync AddSync(AudioStream audioStream, SyncType syncType, double position)
        {
            if (position == double.MinValue) return null;

            var samplePosition = GetSamplePosition(audioStream, position);
            var audioSync = new AudioSync {SyncType = syncType, Position = samplePosition};
            AddSyncToStream(audioStream, audioSync);

            return audioSync;
        }