Jump to content

BASS_ChannelGetInfo question


Recommended Posts

Hi to all, i've a problem with this function...

I want to know the filename of streaming, i use that code :

$Nowplaying = _BASS_ChannelGetInfo ($MusicHandle)
If $Nowplaying[7] <> ""  Then
MsgBox (0,"Hey!",$Nowplaying[7])
EndIf

All work good with mp3 radio streaming, but with WMA streaming it give me always the string "m". How i can fix that? I want know the real filename of WMA streaming.

BASS guru come on =P

Hi!

Link to comment
Share on other sites

Are you using the basswma.dll with this?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

I would post on the forums for the bass.dll at http://www.un4seen.com/forum/?board=1, it may be that the files don't support that for wma streams. The developers of the dll would be the best to answer that question.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

He tell me that :

The filename is probably Unicode (BASSWMA will convert ANSI to Unicode as that is what the Windows Media library requires). To confirm whether that is the case, you can check if the BASS_UNICODE flag is present in the BASS_CHANNELINFO "flags" value. The WideCharToMultiByte function can be used to convert it back to ANSI if needed.

And :

Re: Buffering issue...

« Reply #7 on: 18 Feb '11 - 13:22 »

Reply with quoteQuote

That solitary "m" is a sign of a Unicode string Smiley ... The full byte sequence will be 'm', 0, 'm', 0, 's', 0, ':', 0, etc.

The WideCharToMultiByte is a Windows function. Details can be found here...

http://msdn.microsoft.com/en-us/library/dd374130.aspx

In C/C++, it could be used like this...

BASS_CHANNELINFO ci;

BASS_ChannelGetInfo(handle, &ci); // get info

if (ci.flags&BASS_UNICODE) { // the filename is Unicode

int n=WideCharToMultiByte(CP_ACP, 0, ci.filename, -1, 0, 0, 0, 0); // get required buffer size

char *ansi=(char*)alloca(n); // allocate a buffer

WideCharToMultiByte(CP_ACP, 0, ci.filename, -1, ansi, n, 0, 0); // do the conversion

// do something with "ansi" filename

} else { // the filename is ANSI

// do something with "ci.filename"

}

But he cant help me in autoit...have you understand what he would tell me?

Hi!

Link to comment
Share on other sites

Bass_channelgetinfo returns the unicode flag in the array element 2 according to the information in the UDF, it may be combined with other flags in that array element, you'll have to determine what that flag tells you about the stream. The value for $BASS_UNICODE is 0x80000000.

Once you've found out whether it's Unicode or not you'll have to figure out how to display it so that you can read it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

i do this code :

$Nowplaying = _BASS_ChannelGetInfo ($MusicHandle)
                If $Nowplaying[2] And $BASS_UNICODE <> 0 Then
                    MsgBox (0,"Hey!","This is an UNICODE string!")
                EndIf

But it tell me always that is unicode, with a lot of stream link (Possible!?)...how i can know if is an unicode or not?...if is unicode how i can really display the value?

Hi!

Edited by StungStang
Link to comment
Share on other sites

I don't think this return parameter of _BASS_ChannelGetInfo() is very useful.

The returned URL is the same as the stream name you called,

the function might just be returning your selected URL.

However, there is an error in _BASS_ChannelGetInfo().

It always returns False for Unicode because BitOR was used instead of BitAND.

Open up Bass.au3 and edit _BASS_ChannelGetInfo()

Place cursor on _BASS_ChannelGetInfo() in SciTE and Press Ctrl-J to open Bass.au3 at line 3042

Change this line [3052]:

$aRet[7] = _BASS_PtrStringRead(DllStructGetData($dsInfo, 8), Bitor($aRet[2], $BASS_UNICODE)=$BASS_UNICODE)

To this:

$aRet[7] = _BASS_PtrStringRead(DllStructGetData($dsInfo, 8), BitAND($aRet[2], $BASS_UNICODE)=$BASS_UNICODE)

I see fascists...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...