Changes between Version 2 and Version 3 of BOOK_BACKGROUND_AUDIO_R0


Ignore:
Timestamp:
11/14/09 20:57:25 (15 years ago)
Author:
deni
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BOOK_BACKGROUND_AUDIO_R0

    v2 v3  
    2727 * Choose one audio file for background of the book. 
    2828 * Open the book with preview mode or in reader. 
     29 
    2930= Design = 
    30 ^(Describe your design here.)^ 
     31 * Model & BookPropertiesDialog 
     32   * Add two new keys in {{{ BookR4}}}: 
     33     * {{{ KEY_BACKGROUND_AUDIO }}} holding a reference to the background audio resource of the book. 
     34        * its default value should be ResourceRefR4.NONE_REF; 
     35     * {{{ KEY_LOOP_BACKGROUND_AUDIO }}} holding whether the background audio of the book should be looped. 
     36       * its default value should be true; 
     37   * Add helper methods to get the new keys in {{{ BookH}}}; 
     38   * Add the reference to the background audio resource and whether it should be looped as private fields in {{{ BookInfo}}}; 
     39   * {{{ BookPropertiesDialog.Input }}} should provide the dialog with all the relevant information - BookInfo and the titles and references to all audio resources. 
     40     * {{{ public BookInfo getInfo() }}} returns the initial BookInfo for the dialog 
     41     * {{{ public List<ResourceRefR4> getAudioResRefs() }}} returns a list containing references to all audio resources in the book in the same order as their references returned by getAudioResTitles() 
     42     * {{{ public List<String> getAudioResTitles() }}} returns a list containing the titles of all audio resources in this book in the same order as their references returned by Input.getAudioResRefs() 
     43     * getAudioResRefs() and getAudioResTitles() should contain ResourceRef.NONE_REF and a title for it, so that the user can always turn background audio off; 
     44   * Add a combo box in BookPropertiesDialog for chosing the background audio resource among all audio resources in the book: 
     45     * add two private fields in {{{ BookPropertiesDialog.SwingDialog }}}: JLabel bgAudioLabel and JComboBox bgAudioComboBox; 
     46     * add two methods that construct the label and combo box, respectively; 
     47       * {{{ private JLabel getBgAudioLabel() }}} 
     48       * {{{ private JComboBox getBgAudioComboBox() }}} - create a new combo box, add to its model all titles returned by the input, set the current background audio resource as selected and setup the preferred size; 
     49     * add the label and combo box to the jpanel in {{{ getContentPanel() }}} 
     50     * modify the logic in the Ok button listener to respect the new setting 
     51   * Add a checkbox in BookPropertiesDialog for choosing whether background audio should be looped or not - similar to adding the combo box; 
     52   * Modify {{{FileMenuLogic}}}'s {{{ ON_OPEN_BOOK_PROPERTIES }}} operation to respect the new settings; 
     53 
     54 * Playing background audio (changes to {{{ BookView}}}): 
     55   * Add the following properties: 
     56     * {{{ Prop<AudioResourceH> backgroundAudioResource() }}} 
     57     * {{{ public Prop<MediaHandler> handler() }}} - the media handler for background audio 
     58       * its value should be MediaHandler.DEFAULT_HANDLER if there is no background audio; 
     59     * {{{ public Prop<Boolean> loopBackgroundAudio() }}} - whether the background audio for this book should be looped. 
     60   * Add a new method {{{ private AudioChunk getBgAudioChunk(TimePos time) }}} - gets the chunk of the background audio resource that should be played at the specified moment. 
     61     * If background audio is off or the background audio is not looped and the time in millis is bigger that the duration of the audio, it should return {{{ AudioChunk.SILENCE}}}. 
     62 
     63 * Source code: [8093] 
    3164 
    3265= Implementation =