Notification of volume(HD) arrival/removal


#1

Hi Jules,

I was wondering if it would be possible to add support for the notification of volume arrival/removal in Juce.

On Windows, it’s related to
WM_DEVICECHANGE with DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE
for the dbch_devicetype equals to DBT_DEVTYP_VOLUME

On Mac, it’s related to kEventClassVolume event class
with kEventVolumeMounted and kEventVolumeUnmounted as event kind

Don’t know much about linux though.

Thanks,


#2

Thanks, that’s been requested before, but thanks for the helpful hints!


#3

Don’t know if this is helpful…

- (id)initWithDelegate
{
if (![super init])
		return nil;
[[[NSWorkspace sharedWorkspace]notificationCenter]addObserver:self selector:@selector(volumeMountedNotification:) name:NSWorkspaceDidMountNotification object:nil];
	[[[NSWorkspace sharedWorkspace]notificationCenter]addObserver:self selector:@selector(volumeUnMountedNotification:) name:NSWorkspaceDidUnmountNotification object:nil];
return self;
}
- (void)dealloc
{
	[[[NSWorkspace sharedWorkspace]notificationCenter]removeObserver:self];
	[super dealloc];
}
- (void)volumeMountedNotification:(NSNotification*)note
{

 DBG([[note userInfo]objectForKey:@"NSDevicePath"]));


}
- (void)volumeUnMountedNotification:(NSNotification*)note
{
	DBG(nsStringToJuce([[note userInfo]objectForKey:@"NSDevicePath"]));
		
}

#4

Following this, I was wondering what would be best way to hook the Windows message queue from juce in order to have some custom handling of those message ?
It’s been a long time since I’ve not done anything win32 SDK related.

Thanks,