Stay organized with collections
    
    
      
      Save and categorize content based on your preferences.
    
  
  
    
  
  
  
  
    
    
    
  
  
    
    
    
    
    class MidiInputPort : MidiReceiver, Closeable
    
    This class is used for sending data to a port on a MIDI device
    Summary
    
    
    
      
        
          | Inherited functions | 
        
          | From class MidiReceiver
                
                  
                    | Unit | flush()
                         Instructs the receiver to discard all pending MIDI data. |  
                    | Int | getMaxMessageSize()
                         Returns the maximum size of a message this receiver can receive. |  
                    | Unit | send(msg: ByteArray!, offset: Int, count: Int)
                         Called to send MIDI data to the receiver without a timestamp. Data will be processed by receiver in the order sent. Data will get split into multiple calls to onSendif count exceedsgetMaxMessageSize. Blocks until all the data is sent or an exception occurs. In the latter case, the amount of data sent prior to the exception is not provided to caller. The communication should be considered corrupt. The sender should reestablish communication, reset all controllers and send all notes off. |  
                    | Unit | send(msg: ByteArray!, offset: Int, count: Int, timestamp: Long)
                         Called to send MIDI data to the receiver with a specified timestamp. Data will be processed by receiver in order first by timestamp, then in the order sent. Data will get split into multiple calls to onSendif count exceedsgetMaxMessageSize. Blocks until all the data is sent or an exception occurs. In the latter case, the amount of data sent prior to the exception is not provided to caller. The communication should be considered corrupt. The sender should reestablish communication, reset all controllers and send all notes off. |  | 
      
    
    Public methods
    
      close
      
      fun close(): Unit
      
        
          
            | Exceptions | 
          
            | java.lang.Exception | if this resource cannot be closed | 
          
            | java.io.IOException | if an I/O error occurs | 
        
      
     
    
      getPortNumber
      
      fun getPortNumber(): Int
      Returns the port number of this port
      
        
          
            | Return | 
          
            | Int | the port's port number | 
        
      
     
    
      onFlush
      
      fun onFlush(): Unit
      
        
          
            | Exceptions | 
          
            | java.io.IOException |  | 
        
      
     
    
      onSend
      
      fun onSend(
    msg: ByteArray!, 
    offset: Int, 
    count: Int, 
    timestamp: Long
): Unit
      
        
          
            | Parameters | 
          
            | msg | ByteArray!: a byte array containing the MIDI data | 
          
            | offset | Int: the offset of the first byte of the data in the array to be processed | 
          
            | count | Int: the number of bytes of MIDI data in the array to be processed | 
          
            | timestamp | Long: the timestamp of the message (based on java.lang.System#nanoTime | 
        
      
      
        
          
            | Exceptions | 
          
            | java.io.IOException |  | 
        
      
     
    Protected methods
    
      finalize
      
      protected fun finalize(): Unit
      
        
          
            | Exceptions | 
          
            | java.lang.Throwable | the Exceptionraised by this method | 
        
      
     
  
  
  
    
  
 
  
    
      
      
    
    
      
    
    
  
       
    
    
      
    
  
  
  Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
  Last updated 2025-02-10 UTC.
  
  
  
    
      [[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[]]