25 May '13 - 00:15 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Volume Control Problem  (Read 365 times)
summerNight
Guest
« on: 19 Aug '12 - 04:19 »
Reply with quoteQuote

Hi,

First of all, Thanks for a great library.

I am working on a simple shoutcast player project that plays a hardcoded url. Everything works fine so far and I am trying a volume control function in my project. I chose to use trackBar in Visual Studio Tools. Here's my code so far but it does not change the volume at all. All I want is volume control in my application only (not windows master volume). Here's my code for trackBar.

private void trackBar_Scroll(object sender, EventArgs e)
          {
               Bass.BASS_ChannelSetAttribute(-1, BASSAttribute.BASS_ATTRIB_VOL, trackBar.Value / (float)10);
               // Also I am not sure if -1 used above is the right choice.
               
          }

And this is how my stream is setup and works as it should..

Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero);
               int channel = Bass.BASS_StreamCreateURL("http://174.37.16.73:1725", 0,
               BASSFlag.BASS_DEFAULT, null, IntPtr.Zero);
               if (currentState == "paused")
               {
                    Bass.BASS_Start();
               }
               
               else
               {
                    Bass.BASS_ChannelPlay(channel, true);
               }

Any help will be so much appreciated. I have tried to explain the best I could. Please let me know.
Logged
catman8120
Posts: 6


« Reply #1 on: 19 Aug '12 - 04:29 »
Reply with quoteQuote

Hey summerNight,
Sorry for this empty post, my first time and I guess you cannot use the tab to indent your text.  Seems it clicks the post button.
« Last Edit: 19 Aug '12 - 04:41 by catman8120 » Logged
catman8120
Posts: 6


« Reply #2 on: 19 Aug '12 - 04:38 »
Reply with quoteQuote

Hey summerNight,
The -1 needs to be replaced by the integer value channel returned by your StreamCreateURL call.  Also whatever you have your volume slider max and mins set at the value passed to the ChannelSetAttributes must be a float between 0 and 1.  .5 is half the volume

Hope this helps.  catman8120
Logged
summerNight
Guest
« Reply #3 on: 19 Aug '12 - 05:09 »
Reply with quoteQuote

Hey catman8120,

I can't thank you enough. Works perfectly!

One more question: Any ideas about getting the Title info from the shoutcast stream? I think its an mp3 stream though. I opened the url using VLC player and the title shows up. I am so jealous now Smiley
Logged
Chris
Posts: 1507


« Reply #4 on: 19 Aug '12 - 19:38 »
Reply with quoteQuote

Hi
 Take a look into the netradio example.
Chris
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines