コード例 #1
0
 public Csound6GlobalVariable(string _name, int _size, Csound6Net csound)
 {
     m_csound = csound;
     Size     = _size;
     Name     = _name;
     if (NativeMethods.csoundCreateGlobalVariable(csound.Engine, _name, (uint)_size) != 0)
     {
     }
 }
コード例 #2
0
 /**
  * \addtogroup TABLES
  */
 /// <summary>
 /// Creates a table (proxy) to front an actual table (function) in csound.
 /// This object can be used to manage table values in csound or to take copies for local examination.
 /// </summary>
 /// <param name="fNbr">the function number as defined in a csound score (more than 1)</param>
 /// <param name="csound64"></param>
 public Csound6Table(int fNbr, Csound6Net csound64)
 {
     m_csound64 = csound64;
     Fnumber    = fNbr;
     if ((fNbr > 0) && (csound64 != null))
     {
         m_cachedLength = NativeMethods.csoundTableLength(m_csound64.Engine, Fnumber);
     }
 }
コード例 #3
0
 protected virtual void Dispose(bool disposing)
 {
     if ((m_csound != null) && (m_buffer != IntPtr.Zero))
     {
         NativeMethods.csoundDestroyCircularBuffer(m_csound.Engine, m_buffer);
         m_buffer = IntPtr.Zero;
     }
     m_csound = null;//dereference
 }
コード例 #4
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         m_csound = null;
     }
     if (m_pChannel != IntPtr.Zero)
     {
         //m_pChannel is not pointing to memory we manage, so no need to release it.
         m_pChannel = IntPtr.Zero;//drop reference to csound unmanaged bus memory, csound will release on its own
     }
 }
コード例 #5
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);
 }
コード例 #6
0
 /// <summary>
 ///
 /// </summary>
 public Csound6RandMT() :
     this((Int32)Csound6Net.GetRandomSeedFromTime())
 {
 }
コード例 #7
0
 /// <summary>
 /// Populates abstract superclass values supplied as from concrete channel subclasses.
 /// </summary>
 /// <param name="_name">Name the channel is known by to csound</param>
 /// <param name="_direction">one or both members (Ored to gether) of the ChannelDirection enumeration</param>
 /// <param name="csound">A reference to the Csound6NetRealtime used that contains this channel</param>
 public Csound6Channel(string _name, ChannelDirection _direction, Csound6Net csound)
 {
     m_csound  = csound;
     Name      = _name;
     Direction = _direction;
 }
コード例 #8
0
 /// <summary>
 /// Creates a string channel object to represent a string value in csound shared with a host program
 /// </summary>
 /// <param name="name"></param>
 /// <param name="direction"></param>
 /// <param name="csound"></param>
 public Csound6StringChannel(string name, ChannelDirection direction, Csound6Net csound)
     : base(name, direction, csound)
 {
 }
コード例 #9
0
 public Csound6AudioChannel(string name, ChannelDirection direction, Csound6Net csound)
     : base(name, direction, csound)
 {
     m_bufsiz = csound.Ksmps;
     m_buffer = Marshal.AllocHGlobal(sizeof(double) * m_bufsiz);
 }
コード例 #10
0
 /// <summary>
 /// Creates a control channel object using the provided name, direction, channel hints and csound instance
 /// </summary>
 /// <param name="name"></param>
 /// <param name="direction"></param>
 /// <param name="hints"></param>
 /// <param name="csound"></param>
 public Csound6ControlChannel(string name, ChannelDirection direction, ChannelHints hints, Csound6Net csound)
     : base(name, direction, csound)
 {
     m_hint = hints;
     SetControlChannelHints(hints);
 }
コード例 #11
0
 public Csound6GlobalStringVariable(string name, Csound6Net csound)
     : base(name, 10, csound)
 {
 }
コード例 #12
0
 public Csound6CircularBuffer(int size, int items, Csound6Net csound)
 {
     m_size   = size;
     m_csound = csound;
     NativeMethods.csoundCreateCircularBuffer(csound.Engine, size, items);
 }
コード例 #13
0
 /// <summary>
 /// Standard constructor for creating a parameter set.
 /// Usually executed via the GetParameters() method in the main csound object: Csound6Net
 /// and thus not usually used directly in a host program.
 /// </summary>
 /// <param name="csound"></param>
 public Csound6Parameters(Csound6Net csound)
 {
     m_csound = csound;
     m_oparms = new CSOUND_PARAMS();
     GetParams(m_oparms);
 }
コード例 #14
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)));
        }
コード例 #15
0
 public Csound6Utility(string name, FileInfo input, FileInfo output, Csound6Net csound)
     : this(name, csound)
 {
     InputFile  = input;
     OutputFile = output;
 }
コード例 #16
0
 public Csound6Utility(string name, Csound6Net csound)
 {
     m_name   = name;
     m_csound = csound;
 }