Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Expected expression in LFO.cpp
No permission to create posts
May 5, 2015
8:04 pm
Avatar
BrianD
Member
Members
Forum Posts: 8
Member Since:
March 24, 2015
sp_UserOfflineSmall Offline

Hey all,

I'm working my way through the synth book and was doing the first setup of LFO.cpp. I'm not sure where I went wrong in putting together the doOscillate() function but I get an error message that VS "Expected an expression"

double CLFO::doOscillate()
{
inline double doOscillate(double* pQuadPhaseOutput = NULL) // the "inline" is where the error is being called
{

...

now if I add virtual to the call:

double CLFO::doOscillate()
{
inline virtual double doOscillate(double* pQuadPhaseOutput = NULL)
{

the expected expression error is resolved, but then virtual will raise an "invalid specifier outside a class declaration" error

I'm not sure what's wrong, but I believe I did everything else right (creating the LFO class, using COscillator as a base, including the appropriate headers, etc...)

May 5, 2015
9:02 pm
Avatar
W Pirkle
Admin
Forum Posts: 143
Member Since:
January 28, 2017
sp_UserOfflineSmall Offline

I'm not sure what you are trying to do here, but both syntaxes are wrong.

I think you have doOscillate() defined in the .h file

// in the .h file somewhere
inline double doOscillate()
{

}

Whenever you define a function implementation (with or without the inline specifier, and with or without the virtual specifier) inside the .h file, there is no implementation in the .cpp file. I would have expected a "this function already has a body" error. So, you should't be implementing the function in the .cpp file if you already have it in the .h file.

If on the other hand you are trying to call the base class, you would write:

double CLFO::doOscillate()
{
COscillator::doOscillate();
}

The doOscillate(), doFilter() and other CPU intensive functions are implemented in the .h file and declared as inline to force the compiler to place the chunk of code inline without jumps, which is less efficient in terms of DLL size, but (theoretically at least) more efficient for CPU usage since the jumps are removed.

- Will

Forum Timezone: America/New_York

Most Users Ever Online: 36

Currently Online:
4 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Skyler: 47

Peter: 41

Derek: 41

clau_ste: 39

Frodson: 38

Gwen: 32

EZB: 24

lppier: 23

Msaldaña: 18

Jorge: 17

Member Stats:

Guest Posters: 1

Members: 477

Moderators: 1

Admins: 4

Forum Stats:

Groups: 11

Forums: 30

Topics: 483

Posts: 1877

Newest Members:

Jaggxn, sam, annaharris, Marie Weaver, kev, Steven, Mr Anderson, mguy, omelc

Moderators: W Pirkle: 143

Administrators: Tom: 65, JD Young: 80, Will Pirkle: 0, W Pirkle: 143