— Scott McNealy, Sun Microsystems Chairman, President and ceo


parts for ALL the musicians



Download 40,57 Mb.
Pdf ko'rish
bet300/555
Sana26.05.2022
Hajmi40,57 Mb.
#609235
1   ...   296   297   298   299   300   301   302   303   ...   555
Bog'liq
Head First Java (Kathy Sierra, Bert Bates) (z-lib.org)


parts for ALL the musicians 
playing a particular song. 


318
 
chapter 11
First we need a Sequencer
Before we can get any sound to play, we need a Sequencer object. The 
sequencer is the object that takes all the MIDI data and sends it to the right 
instruments. It’s the thing that plays the music. A sequencer can do a lot of 
different things, but in this book, we’re using it strictly as a playback device. Like 
a CD-player on your stereo, but with a few added features. The Sequencer class 
is in the javax.sound.midi package (part of the standard Java library as of version 
1.3). So let’s start by making sure we can make (or get) a Sequencer object.
but it 
looked 
so simple
import javax.sound.midi.*;
public class MusicTest1 {


public void play() {
Sequencer sequencer = MidiSystem.getSequencer();

System.out.println(“We got a sequencer”);

// close play
public static void main(String[] args) {
MusicTest1 mt = new MusicTest1();
mt.play();

// close main

// close class
import the javax.sound.midi packageWe need a Sequencer object. It’s the 
main part of the MIDI device/instrument 
we’re using. It’s the thing that, well, 
sequences all the MIDI information into 
a ‘song’. But we don’t make a brand 
new one ourselves -- we have to ask the 
MidiSystem to give us one.
File Edit Window Help SayWhat?
% javac MusicTest1.java
MusicTest1.java:13: unreported exception javax.sound.midi.
MidiUnavailableException; must be caught or declared to be 
thrown

Download 40,57 Mb.

Do'stlaringiz bilan baham:
1   ...   296   297   298   299   300   301   302   303   ...   555




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish