Java Doc for TempoControl.java in  » 6.0-JDK-Modules » j2me » javax » microedition » media » control » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » javax.microedition.media.control 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


javax.microedition.media.control.TempoControl

All known Subclasses:   com.sun.mmedia.DirectMIDIControl,
TempoControl
public interface TempoControl extends RateControl(Code)
TempoControl controls the tempo, in musical terms, of a song.

TempoControl is typically implemented in Players for MIDI media, i.e. playback of a Standard MIDI File (SMF).

TempoControl is basic functionality for a MIDI playback application. This is in contrast to MIDIControl MIDIControl , which targets advanced applications. Moreover, TempoControl needs a sequence - e.g. a MIDI file - to operate. MIDIControl does not require a sequence.

Musical tempo is usually specified in beats per minute. To provide a means to access tempos with fractional beats per minute, the methods to set and get the tempo work on "milli-beat" per minute. A simple division by 1000 is sufficient to get the actual beats per minute.

As a MIDI file can contain any number of tempo changes during playback, the absolute tempo is a state of the sequencer. During playback of a MIDI file, setting the tempo in response to a user interaction will not always yield the desired result: the user's tempo can be overridden by the playing MIDI file to another tempo just moments later.
In order to overcome this problem, a relative tempo rate is used (in Java Sound terms: tempo factor). This rate is applied to all tempo settings. The tempo rate is specified in "milli-percent", i.e. a value of 100'000 means playback at original tempo. The tempo rate is set with the setRate() method of the super class, RateControl RateControl .

The concept of tempo rate allows one to play back a MIDI sequence at a different tempo without losing the relative tempo changes in it.

The setTempo() and getTempo() methods do not affect or reflect the playback rate. This means that changing the rate will not result in a change of the value returned by getTempo(). Similarly, setting the tempo with setTempo() does not change the rate, i.e. the return value of getRate() is not changed. The effective playback tempo is always the product of tempo and rate:

         effectiveBeatsPerMinute = getTempo() getRate() / 1000 / 100000


See Also:   javax.microedition.media.Player
See Also:   javax.microedition.media.control.RateControl
See Also:   javax.microedition.media.control.PitchControl
See Also:   javax.microedition.media.control.MIDIControl





Method Summary
 intgetTempo()
     Gets the current playback tempo. This represents the current state of the sequencer:
  • A sequencer may not be initialized before the Player is prefetched.
 intsetTempo(int millitempo)
     Sets the current playback tempo. Tempo is a volatile state of the sequencer.



Method Detail
getTempo
int getTempo()(Code)
Gets the current playback tempo. This represents the current state of the sequencer:
  • A sequencer may not be initialized before the Player is prefetched. An uninitialized sequencer in this case returns a default tempo of 120 beats per minute.
  • After prefetching has finished, the tempo is set to the start tempo of the MIDI sequence (if any).
  • During playback, the return value is the current tempo and varies with tempo events in the MIDI file
  • A stopped sequence retains the last tempo it had before it was stopped.
  • A call to setTempo() changes current tempo until a tempo event in the MIDI file is encountered.
current tempo, expressed in milli-beats per minute
See Also:   TempoControl.setTempo



setTempo
int setTempo(int millitempo)(Code)
Sets the current playback tempo. Tempo is a volatile state of the sequencer. As MIDI sequences may contain META tempo events, tempo may change during playback of the sequence. Setting the tempo with setTempo() does not prevent the tempo from being changed subsequently by tempo events in the MIDI sequence. Example: during playback of a sequence, the user changes the tempo. But just moments later, the MIDI sequence changes the tempo to another value, so effectively the user interaction is ignored. To overcome this, and to allow consistent user interaction, use RateControl.setRate(int) setRate() inherited from RateControl.

The setTempo() method returns the actual tempo set by the Player's implementation. It sets the tempo as close to the requested value as possible, but is not required to set it to the exact value. Specifically, implementations may have a lower or upper limit, which will be used as tempo if the requested tempo is out of limits. 0 or negative tempo does not exist and will always result in the lower tempo limit of the implementation. Implementations are guaranteed to support 10'000 to 300'000 milli-beats per minute.

Setting tempo to a stopped sequence will force the sequence to start with that tempo, even if the sequence has a tempo event at the start position. Any subsequent tempo events in the sequence will be considered, though. Rewinding back to a position with a tempo event will result in a tempo change caused by the tempo event, too. Example: a sequence with initial tempo of 120bpm has not been started yet. The user sets the tempo to 140bpm and starts playback. When the playback position is then reset to the beginning, the tempo will be set to 120bpm due to the tempo event at the beginning of the sequence.

Playback rate (see RateControl.setRate(int) setRate() ) and tempo are independent factors of the effective tempo. Modifying tempo with setTempo() does not affect the playback rate and vice versa. The effective tempo is the product of tempo and rate.
Parameters:
  millitempo - The tempo specified in milli-beatsper minute (must be > 0, e.g. 120'000 for 120 beats per minute) tempo that was actually set, expressed in milli-beats per minute
See Also:   TempoControl.getTempo




www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.