MMA_DataFormat
MMA_DataFormat (V51) [..G.Q], STRPTR
DESCRIPTION
Returns read-only textual NULL-terminated description of decoded format. All amossound.demuxer objects return "AMOS Samples" string
MMA_MediaType
MMA_MediaType (V51) [..G.Q], ULONG
DESCRIPTION
Returns media type of object. All objects of amossound.demuxer class return MMT_SOUND always
MMA_MimeType
MMA_MimeType (V51.2) [..G.Q], STRPTR
DESCRIPTION
Returns read-only textual NULL-terminated MIME type string. All amossound.demuxer objects return "audio/x-amos-samples
MMA_Sound_BitsPerSample
MMA_Sound_BitsPerSample (V51) [....Q], ULONG
DESCRIPTION
Specifies number of significant bits in a single sound sample. It is always 8 for AMOS samples
MMA_Sound_Channels
MMA_Sound_Channels (V51) [....Q], ULONG
DESCRIPTION
Specifies number of channels in a sample. AMOS samples are always mono, so this attribute just returns 1
MMA_Sound_FrameCount
MMA_Sound_FrameCount (V51) [....Q], UQUAD*
DESCRIPTION
Returns number of sample frames in the stream as specified in the header
NOTES
This is a 64-bit attribute passed by pointer to UQUAD variable, not by value.
MMA_Sound_SampleRate
MMA_Sound_SampleRate (V51) [....Q], ULONG
DESCRIPTION
Specifies sampling rate of given sample as found in the sample header, measured in sample frames per second. Sampling rate of AMOS sounds is stored as a 16-bit integer, so it is never higher than 65535 Hz
MMA_Sound_Volume
MMA_Sound_Volume (V51) [....Q], ULONG
DESCRIPTION
Specifies default sound volume relative to the maximum one. Range of this attribute is from 0 (silence) to 65536 including (full volume). As AMOS sounds have no volume information stored, an amossound.demuxer object returns 65536 always
MMA_StreamPosFrames
MMA_StreamPosFrames (V51) [....Q], UQUAD*
DESCRIPTION
Returns current absolute stream position in sample frames
NOTES
This is a 64-bit attribute passed by pointer to UQUAD variable, not by value.
MMA_StreamPosTime
MMA_StreamPosTime (V51) [....Q], UQUAD*
DESCRIPTION
Returns absolute stream time position in microseconds. This time position is strictly based on MMA_Sound_SampleRate, and reflects only the whole sample frames already pulled from the object output. The exact formula is: time_pos = whole_frames_pulled / MMA_Sound_SampleRate
NOTES
This is a 64-bit attribute passed by pointer to UQUAD variable, not by value. Returned time is not in any way related to playback time for two reasons: firstly, there can be an unknown number of buffers between the demultiplexer and the output, secondly, playback samplerate may be different than those specified in the stream header.
SEE ALSO
MMM_Pull
MMM_Pull (V51)
SYNOPSIS
bytes = DoMethod(obj, MMM_Pull, ULONG port, APTR buffer, ULONG length);
DESCRIPTION
Loads specified number of bytes of PCM data into the buffer. If samples have been buffered because of non-seekable source, the method copies data from sample buffers. If samples haven't been buffered, the method performs a seek on source and reads data from the source, directly to the destination buffer
INPUTS
- obj, object to perform the method on. - port, number of port is between 1 and MMA_Ports, including. - buffer, a memory buffer for pulled data, must be aligned to 16-byte boundary (preferrably allocated with MediaAllocMem()). - length, amount of pulled data in bytes
RESULT
- bytes, number of bytes pulled actually
MMM_Seek
MMM_Seek (V51)
SYNOPSIS
success = DoMethod(obj, MMM_Seek, ULONG port, ULONG type, UQUAD* position);
DESCRIPTION
Performs seek in PCM stream. As amossound.demuxer object knows samplerate and frame size, only frame seek and time seek are supported
INPUTS
- obj, object to perform the method on. - port, number of port is between 1 and MMA_Ports, including. - type, seek type (MMM_SEEK_FRAMES, MMM_SEEK_TIME). - position, new, absolute position in the stream. For frame seek it is in frames, for time seek in microseconds. It is 64-bit parameter passed by a pointer to the value. Note that it is not playback time, see MMA_StreamPosTime for explanation
RESULT
TRUE if success, FALSE otherwise. Check MMA_ErrorCode for detailed information
SEE ALSO
MMA_Sound_SampleRateMMA_StreamPosFramesMMA_StreamPosTimemultimedia.class/MMA_ErrorCodemultimedia.class/MMA_Ports
background
HISTORY
51.3 (14.01.2022)
- MMM_Seek: Added support for MMM_SEEK_BYTES position 0 (it is turned
internally to MMM_SEEK_FRAMES 0).
51.2 (28.06.2015)
- Moved MMA_DataFormat support from object to class.
- Added MMA_MimeType.
DESCRIPTION
The class is a Reggae demultiplexer for AMOS audio sample banks. The class parses bank header and creates output ports, one for each sample in the bank. As the samples in the bank are just PCM, the next stage of processing is audiopcm.decoder usually. The object of this class has two or more ports. Port 0 is an input and accepts MMF_STREAM. Ports 1 to N are outputs (one for each sample in the bank), producing MMF_AUDIO_PCM8 data stream. As an AMOS sample bank can contain more than one sound, the class creates multiple outputs. This can create problems, when data are pulled from outputs in random order. The class solves this problem in a number of ways. It checks first, if the source data stream is seekable. If it is, switching between outputs causes just seeks in the source stream, no buffering is involved. In case of a non-seekable stream, the object buffers all the samples. If buffering of samples fails (due to memory shortage), MMM_Setup() or MMM_Pull() method may fail with MMMERR_OUT_OF_MEMORY error code.
NEW ATTRIBUTES
Attributes applicability:
I - may be set at creation time.
S - may be set on an existing object.
G - may be get from an object.
P - may be set for an object's port.
Q - may be queried from an object's port.
MMA_DataFormat (V50) [..G.Q], STRPTR
MMA_MimeType (V51.2) [..G.Q], STRPTR
MMA_MediaType (V51) [..G.Q], ULONG
MMA_Sound_BitsPerSample (V50) [....Q], ULONG
MMA_Sound_Channels (V50) [....Q], ULONG
MMA_Sound_FrameCount (V50) [....Q], UQUAD*
MMA_Sound_SampleRate (V50) [....Q], ULONG
MMA_Sound_Volume (V50) [....Q], ULONG
MMA_StreamPosFrames (V51) [....Q], UQUAD*
MMA_StreamPosTime (V51) [....Q], UQUAD*
Note that, as for every multi-output demultiplexer, output data stream
attributes may be only retrieved from a port, getting these attributes
from the object does not work, as they may be different for different
audio streams.
NEW METHODS
MMM_Pull(port, buffer, length) (V50) MMM_Seek(port, type, position) (V51)