当前位置: 首页>>代码示例>>Java>>正文


Java MidiSystem.getMidiFileTypes方法代码示例

本文整理汇总了Java中javax.sound.midi.MidiSystem.getMidiFileTypes方法的典型用法代码示例。如果您正苦于以下问题:Java MidiSystem.getMidiFileTypes方法的具体用法?Java MidiSystem.getMidiFileTypes怎么用?Java MidiSystem.getMidiFileTypes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.sound.midi.MidiSystem的用法示例。


在下文中一共展示了MidiSystem.getMidiFileTypes方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import javax.sound.midi.MidiSystem; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    boolean foundDuplicates = false;
    int[]   aTypes = MidiSystem.getMidiFileTypes();
    for (int i = 0; i < aTypes.length; i++)
    {
        for (int j = 0; j < aTypes.length; j++)
        {
            if (aTypes[i] == aTypes[j] && i != j) {
                foundDuplicates = true;
            }
        }
    }
    if (foundDuplicates) {
        throw new Exception("Test failed");
    } else {
        System.out.println("Test passed");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:MidiFileTypeUniqueness.java

示例2: actionPerformed

import javax.sound.midi.MidiSystem; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e)
{
  try
  {
    Tune t = m_tuneBookEditorPanel.getTuneEditArea().getTune();
    if (t!=null)
    {
      JFileChooser chooser = new JFileChooser(lastDirectory);
      int returnVal = chooser.showSaveDialog(m_parent);
      File file = chooser.getSelectedFile();
      if (file!=null)
      {
        MidiConverterAbstract conv = new BasicMidiConverter();
        Sequence s = conv.toMidiSequence(t);
        int[] types = MidiSystem.getMidiFileTypes(s);
        if (types.length>0)
          MidiSystem.write(s,types[0],file);
      }
    }
  }
  catch (IOException excpt)
  { excpt.printStackTrace(); }
}
 
开发者ID:Sciss,项目名称:abc4j,代码行数:24,代码来源:PlayerApp.java

示例3: getFirstSupportedMidiFileType

import javax.sound.midi.MidiSystem; //导入方法依赖的package包/类
/**
 * Returns the first supported MIDI file type.
 *
 * @param sequence the sequence;
 * @return the supported MIDI file type.
 */
public static int getFirstSupportedMidiFileType(Sequence sequence) {
    int[] fileTypes = MidiSystem.getMidiFileTypes(sequence);

    if (fileTypes.length == 0) {
        throw new SpongeException("No supported MIDI file format");
    }
    return fileTypes[0];
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:15,代码来源:MidiUtils.java

示例4: saveMidi

import javax.sound.midi.MidiSystem; //导入方法依赖的package包/类
/**
 * Saves the MIDI data from a pattern into a file.
 * @param pattern the pattern to save
 * @param file the File to save the pattern to.  Should include file extension, such as .mid
 */
public void saveMidi(Pattern pattern, File file) throws IOException
{
    Sequence sequence = getSequence(pattern);

    int[] writers = MidiSystem.getMidiFileTypes(sequence);
    if (writers.length == 0) return;

    MidiSystem.write(sequence, writers[0], file);
}
 
开发者ID:d2fn,项目名称:passage,代码行数:15,代码来源:Player.java

示例5: getPreferredMidiType

import javax.sound.midi.MidiSystem; //导入方法依赖的package包/类
/**
 * Gets the preferred MIDI type. This is a "Standard-MIDI-File Type 1" file.
 */
public static int getPreferredMidiType(Sequence sequence) {
	int[] types = MidiSystem.getMidiFileTypes(sequence);
	int type = 0;
	if (types.length != 0) {
		type = types[types.length - 1];
	}
	return type;
}
 
开发者ID:Xenoage,项目名称:Zong,代码行数:12,代码来源:MidiScoreFileOutput.java


注:本文中的javax.sound.midi.MidiSystem.getMidiFileTypes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。