Rewrote more headers, style updates in some
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32785 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
17a5db77c0
commit
cb3f273dd2
@ -76,7 +76,8 @@ public:
|
||||
status_t InitCheck() const;
|
||||
|
||||
// Get info about the underlying file format.
|
||||
status_t GetFileFormatInfo(media_file_format* mfi) const;
|
||||
status_t GetFileFormatInfo(
|
||||
media_file_format* mfi) const;
|
||||
|
||||
//
|
||||
// These functions are for read-only access to a media file.
|
||||
|
@ -1,31 +1,23 @@
|
||||
/******************************************************************************
|
||||
|
||||
File: PlaySound.h
|
||||
|
||||
Description: Interface for a simple beep sound.
|
||||
|
||||
Copyright 1995-97, Be Incorporated
|
||||
|
||||
******************************************************************************/
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _PLAY_SOUND_H
|
||||
#define _PLAY_SOUND_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
#include <OS.h>
|
||||
#include <Entry.h>
|
||||
|
||||
|
||||
typedef sem_id sound_handle;
|
||||
|
||||
sound_handle play_sound(const entry_ref *soundRef,
|
||||
bool mix,
|
||||
bool queue,
|
||||
bool background
|
||||
);
|
||||
|
||||
sound_handle play_sound(const entry_ref* soundRef, bool mix, bool queue,
|
||||
bool background);
|
||||
|
||||
status_t stop_sound(sound_handle handle);
|
||||
|
||||
status_t wait_for_sound(sound_handle handle);
|
||||
|
||||
#endif /* #ifndef _PLAY_SOUND_H*/
|
||||
|
||||
#endif // _PLAY_SOUND_H
|
||||
|
@ -1,47 +1,55 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: RealtimeAlloc.h
|
||||
/
|
||||
/ Description: Allocation from separate "pools" of memory. Those pools
|
||||
/ will be locked in RAM if realtime allocators are turned
|
||||
/ on in the BMediaRoster, so don't waste this memory unless
|
||||
/ it's needed. Also, the shared pool is a scarce resource,
|
||||
/ so it's better if you create your own pool for your own
|
||||
/ needs and leave the shared pool for BMediaNode instances
|
||||
/ and the needs of the Media Kit.
|
||||
/
|
||||
/ Copyright 1998-99, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#if !defined(_REALTIME_ALLOC_H)
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _REALTIME_ALLOC_H
|
||||
#define _REALTIME_ALLOC_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
/*! Allocation from separate "pools" of memory. Those pools will be locked
|
||||
in RAM if realtime allocators are turned on in the BMediaRoster, so don't
|
||||
waste this memory unless it's needed. Also, the shared pool is a scarce
|
||||
resource, so it's better if you create your own pool for your own needs
|
||||
and leave the shared pool for BMediaNode instances and the needs of the
|
||||
Media Kit.
|
||||
*/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct rtm_pool rtm_pool;
|
||||
|
||||
/* If out_pool is NULL, the default pool will be created if it isn't already. */
|
||||
/* If out_pool is NULL, the default pool will be created if it isn't */
|
||||
/* already. */
|
||||
/* If the default pool is already created, it will return EALREADY. */
|
||||
#if defined(__cplusplus)
|
||||
status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name=NULL);
|
||||
#else
|
||||
status_t rtm_create_pool(rtm_pool ** out_pool, size_t total_size, const char * name);
|
||||
#endif
|
||||
status_t rtm_delete_pool(rtm_pool * pool);
|
||||
/* If NULL is passed for pool, the default pool is used (if created). */
|
||||
void * rtm_alloc(rtm_pool * pool, size_t size);
|
||||
status_t rtm_free(void * data);
|
||||
status_t rtm_realloc(void ** data, size_t new_size);
|
||||
status_t rtm_size_for(void * data);
|
||||
status_t rtm_phys_size_for(void * data);
|
||||
|
||||
/* Return the default pool, or NULL if not yet initialized */
|
||||
rtm_pool * rtm_default_pool();
|
||||
status_t rtm_create_pool(rtm_pool** out_pool, size_t total_size,
|
||||
const char* name = NULL);
|
||||
|
||||
#else
|
||||
|
||||
status_t rtm_create_pool(rtm_pool** out_pool, size_t total_size,
|
||||
const char* name);
|
||||
|
||||
#endif
|
||||
|
||||
status_t rtm_delete_pool(rtm_pool* pool);
|
||||
|
||||
/* If NULL is passed for 'pool', the default pool is used if it has been */
|
||||
/* created already. */
|
||||
void* rtm_alloc(rtm_pool* pool, size_t size);
|
||||
status_t rtm_free(void* data);
|
||||
status_t rtm_realloc(void** data, size_t new_size);
|
||||
status_t rtm_size_for(void* data);
|
||||
status_t rtm_phys_size_for(void* data);
|
||||
|
||||
/* Return the default pool, or NULL if it has not yet been initialized. */
|
||||
rtm_pool* rtm_default_pool();
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku Inc. All Rights Reserved.
|
||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#ifndef _SOUND_H
|
||||
#define _SOUND_H
|
||||
|
||||
|
||||
#include <MediaDefs.h>
|
||||
|
||||
class BFile;
|
||||
@ -16,61 +16,63 @@ namespace BPrivate {
|
||||
class BTrackReader;
|
||||
};
|
||||
|
||||
|
||||
class BSound {
|
||||
public:
|
||||
BSound(void *data, size_t size,
|
||||
const media_raw_audio_format &format,
|
||||
BSound(void* data, size_t size,
|
||||
const media_raw_audio_format& format,
|
||||
bool freeWhenDone = false);
|
||||
BSound(const entry_ref *soundFile,
|
||||
BSound(const entry_ref* soundFile,
|
||||
bool loadIntoMemory = false);
|
||||
|
||||
status_t InitCheck();
|
||||
BSound * AcquireRef();
|
||||
bool ReleaseRef();
|
||||
int32 RefCount() const; // unreliable!
|
||||
status_t InitCheck();
|
||||
BSound* AcquireRef();
|
||||
bool ReleaseRef();
|
||||
int32 RefCount() const; // unreliable!
|
||||
|
||||
virtual bigtime_t Duration() const;
|
||||
virtual const media_raw_audio_format &Format() const;
|
||||
virtual const void * Data() const; // returns NULL for files
|
||||
virtual off_t Size() const;
|
||||
virtual bigtime_t Duration() const;
|
||||
virtual const media_raw_audio_format &Format() const;
|
||||
virtual const void* Data() const; // returns NULL for files
|
||||
virtual off_t Size() const;
|
||||
|
||||
virtual bool GetDataAt(off_t offset,
|
||||
void *intoBuffer, size_t bufferSize,
|
||||
size_t *outUsed);
|
||||
virtual bool GetDataAt(off_t offset,
|
||||
void* intoBuffer, size_t bufferSize,
|
||||
size_t* outUsed);
|
||||
|
||||
protected:
|
||||
BSound(const media_raw_audio_format &format);
|
||||
virtual status_t Perform(int32 code, ...);
|
||||
BSound(const media_raw_audio_format& format);
|
||||
virtual status_t Perform(int32 code, ...);
|
||||
|
||||
private:
|
||||
friend class DummyFriend;
|
||||
virtual ~BSound();
|
||||
friend class DummyFriend;
|
||||
virtual ~BSound();
|
||||
|
||||
public:
|
||||
virtual status_t BindTo(BSoundPlayer *player,
|
||||
const media_raw_audio_format &format);
|
||||
virtual status_t UnbindFrom(BSoundPlayer *player);
|
||||
virtual status_t BindTo(BSoundPlayer* player,
|
||||
const media_raw_audio_format& format);
|
||||
virtual status_t UnbindFrom(BSoundPlayer* player);
|
||||
|
||||
private:
|
||||
status_t _Reserved_Sound_0(void *); // BindTo
|
||||
status_t _Reserved_Sound_1(void *); // UnbindFrom
|
||||
virtual status_t _Reserved_Sound_2(void *);
|
||||
virtual status_t _Reserved_Sound_3(void *);
|
||||
virtual status_t _Reserved_Sound_4(void *);
|
||||
virtual status_t _Reserved_Sound_5(void *);
|
||||
status_t _Reserved_Sound_0(void*); // BindTo
|
||||
status_t _Reserved_Sound_1(void*); // UnbindFrom
|
||||
virtual status_t _Reserved_Sound_2(void*);
|
||||
virtual status_t _Reserved_Sound_3(void*);
|
||||
virtual status_t _Reserved_Sound_4(void*);
|
||||
virtual status_t _Reserved_Sound_5(void*);
|
||||
|
||||
void * fData;
|
||||
size_t fDataSize;
|
||||
BFile * fFile;
|
||||
int32 fRefCount;
|
||||
status_t fStatus;
|
||||
media_raw_audio_format fFormat;
|
||||
private:
|
||||
void* fData;
|
||||
size_t fDataSize;
|
||||
BFile* fFile;
|
||||
int32 fRefCount;
|
||||
status_t fStatus;
|
||||
media_raw_audio_format fFormat;
|
||||
|
||||
bool fFreeWhenDone;
|
||||
bool fReserved[3];
|
||||
bool fFreeWhenDone;
|
||||
bool fReserved[3];
|
||||
|
||||
BPrivate::BTrackReader *fTrackReader;
|
||||
uint32 fReserved2[18];
|
||||
BPrivate::BTrackReader* fTrackReader;
|
||||
uint32 fReserved2[18];
|
||||
};
|
||||
|
||||
#endif // _SOUND_H
|
||||
#endif // _SOUND_H
|
||||
|
@ -1,103 +1,99 @@
|
||||
/******************************************************************************
|
||||
|
||||
File: SoundFile.h
|
||||
|
||||
Description: Interface for a format-insensitive sound file object.
|
||||
|
||||
Copyright 1995-97, Be Incorporated
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SOUND_FILE_H
|
||||
#define _SOUND_FILE_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
#include <MediaDefs.h>
|
||||
|
||||
#include <Entry.h>
|
||||
#include <File.h>
|
||||
#include <MediaDefs.h>
|
||||
|
||||
enum /* sound_format*/
|
||||
{ B_UNKNOWN_FILE,
|
||||
B_AIFF_FILE,
|
||||
B_WAVE_FILE,
|
||||
B_UNIX_FILE };
|
||||
|
||||
class BSoundFile {
|
||||
|
||||
public:
|
||||
BSoundFile();
|
||||
BSoundFile(const entry_ref *ref,
|
||||
uint32 open_mode);
|
||||
virtual ~BSoundFile();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetTo(const entry_ref *ref, uint32 open_mode);
|
||||
|
||||
int32 FileFormat() const;
|
||||
int32 SamplingRate() const;
|
||||
int32 CountChannels() const;
|
||||
int32 SampleSize() const;
|
||||
int32 ByteOrder() const;
|
||||
int32 SampleFormat() const;
|
||||
int32 FrameSize() const;
|
||||
off_t CountFrames() const;
|
||||
|
||||
bool IsCompressed() const;
|
||||
int32 CompressionType() const;
|
||||
char *CompressionName() const;
|
||||
|
||||
virtual int32 SetFileFormat(int32 format);
|
||||
virtual int32 SetSamplingRate(int32 fps);
|
||||
virtual int32 SetChannelCount(int32 spf);
|
||||
virtual int32 SetSampleSize(int32 bps);
|
||||
virtual int32 SetByteOrder(int32 bord);
|
||||
virtual int32 SetSampleFormat(int32 fmt);
|
||||
virtual int32 SetCompressionType(int32 type);
|
||||
virtual char *SetCompressionName(char *name);
|
||||
virtual bool SetIsCompressed(bool tf);
|
||||
virtual off_t SetDataLocation(off_t offset);
|
||||
virtual off_t SetFrameCount(off_t count);
|
||||
|
||||
size_t ReadFrames(char *buf, size_t count);
|
||||
size_t WriteFrames(char *buf, size_t count);
|
||||
virtual off_t SeekToFrame(off_t n);
|
||||
off_t FrameIndex() const;
|
||||
off_t FramesRemaining() const;
|
||||
|
||||
BFile *fSoundFile;
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedSoundFile1();
|
||||
virtual void _ReservedSoundFile2();
|
||||
virtual void _ReservedSoundFile3();
|
||||
|
||||
int32 fFileFormat;
|
||||
int32 fSamplingRate;
|
||||
int32 fChannelCount;
|
||||
int32 fSampleSize;
|
||||
int32 fByteOrder;
|
||||
int32 fSampleFormat;
|
||||
|
||||
off_t fByteOffset; /* offset to first sample */
|
||||
|
||||
off_t fFrameCount;
|
||||
off_t fFrameIndex;
|
||||
|
||||
bool fIsCompressed;
|
||||
int32 fCompressionType;
|
||||
char *fCompressionName;
|
||||
status_t fCStatus;
|
||||
void _init_raw_stats();
|
||||
status_t _ref_to_file(const entry_ref *ref);
|
||||
BMediaFile *fMediaFile;
|
||||
BMediaTrack *fMediaTrack;
|
||||
uint32 _reserved[2];
|
||||
// file formats
|
||||
enum {
|
||||
B_UNKNOWN_FILE,
|
||||
B_AIFF_FILE,
|
||||
B_WAVE_FILE,
|
||||
B_UNIX_FILE
|
||||
};
|
||||
|
||||
|
||||
#endif /* #ifndef _SOUND_FILE_H*/
|
||||
class BSoundFile {
|
||||
public:
|
||||
BSoundFile();
|
||||
BSoundFile(const entry_ref* ref,
|
||||
uint32 openMode);
|
||||
virtual ~BSoundFile();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetTo(const entry_ref* ref, uint32 openMode);
|
||||
|
||||
int32 FileFormat() const;
|
||||
int32 SamplingRate() const;
|
||||
int32 CountChannels() const;
|
||||
int32 SampleSize() const;
|
||||
int32 ByteOrder() const;
|
||||
int32 SampleFormat() const;
|
||||
int32 FrameSize() const;
|
||||
off_t CountFrames() const;
|
||||
|
||||
bool IsCompressed() const;
|
||||
int32 CompressionType() const;
|
||||
char* CompressionName() const;
|
||||
|
||||
virtual int32 SetFileFormat(int32 format);
|
||||
virtual int32 SetSamplingRate(int32 fps);
|
||||
virtual int32 SetChannelCount(int32 samplesPerFrame);
|
||||
virtual int32 SetSampleSize(int32 bytesPerSample);
|
||||
virtual int32 SetByteOrder(int32 byteOrder);
|
||||
virtual int32 SetSampleFormat(int32 format);
|
||||
virtual int32 SetCompressionType(int32 type);
|
||||
virtual char* SetCompressionName(char* name);
|
||||
virtual bool SetIsCompressed(bool compressed);
|
||||
virtual off_t SetDataLocation(off_t offset);
|
||||
virtual off_t SetFrameCount(off_t count);
|
||||
|
||||
size_t ReadFrames(char* buffer, size_t count);
|
||||
size_t WriteFrames(char* buffer, size_t count);
|
||||
virtual off_t SeekToFrame(off_t index);
|
||||
off_t FrameIndex() const;
|
||||
off_t FramesRemaining() const;
|
||||
|
||||
BFile* fSoundFile;
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedSoundFile1();
|
||||
virtual void _ReservedSoundFile2();
|
||||
virtual void _ReservedSoundFile3();
|
||||
|
||||
void _init_raw_stats();
|
||||
status_t _ref_to_file(const entry_ref* ref);
|
||||
|
||||
int32 fFileFormat;
|
||||
int32 fSamplingRate;
|
||||
int32 fChannelCount;
|
||||
int32 fSampleSize;
|
||||
int32 fByteOrder;
|
||||
int32 fSampleFormat;
|
||||
|
||||
off_t fByteOffset;
|
||||
// offset to first sample
|
||||
|
||||
off_t fFrameCount;
|
||||
off_t fFrameIndex;
|
||||
|
||||
bool fIsCompressed;
|
||||
int32 fCompressionType;
|
||||
char* fCompressionName;
|
||||
status_t fCStatus;
|
||||
BMediaFile* fMediaFile;
|
||||
BMediaTrack* fMediaTrack;
|
||||
|
||||
uint32 _reserved[2];
|
||||
};
|
||||
|
||||
#endif // _SOUND_FILE_H
|
||||
|
@ -1,14 +1,16 @@
|
||||
/* SoundPlayer.h */
|
||||
/* Copyright 1998 Be Incorporated. All rights reserved. */
|
||||
|
||||
#if !defined(_SOUND_PLAYER_H)
|
||||
/*
|
||||
* Copyright 2009, Haiku, Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SOUND_PLAYER_H
|
||||
#define _SOUND_PLAYER_H
|
||||
|
||||
|
||||
#include <MediaDefs.h>
|
||||
#include <exception>
|
||||
|
||||
#include <BufferProducer.h>
|
||||
#include <Locker.h>
|
||||
#include <exception>
|
||||
#include <MediaDefs.h>
|
||||
|
||||
|
||||
class BContinuousParameter;
|
||||
@ -16,188 +18,214 @@ class BParameterWeb;
|
||||
class BSound;
|
||||
class _SoundPlayNode;
|
||||
|
||||
|
||||
class sound_error : public std::exception {
|
||||
const char * m_str_const;
|
||||
const char* m_str_const;
|
||||
public:
|
||||
sound_error(const char * str);
|
||||
const char * what() const throw ();
|
||||
sound_error(const char* string);
|
||||
const char* what() const throw();
|
||||
};
|
||||
|
||||
|
||||
class BSoundPlayer {
|
||||
friend class _SoundPlayNode;
|
||||
public:
|
||||
enum sound_player_notification {
|
||||
B_STARTED = 1,
|
||||
B_STOPPED,
|
||||
B_SOUND_DONE
|
||||
};
|
||||
enum sound_player_notification {
|
||||
B_STARTED = 1,
|
||||
B_STOPPED,
|
||||
B_SOUND_DONE
|
||||
};
|
||||
|
||||
BSoundPlayer(
|
||||
const char * name = NULL,
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format) = NULL,
|
||||
void (*Notifier)(void *, sound_player_notification what, ...) = NULL,
|
||||
void * cookie = NULL);
|
||||
BSoundPlayer(
|
||||
const media_raw_audio_format * format,
|
||||
const char * name = NULL,
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format) = NULL,
|
||||
void (*Notifier)(void *, sound_player_notification what, ...) = NULL,
|
||||
void * cookie = NULL);
|
||||
BSoundPlayer(
|
||||
const media_node & toNode,
|
||||
const media_multi_audio_format * format = NULL,
|
||||
const char * name = NULL,
|
||||
const media_input * input = NULL,
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format) = NULL,
|
||||
void (*Notifier)(void *, sound_player_notification what, ...) = NULL,
|
||||
void * cookie = NULL);
|
||||
virtual ~BSoundPlayer();
|
||||
BSoundPlayer(const char* name = NULL,
|
||||
void (*PlayBuffer)(void*, void* buffer,
|
||||
size_t size,
|
||||
const media_raw_audio_format& format)
|
||||
= NULL,
|
||||
void (*Notifier)(void*,
|
||||
sound_player_notification what, ...)
|
||||
= NULL,
|
||||
void* cookie = NULL);
|
||||
BSoundPlayer(
|
||||
const media_raw_audio_format* format,
|
||||
const char* name = NULL,
|
||||
void (*PlayBuffer)(void*, void* buffer,
|
||||
size_t size,
|
||||
const media_raw_audio_format& format)
|
||||
= NULL,
|
||||
void (*Notifier)(void*,
|
||||
sound_player_notification what, ...)
|
||||
= NULL,
|
||||
void* cookie = NULL);
|
||||
BSoundPlayer(
|
||||
const media_node& toNode,
|
||||
const media_multi_audio_format* format
|
||||
= NULL,
|
||||
const char* name = NULL,
|
||||
const media_input* input = NULL,
|
||||
void (*PlayBuffer)(void*, void* buffer,
|
||||
size_t size,
|
||||
const media_raw_audio_format& format)
|
||||
= NULL,
|
||||
void (*Notifier)(void*,
|
||||
sound_player_notification what, ...)
|
||||
= NULL,
|
||||
void* cookie = NULL);
|
||||
virtual ~BSoundPlayer();
|
||||
|
||||
status_t InitCheck(); // new in R4.1
|
||||
media_raw_audio_format Format() const; // new in R4.1
|
||||
status_t InitCheck();
|
||||
media_raw_audio_format Format() const;
|
||||
|
||||
status_t Start();
|
||||
void Stop(
|
||||
bool block = true,
|
||||
bool flush = true);
|
||||
status_t Start();
|
||||
void Stop(bool block = true, bool flush = true);
|
||||
|
||||
typedef void (*BufferPlayerFunc)(void *, void *, size_t, const media_raw_audio_format &);
|
||||
BufferPlayerFunc BufferPlayer() const;
|
||||
void SetBufferPlayer(
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format));
|
||||
typedef void (*EventNotifierFunc)(void *, sound_player_notification what, ...);
|
||||
EventNotifierFunc EventNotifier() const;
|
||||
void SetNotifier(
|
||||
void (*Notifier)(void *, sound_player_notification what, ...));
|
||||
void * Cookie() const;
|
||||
void SetCookie(
|
||||
void * cookie);
|
||||
void SetCallbacks( // atomic change
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format) = NULL,
|
||||
void (*Notifier)(void *, sound_player_notification what, ...) = NULL,
|
||||
void * cookie = NULL);
|
||||
typedef void (*BufferPlayerFunc)(void*, void*, size_t,
|
||||
const media_raw_audio_format&);
|
||||
|
||||
typedef int32 play_id;
|
||||
BufferPlayerFunc BufferPlayer() const;
|
||||
void SetBufferPlayer(void (*PlayBuffer)(void*,
|
||||
void* buffer, size_t size,
|
||||
const media_raw_audio_format& format));
|
||||
typedef void (*EventNotifierFunc)(void*, sound_player_notification what,
|
||||
...);
|
||||
EventNotifierFunc EventNotifier() const;
|
||||
void SetNotifier(void (*Notifier)(void*,
|
||||
sound_player_notification what, ...));
|
||||
void* Cookie() const;
|
||||
void SetCookie(void* cookie);
|
||||
void SetCallbacks(void (*PlayBuffer)(void*,
|
||||
void* buffer, size_t size,
|
||||
const media_raw_audio_format& format)
|
||||
= NULL,
|
||||
void (*Notifier)(void*,
|
||||
sound_player_notification what, ...)
|
||||
= NULL,
|
||||
void* cookie = NULL);
|
||||
|
||||
bigtime_t CurrentTime();
|
||||
bigtime_t PerformanceTime();
|
||||
status_t Preroll();
|
||||
play_id StartPlaying(
|
||||
BSound * sound,
|
||||
bigtime_t at_time = 0);
|
||||
play_id StartPlaying(
|
||||
BSound * sound,
|
||||
bigtime_t at_time,
|
||||
float with_volume);
|
||||
status_t SetSoundVolume(
|
||||
play_id sound, // update only non-NULL values
|
||||
float new_volume);
|
||||
bool IsPlaying(
|
||||
play_id id);
|
||||
status_t StopPlaying(
|
||||
play_id id);
|
||||
status_t WaitForSound(
|
||||
play_id id);
|
||||
typedef int32 play_id;
|
||||
|
||||
float Volume(); /* 0 - 1.0 */
|
||||
void SetVolume( /* 0 - 1.0 */
|
||||
float new_volume);
|
||||
float VolumeDB( /* -xx - +xx (see GetVolumeInfo()) */
|
||||
bool forcePoll = false); /* if false, cached value will be used if new enough */
|
||||
void SetVolumeDB(
|
||||
float volume_dB);
|
||||
status_t GetVolumeInfo(
|
||||
media_node * out_node,
|
||||
int32 * out_parameter_id,
|
||||
float * out_min_dB,
|
||||
float * out_max_dB);
|
||||
bigtime_t Latency();
|
||||
bigtime_t CurrentTime();
|
||||
bigtime_t PerformanceTime();
|
||||
status_t Preroll();
|
||||
play_id StartPlaying(BSound* sound,
|
||||
bigtime_t atTime = 0);
|
||||
play_id StartPlaying(BSound* sound,
|
||||
bigtime_t atTime,
|
||||
float withVolume);
|
||||
status_t SetSoundVolume(play_id sound, float newVolume);
|
||||
bool IsPlaying(play_id id);
|
||||
status_t StopPlaying(play_id id);
|
||||
status_t WaitForSound(play_id id);
|
||||
|
||||
virtual bool HasData();
|
||||
void SetHasData( // this does more than just set a flag
|
||||
bool has_data);
|
||||
// On [0..1]
|
||||
float Volume();
|
||||
void SetVolume(float volume);
|
||||
|
||||
// -xx - +xx (see GetVolumeInfo())
|
||||
// If 'forcePoll' is false, a cached value will be used if new
|
||||
// enough.
|
||||
float VolumeDB(bool forcePoll = false);
|
||||
void SetVolumeDB(float dB);
|
||||
status_t GetVolumeInfo(media_node* _node,
|
||||
int32* _parameterID, float* _minDB,
|
||||
float* _maxDB);
|
||||
bigtime_t Latency();
|
||||
|
||||
virtual bool HasData();
|
||||
void SetHasData(bool hasData);
|
||||
|
||||
// TODO: Needs Perform() method for FBC!
|
||||
|
||||
protected:
|
||||
|
||||
void SetInitError( // new in R4.1
|
||||
status_t in_error);
|
||||
void SetInitError(status_t inError);
|
||||
|
||||
private:
|
||||
static void _SoundPlayBufferFunc(void *cookie, void *buffer, size_t size,
|
||||
const media_raw_audio_format &format);
|
||||
static void _SoundPlayBufferFunc(void* cookie,
|
||||
void* buffer, size_t size,
|
||||
const media_raw_audio_format& format);
|
||||
|
||||
virtual status_t _Reserved_SoundPlayer_0(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_1(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_2(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_3(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_4(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_5(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_6(void *, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_7(void *, ...);
|
||||
|
||||
_SoundPlayNode * fPlayerNode;
|
||||
// FBC padding
|
||||
virtual status_t _Reserved_SoundPlayer_0(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_1(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_2(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_3(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_4(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_5(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_6(void*, ...);
|
||||
virtual status_t _Reserved_SoundPlayer_7(void*, ...);
|
||||
|
||||
struct _playing_sound {
|
||||
_playing_sound *next;
|
||||
off_t current_offset;
|
||||
BSound *sound;
|
||||
play_id id;
|
||||
int32 delta;
|
||||
int32 rate;
|
||||
sem_id wait_sem;
|
||||
float volume;
|
||||
};
|
||||
_playing_sound *fPlayingSounds;
|
||||
private:
|
||||
_SoundPlayNode* fPlayerNode;
|
||||
|
||||
struct _waiting_sound {
|
||||
_waiting_sound * next;
|
||||
bigtime_t start_time;
|
||||
BSound * sound;
|
||||
play_id id;
|
||||
int32 rate;
|
||||
float volume;
|
||||
};
|
||||
_waiting_sound *fWaitingSounds;
|
||||
struct _playing_sound {
|
||||
_playing_sound* next;
|
||||
off_t current_offset;
|
||||
BSound* sound;
|
||||
play_id id;
|
||||
int32 delta;
|
||||
int32 rate;
|
||||
sem_id wait_sem;
|
||||
float volume;
|
||||
};
|
||||
|
||||
void (*fPlayBufferFunc)(void * cookie, void * buffer, size_t size, const media_raw_audio_format & format);
|
||||
void (*fNotifierFunc)(void * cookie, sound_player_notification what, ...);
|
||||
BLocker fLocker;
|
||||
float fVolumeDB;
|
||||
media_input fMediaInput; // the system mixer
|
||||
media_output fMediaOutput; // the player node
|
||||
void * fCookie;
|
||||
int32 fFlags;
|
||||
_playing_sound* fPlayingSounds;
|
||||
|
||||
status_t fInitStatus; // new in R4.1
|
||||
BContinuousParameter * fVolumeSlider;
|
||||
bigtime_t fLastVolumeUpdate;
|
||||
BParameterWeb *fParameterWeb;
|
||||
uint32 _m_reserved[15];
|
||||
struct _waiting_sound {
|
||||
_waiting_sound* next;
|
||||
bigtime_t start_time;
|
||||
BSound* sound;
|
||||
play_id id;
|
||||
int32 rate;
|
||||
float volume;
|
||||
};
|
||||
|
||||
void NotifySoundDone(
|
||||
play_id sound,
|
||||
bool got_to_play);
|
||||
_waiting_sound* fWaitingSounds;
|
||||
|
||||
void get_volume_slider();
|
||||
void Init(
|
||||
const media_node * node,
|
||||
const media_multi_audio_format * format,
|
||||
const char * name,
|
||||
const media_input * input,
|
||||
void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format),
|
||||
void (*Notifier)(void *, sound_player_notification what, ...),
|
||||
void * cookie);
|
||||
// for B_STARTED and B_STOPPED, the argument is BSoundPlayer* (this)
|
||||
// for B_SOUND_DONE, the arguments are play_id and true/false for whether it got to play data at all
|
||||
virtual void Notify(
|
||||
sound_player_notification what,
|
||||
void (*fPlayBufferFunc)(void* cookie, void* buffer,
|
||||
size_t size, const media_raw_audio_format& format);
|
||||
void (*fNotifierFunc)(void* cookie, sound_player_notification what,
|
||||
...);
|
||||
// get data into the buffer to play -- this version will use the queued BSound system
|
||||
virtual void PlayBuffer(
|
||||
void * buffer,
|
||||
size_t size,
|
||||
const media_raw_audio_format & format);
|
||||
|
||||
BLocker fLocker;
|
||||
float fVolumeDB;
|
||||
media_input fMediaInput;
|
||||
// Usually the system mixer
|
||||
media_output fMediaOutput;
|
||||
// The playback node
|
||||
void* fCookie;
|
||||
// Opaque handle passed to hooks
|
||||
int32 fFlags;
|
||||
|
||||
status_t fInitStatus;
|
||||
BContinuousParameter* fVolumeSlider;
|
||||
bigtime_t fLastVolumeUpdate;
|
||||
BParameterWeb* fParameterWeb;
|
||||
|
||||
uint32 _m_reserved[15];
|
||||
|
||||
private:
|
||||
void NotifySoundDone(play_id sound, bool gotToPlay);
|
||||
|
||||
void get_volume_slider();
|
||||
void Init(const media_node* node,
|
||||
const media_multi_audio_format* format,
|
||||
const char* name,
|
||||
const media_input* input,
|
||||
void (*PlayBuffer)(void*, void* buffer,
|
||||
size_t size,
|
||||
const media_raw_audio_format& format),
|
||||
void (*Notifier)(void*,
|
||||
sound_player_notification what, ...),
|
||||
void* cookie);
|
||||
// For B_STARTED and B_STOPPED, the argument is BSoundPlayer* (this).
|
||||
// For B_SOUND_DONE, the arguments are play_id and true/false for
|
||||
// whether it got to play data at all.
|
||||
virtual void Notify(sound_player_notification what,
|
||||
...);
|
||||
// Get data into the buffer to play -- this version will use the
|
||||
// queued BSound system.
|
||||
virtual void PlayBuffer(void* buffer, size_t size,
|
||||
const media_raw_audio_format& format);
|
||||
};
|
||||
|
||||
|
||||
#endif /* _SOUND_PLAYER_H */
|
||||
#endif // _SOUND_PLAYER_H
|
||||
|
Loading…
Reference in New Issue
Block a user