An update: I tried removing a Cocoa view from my audio unit, by returning
if(inID == kAudioUnitProperty_CocoaUI) {
outDataSize = 0;
outWritable = false;
return noErr;
}
in GetPropertyInfo.
Now I got the "generic view" (which is not what i thought it was) and a
button on it!. Actually a generic view - is an auto generated cocoa view,
but not the "dark" one (the "dark" view is called "Controls view"?). This
is what the auto generated generic view looks like:
http://higgs.rghost.net/60495610/image.png
Nevertheless the "dark" auto generated Controls view still doesn't have
this button on it:
http://tau.rghost.net/60495630/image.png
But the Arpeggiator AU's "dark controls view" has buttons (
http://rghost.net/60473354/image.png). The question is how did they put
them there? :)
2015-01-21 13:50 GMT+02:00 Nick <[email protected]>:
> On the other hand, there's a MIDI Arpeggiator MIDI FX Audio Unit, whose
> Generic View has buttons on it (http://rghost.net/60473354/image.png). So
> it is possible to add a button, just not documented?...
>
> 2015-01-19 20:13 GMT+02:00 Nick <[email protected]>:
>
>> Hi Christian,
>> Thank you for the response.
>> Yes i tried setting Mix and Max to the same value, which always resulted
>> in the control not displaying at all on the generic view.
>> I also tried using |=, and i have just tried setting
>> kAudioUnitParameterFlag_HasCFNameString and
>> kAudioUnitParameterFlag_ValuesHaveStrings.
>> Still nothing.
>>
>> Apparently Apple just "broke" this option for us in the latest MainStage
>> and Logic.
>> I also checked various audio units, that come with Logic Pro, and none of
>> them had a button on their generic view.
>>
>>
>> 2015-01-19 18:50 GMT+02:00 Christian Rober <[email protected]>:
>>
>>> These are just a few shots in the dark:
>>>
>>> 1. Have you tried setting the max value to the same thing as the min
>>> and the default? I only suggest this because of Mr. Stewart's
>>> comment, in the linked post, about state-less parameters (i.e.
>>> booleans with write-only flag) being perceived by the generic view as
>>> a button. Maybe the host checks the min vs. the max and when it sees
>>> a difference between the two it decides the user needs a state-ful
>>> control.
>>>
>>> 2. Have you tried different combinations of
>>> kAudioUnitParameterFlag_HasCFNameString and
>>> kAudioUnitParameterFlag_ValuesHaveStrings? Maybe the view is trying
>>> to create a button, but is expecting one or both of those flags to be
>>> set. Since it doesn't see them, it might just create an empty button,
>>> or skip creating a button altogether. You may be clobbering those
>>> string flags when you set it to writable. You may just need to set
>>> the writable flag using " |= " instead of " = ".
>>>
>>> --Christian
>>>
>>> On Mon, Jan 19, 2015 at 2:05 AM, Nick <[email protected]> wrote:
>>> > Hello
>>> > I had asked this already, but apparently the message got lost.
>>> > Anyways, sorry if you're reading this a second time.
>>> >
>>> > I have created an Audio unit with an accompanying Cocoa view.
>>> >
>>> > An ordinary audio unit, that we can add to a Logic or MainStage
>>> project,
>>> > mainly consists of two parts - an Audio Unit Kernel and an Audio Unit
>>> View,
>>> > and they are designed to be separate things and "communicate" by
>>> changing
>>> > parameters.
>>> >
>>> > The Audio Unit view can be presented by the host (by Logic Pro X, for
>>> > example) either as a nicely drawn cocoa view
>>> > (http://rghost.net/60432973/image.png), which is an NSView from a xib,
>>> > loaded from the AudioUnit's bundle, or you can select in a drop-down
>>> menu
>>> > the "Controls" option (http://rghost.net/60432978/image.png) and get
>>> an
>>> > ascetic dynamically generated view (
>>> http://rghost.net/60432987/image.png).
>>> > This dynamically generated view (or "Generic" view) is generated by
>>> the host
>>> > application, based on what your audio unit's function returns in its
>>> > AudioUnitParameterInfo parameter:
>>> >
>>> > OSStatus GetParameterInfo(AudioUnitScope inScope, AudioUnitParameterID
>>> > inParameterID, AudioUnitParameterInfo &outParameterInfo)
>>> >
>>> > So if you return the following, you'll get a checkbox with the title
>>> "Hey
>>> > there":
>>> >
>>> > AUBase::FillInParameterName (outParameterInfo,
>>> > CFSTR("Hey there"), false);
>>> >
>>> > outParameterInfo.unit =
>>> kAudioUnitParameterUnit_Boolean;
>>> >
>>> > outParameterInfo.minValue = 0;
>>> >
>>> > outParameterInfo.maxValue = 1;
>>> >
>>> > outParameterInfo.defaultValue = 0;
>>> >
>>> > outParameterInfo.flags =
>>> > kAudioUnitParameterFlag_IsWritable |
>>> kAudioUnitParameterFlag_IsReadable;
>>> >
>>> >
>>> > This was the introduction.
>>> > Now back to the question.
>>> >
>>> > I would like to have a Push Button on my autogenerated by the host
>>> "Generic
>>> > View".
>>> > And I can't figure out how to do this.
>>> >
>>> > My research showed that this used to be possible by declaring a write
>>> only
>>> > boolean parameter in GetParameterInfo. Here's some links that prove
>>> this:
>>> >
>>> > http://lists.apple.com/archives/coreaudio-api/2005/Jun/msg00023.html
>>> > http://lists.apple.com/archives/coreaudio-api/2005/May/msg00280.html
>>> > http://lists.apple.com/archives/coreaudio-api/2005/Jul/msg00032.html
>>> >
>>> > The problem is that when I declare a write only boolean param, no
>>> control
>>> > appears in the Generic view of Logic Pro X or Mainstage 3.
>>> > If I declare a read only boolean param, all I see is a disabled
>>> control with
>>> > "< off >" text on it.
>>> > If i declare a read-write boolean param, I am getting a check box (the
>>> last
>>> > is the correct behavior)
>>> >
>>> > Apart from the kAudioUnitParameterUnit_Boolean, I have tried other
>>> types
>>> > (kAudioUnitParameterUnit_Indexed, kAudioUnitParameterUnit_Generic),
>>> tried
>>> > setting the "kAudioUnitParameterFlag_IsWritable" and
>>> > "kAudioUnitParameterFlag_IsReadable" together and separately. To no
>>> avail -
>>> > I can't manage to get a button on the generic view.
>>> >
>>> > So how to get a regular push button on generic view?
>>> >
>>> >
>>> >
>>> > _______________________________________________
>>> > Do not post admin requests to the list. They will be ignored.
>>> > Coreaudio-api mailing list ([email protected])
>>> > Help/Unsubscribe/Update your Subscription:
>>> >
>>> https://lists.apple.com/mailman/options/coreaudio-api/recapitch%40gmail.com
>>> >
>>> > This email sent to [email protected]
>>>
>>
>>
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com
This email sent to [email protected]