-
Notifications
You must be signed in to change notification settings - Fork 20
portaudio.vapi #7
base: master
Are you sure you want to change the base?
Conversation
Looks like that is the case upstream, and has been for 7 years or so, so renaming that seems reasonable.
That seems reasonable, but why did you make them pointers when passed as arguments? In Vala, we try to only use pointers when there are no other options. Based on a quick look I don't think the parameters need to be anything special (only [SimpleType] structs are passed by value). Other options are making the arguments nullable, out, or ref.
Instead of making them static methods, why not instance methods ("get_info", perhaps) in HostApiIndex and DeviceIndex? If you really want to keep them where they are, something other than "get" for the name would be better ("from_index", perhaps?).
In order to keep the size down we don't include test cases or examples in the vala-extra-vapis repository. |
|
Yes, nullable struct will map to a pointer. So, assuming null is a valid value, the arguments to Stream.open should be "Stream.Parameters?", not "Stream.Parameters*". If you just want a pointer but it shouldn't be nullable then "Stream.Parameters" should do the trick. The only time Vala will pass something that isn't a pointer is if the type is annotated with [SimpleType], which Stream.Parameters is not.
Not sure what you're trying to say here. I'm not suggesting you create a wrapper. I'm suggesting something like: public class DeviceIndex {
[CCode (cname = "Pa_GetDeviceInfo")]
public unowned DeviceInfo get_info ();
} which would be my preference. Or, if you prefer: public class DeviceInfo {
[CCode (cname = "Pa_GetDeviceInfo")]
public unowned DeviceInfo from_index (DeviceIndex index);
} Or both. Methods named "get" are typically used for containers in order to retrieve a child, |
we have "public struct DeviceIndex : int {}" |
So? public struct DeviceIndex : int {
[CCode (cname = "Pa_GetDeviceInfo")]
public unowned DeviceInfo get_info ();
} |
I know that function with this signature can be naturally translated to method of DeviceIndex but I preffer to consider DeviceIndex as a synonym of type int and think that Pa_GetDeviceInfo is something about DeviceInfo object taken from system by index. But OK, writting both is good. |
I tried to use portaudio.vapi and found next problems: