Author Topic: Issue with BASS_ASIO_ControlPanel  (Read 1846 times)

aybe

  • Posts: 145
Issue with BASS_ASIO_ControlPanel
« on: 7 Nov '10 - 02:56 »
Hi,

Whatever settings I change with the Control Panel never
gets refreshed until I Free then Init the device again.
The notification are being set correctly but they are
never triggered during a buffer size change, for instance.
(Even when I change the rate)

On something like Nuendo, it works, but not on Wavelab
surprisingly, (you need to re-open the settings window)

I think it should behave like ShowDialog() against Show()
where we can't continue till' we closed the Control Panel;
or getting a notification, if possible.

I did try something stupid and it was, re-initializing
the device every N seconds, now it works perfectly
but sometimes it just crashes everything, it closes the panel,
and the application, very quickly.

Well, if I switch to another device and revert to this one,
the changes are being seen, but I'd like not having to do that.

Can this be addressed by BASS ?

Or should I just forget about it or do something like
checking again when I close that window, for instance ?

Thank you  :D
« Last Edit: 7 Nov '10 - 03:03 by aybe »

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Issue with BASS_ASIO_ControlPanel
« Reply #1 on: 8 Nov '10 - 13:54 »
To confirm, you want to immediately apply changes that are made in the ASIO driver's control panel? Have you called BASS_ASIO_SetNotify to set an ASIONOTIFYPROC callback function to receive reinitialization requests (BASS_ASIO_NOTIFY_RESET), and if so, are you receiving them? Note that you should not reinitialize the device within the ASIONOTIFYPROC function, but rather signal some other thread (eg. post a message to the main thread) to do it.

aybe

  • Posts: 145
Re: Issue with BASS_ASIO_ControlPanel
« Reply #2 on: 9 Nov '10 - 00:51 »
Yes I have set a notification from an ASIONOTIFYPROC but it's never triggered.
And no, I don't re-initialize it from here.

I'm running onto other different issues which I'm going to talk in a new thread,
meanwhile, I think I will overcome this by simply adding a button
to apply 'external' changes (control panel changes).

Thank you !


Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Issue with BASS_ASIO_ControlPanel
« Reply #3 on: 9 Nov '10 - 15:25 »
Yes I have set a notification from an ASIONOTIFYPROC but it's never triggered.

Are changes in the same device/driver's control panel apparently taking immediate effect in other ASIO software? If so, what thread are you calling BASS_ASIO_ControlPanel from? It should generally be the main thread (some drivers may not like it in another thread). Speaking of which, you could also give the latest build a try (which includes some threading tweaks)...

   www.un4seen.com/stuff/bassasio.dll

aybe

  • Posts: 145
Re: Issue with BASS_ASIO_ControlPanel
« Reply #4 on: 9 Nov '10 - 16:26 »
Alright I'm going to give this a try and let you know.

But I think on Nuendo they are hacking it in some way, well it's Steinberg after all;
it does apply almost instantly.

On Wavelab it doesn't, the params get updated once you close the options dialog,
for a very brief time you can see the new value just before it closes.

Thanks

aybe

  • Posts: 145
Re: Issue with BASS_ASIO_ControlPanel
« Reply #5 on: 9 Nov '10 - 17:32 »
It ain't better, just the same, not triggered

Here's my code, I don't think there's an error but who knows ...

Code: [Select]
using System;
using System.ComponentModel;
using System.Windows;
using Un4seen.BassAsio;

namespace testsdelme
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        private ASIONOTIFYPROC _asionotifyproc;

        public MainWindow()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!BassAsio.LoadMe())
                return;

            if (!BassAsio.BASS_ASIO_Init(1))
                return;

            _asionotifyproc = proc;
            bool notify = BassAsio.BASS_ASIO_SetNotify(_asionotifyproc, IntPtr.Zero);
        }

        private void proc(BASSASIONotify notify, IntPtr user)
        {
            switch (notify)
            {
                case BASSASIONotify.BASS_ASIO_NOTIFY_RATE:
                    break;
                case BASSASIONotify.BASS_ASIO_NOTIFY_RESET:
                    break;
                default:
                    throw new ArgumentOutOfRangeException("notify");
            }
        }

        protected override void OnClosing(CancelEventArgs e)
        {
            bool bassAsioFree = BassAsio.BASS_ASIO_Free();
            bool freeMe = BassAsio.FreeMe();
            base.OnClosing(e);
        }

        private void buttonControlPanel_Click(object sender, RoutedEventArgs e)
        {
            bool controlPanel = BassAsio.BASS_ASIO_ControlPanel();
        }
    }
}

They all return straight away except for the Steinberg Asio driver, just like previously.
In case you wonder, all functions return true every time.

Thank you  ;D

Ian @ un4seen

  • Administrator
  • Posts: 20433
Re: Issue with BASS_ASIO_ControlPanel
« Reply #6 on: 10 Nov '10 - 14:10 »
It ain't better, just the same, not triggered

OK, it was a long shot :)

Here's my code, I don't think there's an error but who knows ...

Code: [Select]
...
            _asionotifyproc = proc;
            bool notify = BassAsio.BASS_ASIO_SetNotify(_asionotifyproc, IntPtr.Zero);
...

I'm not a .Net user, so I'm not certain, but perhaps that should look like this?

Code: [Select]
            _asionotifyproc = new ASIOPROC(proc);
            bool notify = BassAsio.BASS_ASIO_SetNotify(_asionotifyproc, IntPtr.Zero);

They all return straight away except for the Steinberg Asio driver, just like previously.

Yep, some drivers' control panels are "modal" (block the calling thread until closed) while others aren't.

radio42

  • Posts: 4576
Re: Issue with BASS_ASIO_ControlPanel
« Reply #7 on: 10 Nov '10 - 14:26 »
Yes, Ian's assumption is correct - your delegate signature is incorrect!
Use it just as Ian posted!

aybe

  • Posts: 145
Re: Issue with BASS_ASIO_ControlPanel
« Reply #8 on: 10 Nov '10 - 15:52 »
Hello everyone,

Nice try but, you're right it should be like that but it also works when you don't create an instance of it.
This can be as is providing it's not happening in the field initializer.

Being desperate I did try that already before writing to you.

Also, I just found out that Nuendo definitely frees/inits the device each time there's a change,
because the ASIO4ALL notify icon just re-appears on every change.

Well, I think I'll just stop here and do what I said : add an apply Control Panel changes button.

Thank you anyway  :D