[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guidelines? (And a quick note about the website)




At 11:56 26/03/99 +0000, Nicholas wrote:
>First goal should be a release that works, that WE can write some simple
>test games for.   At the current rate of coding, it's unlike that we'll be
>close enough to a commerical release any time soon.

 We should also make this useful for demo coders as well. It's essentially
the same stuff used in games, just without any user interaction...

>However we can work on getting a library sufficently complete so that some
>demos are possible, to generate interest both with comments and new
>developers.

 Like others said, I think it's a good move to bounce some of the API specs
off some proffessional developers to get feedback, before it's finalized.

>> btw, Eelke Klein has already done a preliminary sound interface, minus
>> 3dsound, surround sound & other fancier stuff.
>
>I surpect you mean
>
>http://sunsite.auc.dk/penguinplay/PenguinSound/sound.h which is dated
>1998/08/28.

 Ummm, no. I've added what Eelke Klein wrote. He posted it on the
19th of January this year (1999).

>Note the PenguinSounds page is at 
>
>http://sunsite.auc.dk/penguinplay/PenguinSound/index.html
>
>Ive updated it a bit, but unfortunately the sunsite staff seem to be dead
>to the world at the moment, and cvs isn't working that well.

 It still had "what's new" dated April last year, so I guess it didn't go
through...

 Errol

 btw, here is the spec that Eelke Klein wrote in January. Unless I'm blind,
it looks totally different to the one on the web site. I hope Derek hasn't
re-invented the wheel too much!

-------------------------------------------------------------------------

#ifndef ppsAbstractDevice_hh
#define ppsAbstractDevice_hh

//
// There is no 3D support yet but it will be implemented with seperate
// interface functions.
//
// Do not take the term _device_ too literal.
//
class ppsAbstractDevice;

typedef unsigned int uint;

//--------------------------------------------------------------------
//
// structure used to define the sample formats
//
#define WAVE_FMT_LIN 	1
#define WAVE_FMT_ALAW 	2
#define WAVE_FMT_MULAW 	4

struct ppsSampleFormatDesc {
    uint format; // only linear pcm support at the moment
    uint channels;  	// 1 = mono 2 = stereo others not supported yet
    uint bitsPerSample; // bits in a sample in one channel (8 or 16)
    uint samplingRate;
};

//--------------------------------------------------------------------
//
// Structure for describing the requirements of the channel
// used when creating a channel
//
struct ppsChannelDesc {
    ppsSampleFormatDesc sampleDesc;
    struct {
	bool ctrlPitch: 1;
	// channel requires picth control
	bool ctrlPanning: 1;
	// channel requires panning control
	bool ctrlVolume: 1;
	// channel requires volume control
	bool kindStatic: 1;
	// channel should be static
    } flags;
    uint bufferSize; // For streams this field may be modified by the driver
    uint nrFrags;
    // Number of fragments in which the buffer should be divided. Is
ignored for
    // static channels. Driver may modify it.
    // Somehow a notification should be send when a frag of a stream
channel has
    // been played so the application can send new data.
    void* data;
    // data is a value which is used to pass on the memory location
    // of the data. For static data it's used to pass the location of the data
    // while for streaming data it's a return value of where the driver wants
    // the data to go.
};

//--------------------------------------------------------------------
//
// Structure used to describe the capabilities of a device
//
struct ppsDeviceCaps {
    struct {
    	bool continuousRate: 1;
	// true if "all" rates between minSamplingRate and maxSamplingRate
	// are supported
	bool bits16: 1;
	bool bits8: 1;
	bool mono: 1;
	bool stereo: 1;
	bool ctrlPitch: 1;
	// The pitch (samplingrate) can be changed during playback
	bool ctrlPanning: 1;
	// The panning can be changed during playback 
	bool ctrlVolume: 1;
	// The volume can be changed during playback
    } flags;
    uint minSamplingRate; 
    uint maxSamplingRate;
    uint nrAllChannels;     // maximum number of channels
    uint nrStaticChannels;  // max static channels
    uint nrStreamChannels;  // max stream channels
    uint freeStaticChannels; // free static channels
    uint freeStreamChannels; // free stream channels
    uint memoryTotalSize;   // onboard memory size
    uint memoryTotalFree;   // free onboard memory
    uint memoryContinuousFree;
    // should be equal to the largest block or max sample size whichever is
    // smaller. On some cards there might be a 1 MB block of free memory but 
    // the largest sample may not be bigger then 64 kB. In that case this
    // function should return 64 kB and not 1 MB. If a soundcard requires a
    // certain number of bytes between samples (AWE) it should subtract them
    // from the blocksize.
};

//--------------------------------------------------------------------
//
// abstract channel class
// When succesfully creating a channel you will get such a thing
//
class ppsHwAbstractChannel {
public:
    virtual void Start() = 0;
    // Start playing    
    virtual void Stop() = 0;
    // Stop playing, and reset all parameters
    virtual void Pause() = 0;
    // Pause playing, (stop but remember current state)
    virtual uint getPitch() const = 0;
    virtual uint getPan() const = 0;
    virtual uint getVolume() const = 0;
    // It's probably not needed, retrieving of parameters
    virtual void setPitch(uint rate) = 0;
    virtual void setPan(uint pan) = 0;
    virtual void setVolume(uint volume) = 0;
    // Purpose of these functions seems clear to me
    // What value ranges should we use?
};

//--------------------------------------------------------------------
//
// abstract device class
//
class ppsAbstractDevice {
public:
    virtual void Compact() const = 0;
    // defrags onboard memory
    virtual const ppsDeviceCaps& getCaps() const = 0;
    // return a structure with info about the device
    virtual ppsHwAbstractChannel* createChannel(ppsChannelDesc& desc) = 0;
    // create a new channel
};


#endif

-------------------------------------------------------------------------