Difference between revisions of "Reggae tutorial: Saving audio in user selected format"
From MorphOS Library
(→Introduction) |
(→Preparing Source Data) |
||
Line 11: | Line 11: | ||
==Preparing Source Data== | ==Preparing Source Data== | ||
+ | Source audio data may be prepared either as a static buffer, or generated on-demand. Static buffer technique is simplier and will be described here. Realtime generation may be accomplished by writing a custom Reggae class (see source code of [http://krashan.ppa.pl/articles/u1synth U1Synth]), or by using [i]datapush.stream[/i] class. | ||
+ | |||
==Creating Format Selection GUI== | ==Creating Format Selection GUI== | ||
==Building Reggae Processing Chain== | ==Building Reggae Processing Chain== | ||
==Saving Audio== | ==Saving Audio== | ||
==Cleanup== | ==Cleanup== |
Revision as of 16:54, 30 September 2012
Grzegorz Kraszewski
Contents
Introduction
Except of automatic media decoding, Reggae has also a feature on automatic encoding. There is one fundamental difference between these two however. In case of decoding, a format of decoded media, codec parameters, stream parameters, metadata, all this comes from the decoded datastream. When media are encoded, format, codec parameters and metadata have to be set by application.
Usually an application wants to offer all available formats to user. It means that application author has to maintain GUI for all codecs and their parameters. Also such a GUI would have to be updated with every new released codec. Reggae changes this and makes application programmer's life easier. The main rule is that multiplexer and encoder classes provide GUI. Reggae gathers those GUIs in a single object and returns it to application. Then application can embed this compound GUI object into its own interface. User can use this object to select encoder and its parameters. This is not all however.
After user selects output format and its parameters, Reggae can create encoder-muxer pair, read parameters and metadata from the GUI, and set them to proper objects. Then application connects the data source at input and output stream class at output. After triggering processing with MMM_Play() method on the output stream object, audio data is written.
Using Reggae media save API, application programmer need not to care about what formats Reggae supports. To say more, even if new codecs are released after the application release, the application will use them without a need for update.
Preparing Source Data
Source audio data may be prepared either as a static buffer, or generated on-demand. Static buffer technique is simplier and will be described here. Realtime generation may be accomplished by writing a custom Reggae class (see source code of U1Synth), or by using [i]datapush.stream[/i] class.