コード例 #1
0
 /// <summary>
 /// Legacy channel access method.  Should be avoided in favor of csound 6's new thread-safe
 /// access methods as used in subclasses.
 /// Used internally by Get/SetValueDirect methods in subclasses ideally called from
 /// within the same thread between calls to PerformKsmps or PerformBuffer.
 /// If used between different threads (not recommended - use threadsafe property "Value" instead),
 /// you should acquire and use a lock (see GetLock method) to arbitrate potential race conditions.
 /// </summary>
 /// <returns>a pointer to unmanaged memory where the channel's data begins</returns>
 internal IntPtr GetChannelPointer()
 {
     if (m_pChannel == IntPtr.Zero)
     {
         int          flags  = ((int)Type) + (int)(((uint)Direction) << 4);
         CsoundStatus result = Csound6Net.Int2StatusEnum(NativeMethods.csoundGetChannelPtr(m_csound.Engine, out m_pChannel, Name, flags));
         if (((int)result) < 0)
         {
             throw new Csound6NetException(Csound6NetException.ChannelAccessFailed, Name, result);
         }
     }
     return(m_pChannel);
 }
コード例 #2
0
        /**
         * \addtogroup PARAMETERS
         * @{
         */

        /// <summary>
        /// Static implementation of SetOption to allow parameter setting
        /// without instantiating a Csound6Parameters object just to set a single parameter.
        /// </summary>
        /// <param name="csound">the current running instance of csound via Csound6Net</param>
        /// <param name="option">a string containing a single command line parameter spec (without spaces)</param>
        /// <returns>Success if parameter spec was understood and used.  Other codes imply failure.</returns>
        public static CsoundStatus SetOption(Csound6Net csound, string option)
        {
            return(Csound6Net.Int2StatusEnum(NativeMethods.csoundSetOption(csound.Engine, option)));
        }