Author Topic: BASS for Win64 (x64)  (Read 202840 times)

Ian @ un4seen

  • Administrator
  • Posts: 20336
BASS for Win64 (x64)
« on: 7 Oct '08 - 15:04 »


64-bit Windows versions of BASS and the add-ons can be found in the Win32 packages on the BASS webpage.

« Last Edit: 13 Nov '13 - 15:04 by Ian @ un4seen »

bertas

  • Posts: 5
Re: BASS for Win64 (x64)
« Reply #1 on: 13 Oct '08 - 15:59 »
This is great ;D.
I've just set up an x64 system running Windows Server 2008.
Did a quick try on it and it worked fine.

Thanks a lot!

BertaS

bertas

  • Posts: 5
Re: BASS for Win64 (x64)
« Reply #2 on: 13 Oct '08 - 19:10 »
Hi!

In my first try was using C++ (VS2005). This worked, but now I'm struggling with C#. :(

If I use the x86 libs and compile the C# app for x86 everything works just fine.
But if I try compile using the "Any CPU" or "x64" option and your x64 bass.dll I get a DllNotFoundException.

The dll and the executable are in the same directory. Even copying the dll to system folders didn't work.
How can that happen? ???

BTW: I#m not using the original Bass.NET. I'm just using Interop on the functions I need. :P
Example:
Code: [Select]
[DllImport("bass.dll")]
public static extern bool BASS_Init(int device, uint freq, uint flags, int win, int clsid);

Thanks in advance for all answers.

BertaS

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #3 on: 14 Oct '08 - 14:28 »
I'm not a .Net user myself, so I'm afraid I can't really help very much with that, but one possibility comes to mind... perhaps you're putting the BASS.DLL in your app's x86 build directory, while the x64 build is in another directory? :)

bertas

  • Posts: 5
Re: BASS for Win64 (x64)
« Reply #4 on: 14 Oct '08 - 17:51 »
Ok, thank you Ian.
I will try to make it work this weekend.

bertas

  • Posts: 5
Re: BASS for Win64 (x64)
« Reply #5 on: 14 Oct '08 - 20:17 »
Couldn't stop thinking about this problem and finally I got it.  ;D
I don't want to explain it all in detail, but it has to do with WinSxS and a missing manifest.
You can read about this problem in detail at http://www.davidlenihan.com/2007/07/winsxs.html.
This article is really enlightening.

In short:
The applcation manifest was missing in the C# application, telling windows which version of msvcr80.dll the application
needs. The C++ compiler generates this automatically.
What I had to do was to copy the manifest resource (RT_MANIFEST) from the C++ exe to the C# exe.
After that it worked like a charm.

I hope this helps other developers. I had to google for a few hours.

BertaS

radio42

  • Posts: 4563
Re: BASS for Win64 (x64)
« Reply #6 on: 22 Nov '08 - 14:11 »
Can you maybe post your C# manifest file here, so that others can use it as well?

Jason Reskin

  • Guest
Re: BASS for Win64 (x64)
« Reply #7 on: 26 Nov '08 - 19:04 »
Only the DLL and LIB files are included; the APIs and examples can be taken from the Win32 packages. The rest of the add-ons should also eventually be available in x64 flavour. If there is a particular add-on that you require now, let me know, and I'll see what I can do.

Please report any problems that you encounter!

As far as redistributability goes, we currently release the 32-bit and 64-bit versions of our application in the same directory (we just tack on 64, e.g. Client.exe and Client64.exe) but I don't see a way to distinguish which bass.dll we want to use since they have the same name.  Any change compiling the library to look for a bass64.dll?

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #8 on: 27 Nov '08 - 17:19 »
I'm not sure about renaming the x64 DLLs (including add-ons), it'll need some thought.

Perhaps one solution in your case would be to load BASS dynamically? If you are using any add-ons, note that you should not rename the BASS.DLL file as the add-ons expect/require it to be "BASS.DLL". So, if you want to include both the x86 and x64 versions in the same installation, you would probably have to put the DLLs in separate sub-directories. If you go one step further and also put the executables in the sub-directories, you shouldn't need to bother with any changes like dynamic loading :)

radio42

  • Posts: 4563
Re: BASS for Win64 (x64)
« Reply #9 on: 27 Nov '08 - 19:03 »
I would also recommend NOT to rename the x64 dlls.
The best solution is definitly to provide two sub-directories (one containing x86 and one containing the x64 dlls) and then loads them dynamically depending on your OS resp. target application.

bertas

  • Posts: 5
Re: BASS for Win64 (x64)
« Reply #10 on: 5 Dec '08 - 18:18 »
Because of some people still struggling with BASS x64 and C#, here is a step by step "tutorial".
I use Visual Studio 2005 for this. Because I'm using a german version of Visual Studio i translated the labels of buttons etc on the fly to english, so don't assume the phrases to be 100% correct. I did my best ;).

1. Compile your application using the target "Any CPU"
2. Open the compiled .exe file with Visual Studio via File > Open > File...
 -> The resources of the file will be shown
3. Right-Click somewhere in the resource view to open the context menu and select "Add Resource..."
4. In the following dialog click on the "User Defined" button
5. For the resource type enter RT_MANIFEST
 -> Now the new resource is opened for editing
6. THIS IS IMPROTANT: Use the property editor to assign an ID of 1 to the RT_MANIFEST resource.
7. Select the following manifest and press Ctrl + C to copy it to your clipboard.  :P
Code: [Select]
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC80.CRT" version="8.0.50727.1434" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>
8. Go to visual studio and paste the manifest into the new resource.
9. Save the executable and your done.

If it still doesn't work you have to check wich version of the Visual C++ Runtime you have installed. To do that go to C:\Windows\winsxs\. There should be a directory named something like "amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.1434_none_88de292b2fb06019" that contains the vc++ runtime. You may have noticed the "8.0.50727.1434". That is the version that has to be specified in the manifests "version" property.
If you don't have such a directory you don't have the vc++ runtime. Google for "Visual C++ Runtime" and you'll find it.

I hope this helps everyone. If not, feel free to PM me
« Last Edit: 5 Dec '08 - 18:27 by bertas »

kelarmin

  • Posts: 20
Re: BASS for Win64 (x64)
« Reply #11 on: 10 Dec '08 - 16:08 »
The process here works for me, "User Defined" is "Custom" for English VS 2008.

My question is if there is any possibilty to make this as a build script, so debugging can be done on the program.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #12 on: 11 Dec '08 - 17:31 »
Updated builds are now up (see 1st post), which don't require MSVCR80.DLL, so the manifest entry for that should no longer be needed. Let me know if it still gives any grief.

kelarmin

  • Posts: 20
Re: BASS for Win64 (x64)
« Reply #13 on: 12 Dec '08 - 15:27 »
Hey Ian, I am getting a BASS_ERROR_DRIVER when tring to initalize the system. I am using Vista x64, the program works on normal vista and xp. Any thoughts?

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #14 on: 12 Dec '08 - 17:19 »
From the mention of things working on "normal vista and xp", does that mean you're using the x86 (32-bit) version of BASS on Vista x64 too, rather than the x64 version of BASS posted here? If you are using the x64 version, did the problem just begin with the latest update, or did it happen previously too?

kelarmin

  • Posts: 20
Re: BASS for Win64 (x64)
« Reply #15 on: 12 Dec '08 - 18:36 »
I am using the x64 version of bass on the x64 machines.

I built a simple console app to test the basic init + play functionality of bass. so when i init i send IntPtr.Zero into the init for window handle and it is able to play on both the new dll(2.4.2.5) and the old dll(2.4.2.1).

The application I'm building will send the window that owns the bass instance into the init function and it will not work using either dlls.

I also built a simple window app that runs the same code as the console but sends the handle to the window, and it does play so there may just be something with my main app. I'll look into this and post if I come across any other issues.
« Last Edit: 12 Dec '08 - 19:29 by kelarmin »

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #16 on: 15 Dec '08 - 16:01 »
The BASS_ERROR_DRIVER error occurs when BASS can't initialize DirectSound for the device. Perhaps another app (or even your app) is already using the device in exclusive mode or via ASIO?

Do you have identical (in source) x86 (32-bit) and x64 (64-bit) versions of your app? If so, does the problem happen if you run the x86 version on the Vista x64 system?

kelarmin

  • Posts: 20
Re: BASS for Win64 (x64)
« Reply #17 on: 17 Dec '08 - 20:24 »
Identical code for all systems. It works on the x86 vista and XP my code doesn't work on the x64 vista only.

I made a test app that kinda mirrors how i initialize the BASS and it works. One big difference is that In my app I run a FreeBASS() function that will make sure that BASS is not initialized before I begin.
Code: [Select]
        private void FreeBASS()
        {
            try
            {
                BASS_DEVICEINFO info = new BASS_DEVICEINFO();
                for (int i = 1; Bass.BASS_GetDeviceInfo(i,info); ++i)
                {
                    Console.WriteLine("Closing: " + info.ToString());
                    Console.WriteLine(info.ToString() + " IsInitialized = " + info.IsInitialized.ToString());
                    if (info.IsInitialized)
                    {
                        Bass.BASS_SetDevice(i);
                        Bass.BASS_PluginFree(0);
                        Bass.BASS_Free();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Application Error Shutting down please start again.\r\n" + ex.Message);
                this.Close();
            }
        }

The test app will play the sound file. Any other thoughts??

Code: [Select]
    public partial class SecondWindow : Window
    {
        string m_id;
        public SecondWindow(string id)
        {
            InitializeComponent();
            m_id = id;
            this.Show();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                BASS_DEVICEINFO info = new BASS_DEVICEINFO();
                for (int i = 1; Bass.BASS_GetDeviceInfo(i, info); ++i)
                {
                    Console.WriteLine(info.name);
                    if (!Bass.BASS_Init(i, 44100, BASSInit.BASS_DEVICE_SPEAKERS, new System.Windows.Interop.WindowInteropHelper(this).Handle, null))
                        throw new Exception("Failed to initialize: " + Bass.BASS_ErrorGetCode().ToString() + " SecondaryWindow (" + m_id + ")");
                    if (!Bass.BASS_SetDevice(i))
                        throw new Exception("Set Device Failed: " + Bass.BASS_ErrorGetCode().ToString());
                    int stream = Bass.BASS_StreamCreateFile("C:\\Users\\Public\\Music\\Sample Music\\wave.mp3", 0, 0, BASSFlag.BASS_DEFAULT);
                    Bass.BASS_ChannelPlay(stream, false);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }

    public partial class Window1 : Window
    {
        List<SecondWindow> m_secondarywindows = new List<SecondWindow>();
        public Window1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            for (int i = 0; i < 2; ++i)
            {
                m_secondarywindows.Add(new SecondWindow("Window" + (i + 1).ToString()));
            }
        }
    }

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #18 on: 18 Dec '08 - 15:42 »
Identical code for all systems. It works on the x86 vista and XP my code doesn't work on the x64 vista only.

Is the x86 version of your app working on x64 Vista?

I made a test app that kinda mirrors how i initialize the BASS and it works. One big difference is that In my app I run a FreeBASS() function that will make sure that BASS is not initialized before I begin.

What happens if you add that FreeBASS stuff to your test app? That should confirm whether it is the problem :)

Btw, plugins are not tied to a particular device, so you only really need to call BASS_PluginFree(0) once (in total, not per-device) to free all plugins.

stevenmmm

  • Posts: 114
Re: BASS for Win64 (x64)
« Reply #19 on: 19 Jan '09 - 08:44 »
what is your policy regarding distributing this beta? My application is in beta (http://www.getmusicbee.com if you are interested) and i've had a surprising number of requests for a 64 bit version so was wondering it was OK to release this?
If it is OK, would it be possible to also include basscd.dll and bassflac.dll to your upgraded files? And will bass.net just run on x64 without modification?
Lastly which of the other addons will be upgraded or will that be up to the individual developers whether they decide to or not?

radio42

  • Posts: 4563
Re: BASS for Win64 (x64)
« Reply #20 on: 19 Jan '09 - 13:10 »
Regarding BASS.NET.
Yes, BASS.NET should run without modifications.
But note, that if your App is compiled using the 'For Any CPU' setting, that it will automatically run in x64 mode on a Win64 OS and such will require the x64 bass.dll

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #21 on: 19 Jan '09 - 16:21 »
what is your policy regarding distributing this beta? My application is in beta (http://www.getmusicbee.com if you are interested) and i've had a surprising number of requests for a 64 bit version so was wondering it was OK to release this?

Yes, that'll be fine. Please report how you/they get on with it :)

If it is OK, would it be possible to also include basscd.dll and bassflac.dll to your upgraded files? And will bass.net just run on x64 without modification?
Lastly which of the other addons will be upgraded or will that be up to the individual developers whether they decide to or not?

I'll look into x64 builds of BASSCD and BASSFLAC later today or tomorrow. For the 3rd-party add-ons, it will be up to the developers whether they provide x64 versions, but I think it should be possible in most cases.

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #22 on: 20 Jan '09 - 15:50 »
BASSCD and BASSFLAC builds are now included in the x64 beta package (see 1st post).

quickmic

  • Posts: 255
Re: BASS for Win64 (x64)
« Reply #23 on: 11 Mar '09 - 17:24 »
Hi

I tested the 64bit version in WinXP64 but get an Error. But this test was only 10Sec or so. Just changed the 32bit versions to the 64bit.
So before I try again...
Is it possible to mix 32bit-Bass-Plugins with 64bit stuff?
Is there anything I have to change in the APIs?
Has anybody successfully tested on a VB6 programm?
« Last Edit: 11 Mar '09 - 17:26 by quickmic »

Ian @ un4seen

  • Administrator
  • Posts: 20336
Re: BASS for Win64 (x64)
« Reply #24 on: 11 Mar '09 - 18:00 »
No, it isn't possible to mix 32-bit and 64-bit code, ie. the EXE and DLLs all have to be the same. Separate processes can be different though, eg. 32-bit command-line encoders can still be used with the 64-bit BASSenc.

I don't think it's possible to create 64-bit apps with VB6.