Author Topic: BASS.NET API 2.4.12.7  (Read 783564 times)

ken

  • Posts: 739
Re: BASS.NET API 2.4.6.4
« Reply #750 on: 15 Apr '10 - 07:24 »
>MarquelMedia

Since your using BassWma do you have the "basswma.dll" in outputfolder (same place as your exe and bass.dll) ?

Just after BassInit, try add this code for loading wma:  Bass.Bass_LoadPlugin("basswma.dll");

MarquelMedia

  • Posts: 7
Re: BASS.NET API 2.4.6.4
« Reply #751 on: 15 Apr '10 - 08:02 »
>MarquelMedia

Since your using BassWma do you have the "basswma.dll" in outputfolder (same place as your exe and bass.dll) ?

Just after BassInit, try add this code for loading wma:  Bass.Bass_LoadPlugin("basswma.dll");

Tried that and works for me in debug... but when i published and then installed updated version from server on my system... I lost the sound.... and still my testers did not have any sound... ???

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.4
« Reply #752 on: 15 Apr '10 - 08:32 »
See your other post too...

riesm

  • Posts: 51
Re: BASS.NET API 2.4.6.4
« Reply #753 on: 15 Apr '10 - 08:38 »
Are you using a "ClickOnce" deployment by any chance? I remember some issues about DLLs not ending up in the right place, giving me the same result at deployment: no sound. There is mention of a workaround somewhere in this board (if so, let me know, I might help you out).

riesm

MarquelMedia

  • Posts: 7
Re: BASS.NET API 2.4.6.4
« Reply #754 on: 15 Apr '10 - 08:41 »
Yes... I'm deploying via ClickOnce... Please Advise...

riesm

  • Posts: 51
Re: BASS.NET API 2.4.6.4
« Reply #755 on: 15 Apr '10 - 18:39 »
It seems that ClickOnce comes with a few security issues that some plugins cannot handle well. Below you will find code that copies the DLLs into the right directory at start and this will make your application run on Vista (it appears that Windows 7 doesn't have issues with ClickOnce and BASS).

Code: [Select]
Public Sub New()
        'Initialize BASS.NET registration
        Un4seen.Bass.BassNet.Registration("xxx@xxxx.com", "xxxxxxxxxxxxxxxxxxxx")

        'Init/ NOTE: this is to circumvent UAC issues in Vista only while click-once (clickonce) is active
        LoadBASSFile("bass.dll")
        LoadBASSFile("basswma.dll")

        ' Initializes the bass object for each soundcard
        If False = Bass.BASS_Init(-1, 44100, BASSInit.BASS_DEVICE_DEFAULT, IntPtr.Zero) Then
            MsgBox("Could not initialize sound device ")
        End If

        If False = Bass.BASS_PluginLoad("basswma.dll") Then
            MsgBox("Cannot load wma plugin")
        End If
    End Sub

    Private Sub LoadBASSFile(ByVal File As String)
        Dim p As String = My.Application.Info.DirectoryPath & "\"
        Dim pr As String = p & "bass\"
        Try
            If Not My.Computer.FileSystem.FileExists(p & File) Then
                My.Computer.FileSystem.CopyFile(pr & File, p & File)
            End If
        Catch ex As Exception
            MsgBox(ex.Message.ToString)
            MsgBox("Could not load required file " & File)

        End Try
    End Sub

Make sure that you put your bass.dll and all other plugins in a folder named 'bass' and make sure to deploy this folder in your ClickOnce setup.
Please note that NOT using ClickOnce will also fix the problem of not hearing any sounds. Furthermore, the BASS.DLL seems to be working ok, however the plugins seem to have problems with Vista and ClickONce. Hope this helps!

Cheers,
riesm
« Last Edit: 15 Apr '10 - 18:47 by riesm »

riesm

  • Posts: 51
Re: BASS.NET API 2.4.6.4
« Reply #756 on: 15 Apr '10 - 19:06 »
I found the thread that got me the solution for the ClickOnce problems: http://www.un4seen.com/forum/?topic=8824.0.

sefa

  • Guest
Re: BASS.NET API 2.4.6.4
« Reply #757 on: 23 Apr '10 - 16:15 »
doesn't work under vs2010 ??
if it does how?

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.4
« Reply #758 on: 30 Apr '10 - 16:15 »
A new pre-version of BASS.NET is available here:
   www.un4seen.com/filez/4/Bass24.Net_pre.zip

It incorporates the latest BASS_DSHOW version (v2.4.0.8) as well as the latest BASSWASAPI version (v0.0.0.2).

smoodilo

  • Guest
Re: BASS.NET API 2.4.6.4
« Reply #759 on: 26 May '10 - 11:15 »
Hi all,

I am trying to implement DShow for the first time in .NET, but I am stumbling over a few problems.
Does anyone have a simple .NET example on how to load and start a video?

I am getting errors saying 'protected memory....' when creating a dshow stream:
Chan1 = BassDShow.BASS_DSHOW_StreamCreateFile(CurrentSong, BASSFlag.BASS_DEFAULT)




radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.4
« Reply #760 on: 26 May '10 - 14:06 »
As far as I know DSHOW works as a plugin only.
So try to call "Bass.BASS_PluginLoad("bass_dshow.dll")" and then use "Bass.BASS_StreamCreateFile(...)".

smoodilo

  • Guest
Re: BASS.NET API 2.4.6.4
« Reply #761 on: 26 May '10 - 16:00 »
Ok I see....

I tried that and the file then creates without error,
but at "Bass.BASS_ChannelPlay(Chan1, False)" a videowindow is opened, but then the program hangs/stops.

Should I continue this conversation in a new thread, because I assume it has nothing to do with the .NET dll?
Or does someone have a suggestion?

Ionut Cristea

  • Posts: 1545
Re: BASS.NET API 2.4.6.4
« Reply #762 on: 26 May '10 - 16:08 »
  Can you give more detailes about media file you are trying to open?

Cheers, Sharky.

smoodilo

  • Guest
Re: BASS.NET API 2.4.6.4
« Reply #763 on: 26 May '10 - 16:29 »
  Can you give more detailes about media file you are trying to open?

Cheers, Sharky.


It's a plain .avi.
In fact sometimes I see the first frame of the video, so I can assume all codecs are there and working. But right after that everything freezes.

I'll write a little test-application this evening with only the vid part. That'll make it easier to debug.

ken

  • Posts: 739
Re: BASS.NET API 2.4.6.4
« Reply #764 on: 28 May '10 - 10:09 »
Hi Bernd,

Any idea why I sometimes app crash and I get this error (I run WPF app and some UI threads, but I don't use any unmanaged/unsafe code):

Code: [Select]
A callback was made on a garbage collected delegate of type 'Bass.Net!Un4seen.Bass.SYNCPROC::Invoke'.
This may cause application crashes, corruption and data loss. When passing delegates to unmanaged code,
they must be kept alive by the managed application until it is guaranteed that they will never be called.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.4
« Reply #765 on: 28 May '10 - 10:38 »
The SYNCPROC itself is of course running in unmanaged code - as BASS calls this callback.
So when you call "BASS_ChannelSetSync" you are passing an managed delegate (your .Net callback funktion) to unmanaged BASS!
So when BASS tries to call your callback function you must make sure it still exists.
Probably you have forgotton to keep a reference to that delegate, so that the GC collected it.

ken

  • Posts: 739
Re: BASS.NET API 2.4.6.4
« Reply #766 on: 28 May '10 - 11:15 »
The SYNCPROC itself is of course running in unmanaged code - as BASS calls this callback.
So when you call "BASS_ChannelSetSync" you are passing an managed delegate (your .Net callback funktion) to unmanaged BASS!
So when BASS tries to call your callback function you must make sure it still exists.
Probably you have forgotton to keep a reference to that delegate, so that the GC collected it.

Thanks Bernd, now I know.

/Ken

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.5
« Reply #767 on: 18 Jun '10 - 11:15 »
18.06.2010: Version 2.4.6.5 is out!

BASS: added support for v2.4.6.0
BASS_DSHOW: added support for v2.4.1.0

Full Install:
  www.un4seen.com/filez/4/Bass24.Net.zip

Lib only:
  www.un4seen.com/filez/4/Bass24.Net_update.zip

Knight_Rider

  • Posts: 131
Re: BASS.NET API 2.4.6.5
« Reply #768 on: 13 Jul '10 - 21:01 »
seems that i've found a bug:
everytime i try to call bass_dshow_loadplugin2, i get the error that it is declared as private and can't be called.

would be great if you could fix this.

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.5
« Reply #769 on: 13 Jul '10 - 21:59 »
As Bass.Net doesn't implement a BASS_DSHOW_LoadPlugin2 method  - this couldn't be a bug ;-)
Bass.Net only implements one overload for it and that is:
Code: [Select]
void BASS_DSHOW_LoadPlugin(string plugin, Guid guid, string name)
So the native BASS_DSHOW_LoadPlugin2 function doesn't exist within Bass.Net!
The reason is, that the native BASS_DSHOW_LoadPlugin2 function is actually the unicode wrapper of BASS_DSHOW_LoadPlugin.
And as Bass.Net is always unicode I named the method BASS_DSHOW_LoadPlugin within Bass.Net - which in turns calls the native BASS_DSHOW_LoadPlugin2 function. That is also the reason why you are getting such an error ;-)

Knight_Rider

  • Posts: 131
Re: BASS.NET API 2.4.6.5
« Reply #770 on: 14 Jul '10 - 09:34 »
ah okay thanks radio :)

Re: BASS.NET API 2.4.6.5
« Reply #771 on: 15 Jul '10 - 17:03 »
Hello Radio42

I've some problem with the BASSTIME in Windows 7 (Bass.net 2.4.5.2). I've an Innerexception due to an invalid call of the method Stop(). This call happend in the handled method by the timer himself ???

VB2008 seems to say the the instance of the object in not valid.

I've replaced the BassTimer by a classic VB Timer and it work fine.

Code: [Select]
' Timer initialisation
_Timer = New Bass.BASSTimer(_TimerInterval)
AddHandler _Timer.Tick, AddressOf Timer_Tick
_Timer.Enabled = True
_Timer.Start()



Private Overloads Sub Timer_Tick(ByVal sender As Object, ByVal e As System.EventArgs)

_Timer.Stop()
.....


Cheers

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.5
« Reply #772 on: 15 Jul '10 - 18:09 »
That sounds like your "_Timer" instance might have been garbage collected in between.
Are you making sure to keep a reference to your "_Timer" instance all the time?!
The BassTimer class internally uses an unmanaged windows threading timer - so when you pass a callback delegate to this timer this callback might still be called regardless, if your _Timer instance might be already garbage collected.

Re: BASS.NET API 2.4.6.5
« Reply #773 on: 16 Jul '10 - 14:19 »
Ok I understand but I never release the "Private _Timer".
But I re-instance it on each play:
Code: [Select]
_Timer = New Un4seen.Bass.BASSTimer(_TimerInterval)
AddHandler _Timer.Tick, AddressOf Timer_Tick
_Timer.Enabled = True
_Timer.Start()

I seems to come from that part. If I don't recreate the instance... I work better :P

I don't have this problem with XP.  :D

Thanks a lot for your help

Alexis

radio42

  • Posts: 4576
Re: BASS.NET API 2.4.6.5
« Reply #774 on: 16 Jul '10 - 17:02 »
That all might be a timing issue.
So make sure to stop the timer before you create a new instance!
Eg.:
Code: [Select]
// first stop any existing timer
_Timer.Stop()
_Timer.Dispose()

// then (re)create a new one
_Timer = New Un4seen.Bass.BASSTimer(_TimerInterval)
AddHandler _Timer.Tick, AddressOf Timer_Tick
_Timer.Enabled = True
_Timer.Start()