Esempio n. 1
0
 private void SeekToSecondInCaseIfRequired(int stream, int startAtSecond)
 {
     if (startAtSecond > 0)
     {
         if (!proxy.ChannelSetPosition(stream, startAtSecond))
         {
             throw new BassAudioServiceException(proxy.GetLastError());
         }
     }
 }
 private void InitializeBassLibraryWithAudioDevices()
 {
     if (!proxy.Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_MONO))
     {
         Trace.WriteLine("Failed to find a sound device on running machine. Playing audio files will not be supported. " + proxy.GetLastError(), "Warning");
         if (!proxy.Init(0, 44100, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_MONO))
         {
             throw new BassAudioServiceException(proxy.GetLastError());
         }
     }
 }
Esempio n. 3
0
        public object PlayFile(string pathToFile)
        {
            int stream = proxy.CreateStream(pathToFile, BASSFlag.BASS_DEFAULT);

            if (stream == 0)
            {
                throw new BassException(proxy.GetLastError());
            }

            if (!proxy.StartPlaying(stream))
            {
                throw new BassException(proxy.GetLastError());
            }

            return(stream);
        }
Esempio n. 4
0
 private void ThrowIfStreamIsInvalid(int stream)
 {
     if (!IsStreamValid(stream))
     {
         throw new BassException(proxy.GetLastError());
     }
 }
        public int PlayFile(string filename)
        {
            int stream = CreateStream(filename, BASSFlag.BASS_DEFAULT);

            if (bassServiceProxy.StartPlaying(stream))
            {
                throw new BassAudioServiceException(bassServiceProxy.GetLastError());
            }

            return(stream);
        }