setTags Error - nBass

Started by cab0San,

cab0San

I'm using the wmaEconder class to broadcast. I get an error the second time I try to set the tags - "Some Other Mystery Error". I saw that there was a similar problem in the thread "Re: getting error 37 using bass_wma"

I'm guessing that it is due to the fact that the encoder does not run in the main process (I am starting a new thread). Anyway, I was wondering:

A. Is there a fix/workaround (other than Media Player 9)
B. Am I doing it the right way? (example below)


 nwE = nBASS.WMAEncoder.OpenEncoderNetwork(44100, _
            EncoderFlags.Tags, bitrate, port, clients)

Do Until iSaySo
  nwE.SetTag(WMATag.Author, "MyAuthor")
  nwE.SetTag(WMATag.Title, "MyTitle")
  nwE.SetTagDone()
  playSong(nextSong())
Loop

Sub playSong(ByVal sFile As String)
  stream = BASS.LoadStream(False, sFile, _
                0, 0, StreamFlags.DecodeOnly)
Do
         length = stream.GetData(buffer, buffer.Length)
         nwE.Write(buffer, length)
Loop While length > 0 And stream.ActivityState = State.Playing

End Sub

Ian @ un4seen

It's probably because COM has not been initialized on the thread... try calling CoInitialize at the start of the thread, and CoUninitialize at the end.

cab0San

I tried that, but no luck.

The apartment state is initialized at the beginning of the program using the <MTAThread()> attribute.  I believe that VB.NET inititalizes COM using the CoInitializeEx, and you only have control over the type through the use of the <MTAThread()> attributes.
I'm pretty new to all this, so it's quite possible I've missed something... any ideas where I could look?

leppie


QuoteI tried that, but no luck.

The apartment state is initialized at the beginning of the program using the <MTAThread()> attribute.  I believe that VB.NET inititalizes COM using the CoInitializeEx, and you only have control over the type through the use of the <MTAThread()> attributes.
I'm pretty new to all this, so it's quite possible I've missed something... any ideas where I could look?


I had the same problem when doing it. It appears tag cant be set once the "streaming" starts. It has to be restart. I'm not sure if this is the way its intended, as I'm just mimicking behaviour thru nBASS.

Ian @ un4seen

Ah yes, looking at the posted code again now, that's what the problem is :)

It is indeed not possible to set standard tags once encoding has begun. BASSWMA 1.8 will allow "mid-stream" tags (script)... in fact, this very subject came up just a few days ago:

http://www.un4seen.com/YaBB.cgi?board=bass&action=display&num=1043699932