How to get preferred channel layout from CoreAudio - macos

I was wondering if anyone know how to get preferred channel layout from CoreAudio. I try to use kAudioDevicePropertyPreferredChannelLayout to get the channel label. However, it always shows kAudioChannelLabel_Unknown value. Is there something driver issue? or it's necessary to set some properties before asking kAudioDevicePropertyPreferredChannelLayout.
my code is here:
https://gist.github.com/ChunMinChang/ea74c8228745449873716e1d98ba956e/e61fedea3e08bcff64ef3db05931a1c757768d70

Answer by myself.
Instead of kAudioDevicePropertyPreferredChannelLayout, Using kAudioUnitProperty_AudioChannelLayout allow me to get the correct channel configuration.
Maybe it would be better if we use kAudioDevicePropertyPreferredChannelLayout to get the layout first. If it returns Unknown, then we use kAudioUnitProperty_AudioChannelLayout to get it.
Code: https://gist.github.com/ChunMinChang/ea74c8228745449873716e1d98ba956e/96b5d39e3fa7d5d6e160c53917b213f9af3ba2c9#file-preferredchannellayout-cpp

Related

Discord.py: Overwrites of channel for member not working

O = discord.PermissionOverwrite()
O.manage_webhooks=True
User=get(ctx.guild.members, name="User1")
await chan.set_permissions(User, overwrite=O)
What I'm doing wrong?
I get no errors but the channels permission for the member doesn't change.
Help me please.
First, there's a built in method called get_member that I strongly suggest you use, simply using a user name is pretty easy to get messed up as someone could just change their name. But it seems your code is rather sound, so some more information (if you need to use user name) such as how you're calling this and what get exactly is would help a ton!

BluetoothGATTSetCharacteristicValue return Invalid Handle "E_HANDLE"

I am trying to use BluetoothGATTSetCharacteristicValue to set a value for a given characteristic in a service. I read in the method documentation that it needs a handle to the service which I don't know how to obtain it.
I tried to use the "ServiceHandle" member of the BTH_LE_GATT_CHARACTERISTIC structure but it doesn't work.
I found the solution and I would like to share it here.
The only way to open a handle on the service is to use the UUID of the service instead of the UUID of the device while enumerating the devices using the method SetupDiGetClassDevs.
Please check the following thread for more details.
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/65c9cf4e-e225-4fc3-8c2c-66cd2401d3ed/how-to-establish-a-connection-from-windows-8-pc-to-a-bluetooth-low-energy-device?forum=wdk

Putting groovy gorm code in config file error?

I am using this, Saving-User-last-login-Time-in-Grails, simple tutorial to add lastLoginTime to User. So, everytime a user logs in, the last signed in date/time is saved to database. I followed the steps, provided in the tutorial, exactly. But end-up getting this error.
No signature of method: groovy.util.ConfigObject.withTransaction() is
applicable for argument types: (Config$_run_closure3_closure11)
values: [Config$_run_closure3_closure11#12fab25]
Looks like the Gorm code, in Config.groovy file, is not respected. Does anyone know, where else should I move the code to solve this problem?
Any help is much appreciated. Thanks.
Try application.groovy, instead. For details, refer registeringCallbackClosures.
For more insight, and other approaches to achieve similar behaviour, see Events.

How can Customizing the IMFByteStream?

. Hello All?
I want to customize IMFByteStream interface, but i'm facing some problems.
Before explains my problems, describes how to create from what i've got.
First, customized IMFByteStream has IMFByteStream's instance that created using MFCreateFile method. Therefore, we need to implement the necessary ones (For example, BeginRead, Read, etc..)
Second, we need to decrypt to the received data. Because the file was encrypted.
As a result, the read sequence was following.
CustomByteStream::BeginRead() -> CustomByteStream::Read() -> IMFByteStream::Read() -> CustomByteStream::Decrypt() -> Passes the decrypted data.
But, I don't know how to pass the data. AsyncResult or AsyncCallback should I use? I don't know how.
Please help me. Thank you.
If you implement IMFByteStream, you have to implement IMFAsyncCallback too.
I can't explain here. But when i will update my project with Mpeg2 source: MFNode
you will see an implementation of IMFByteStream. I use it because original IMFByteStream fails on some video files with no reason. My implementation works well with all files i've tested. (For now my implementation does not handle big file.)
Edit: i checked my code. I don't implement IMFByteStream. i created a class that acts like IMFByteStream. I implement IMFAsyncCallback for BeginRead/EndRead.

Using DiskVolumeInfo (Cluster Failover API)

I found the DiskVolumeInfo property -- I'd like to use it to get some disk information in a clustered setup.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb309235(v=vs.85).aspx
The problem is I have no idea what technology is required to get this data. This doesn't resemble the standard C/C++/C#/VB format of function/method reference.
Question: How do I get the DiskVolumeInfo data?
Ideally I could write the binary output directly to a file, say data.bin.
Any ideas would be helpful, thanks.
The process for getting object properties is described here.
Looks like you need to call the ClusterResourceControl function with a handle to the physical disk resource and the CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES control code. You can then use ResUtilFindBinaryProperty to extract the DiskVolumeInfo property from the property list returned.
For anyone still interested:
As given here CLUSCTL_RESOURCE_STORAGE_GET_DISK_INFO_EX is a better way to do this.

Resources