Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Property Editor Problem With Enum

oikonenoikonen Member Posts: 1
Can someone tell me why this don't work as i expect. In object inspector Channels are 'cisWaveIn ' and 'chStereo', they should be
'chMono' and 'chStereo' . BitsPerSample and SampleRate don't have a drop downs and they are numbers 8 and 22050.

---
I found this:

enum [] { [= ], ...} [var_list];
...
In the absence of a the first enumerator is assigned the value of zero. Any subsequent names without initializers will then increase by one. can be any expression yielding a positive or negative integer value (after possible integer promotions). These values are usually unique, but duplicates are legal.
---

I don't need zer0 so where to hide the first constant so it won't be seen in property editor?

What i'm doing wrong? Olavi.

//---------------------------------------------------------------------------

#ifndef TcisWaveInH
#define TcisWaveInH
//---------------------------------------------------------------------------
#include
#include
#include
//---------------------------------------------------------------------------

enum TChannels {chMono = 1, chStereo = 2};
enum TBitsPerSample {bs_8 = 8, bs16 = 16};
enum TSampleRate {sr_8000 = 8000, sr11025 = 11025, sr22050 = 22050, sr44100 = 44100};
//---------------------------------------------------------------------------
class PACKAGE TcisWaveIn : public TComponent
{
private:
TChannels FChannels;
TBitsPerSample FBitsPerSample;
TSampleRate FSampleRate;
protected:
public:
__fastcall TcisWaveIn(TComponent* Owner);
__published:
__property TChannels Channels =
{read=FChannels, write=FChannels, default=chMono};
__property TBitsPerSample BitsPerSample =
{read=FBitsPerSample, write=FBitsPerSample, default=bs_8};
__property TSampleRate SampleRate =
{read=FSampleRate, write=FSampleRate, default=sr22050};
};
//---------------------------------------------------------------------------
#endif


***

//---------------------------------------------------------------------------

#include
#pragma hdrstop
#include "TcisWaveIn.h"
#pragma package(smart_init)
//---------------------------------------------------------------------------
// ValidCtrCheck is used to assure that the components created do not have
// any pure virtual functions.
//

static inline void ValidCtrCheck(TcisWaveIn *)
{
new TcisWaveIn(NULL);
}
//---------------------------------------------------------------------------
__fastcall TcisWaveIn::TcisWaveIn(TComponent* Owner)
: TComponent(Owner)
{
Channels = chMono;
BitsPerSample = bs_8;
SampleRate = sr22050;
}
//---------------------------------------------------------------------------
namespace Tciswavein
{
void __fastcall PACKAGE Register()
{
TComponentClass classes[1] = {__classid(TcisWaveIn)};
RegisterComponents("Audio", classes, 0);
}
}
//---------------------------------------------------------------------------

Sign In or Register to comment.