[C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi,
I am trying to use Boost Python with a set of classes I am compiling into a
library.
Call them class A, class B and class C.
If I just have class A and I use: BOOST_PYTHON_MODULE(A) and my Makefile
builds an executable called A.so I am able to see the classes embedded in the
module.
However, if I compile to a different .so name, say D.so, I cannot see any of
the classes inside my BOOST_PYTHON_MODULE definition. For example, if I wrote:
BOOST_PYTHON_MODULE(strategy)
{
using namespace boost::python;
class_("EncoderStrategy", init())
.def("setComplexity", &EncoderStrategy::setComplexity)
.def("getComplexity", &EncoderStrategy::getComplexity);
}
and I compile my code to be in a shared object strategy.so, when I load the
class into python, I don’t see the EncoderStrategy class as an attribute of
strategy. I have tried to read the docs re: packages and submodules but am
unclear how to use them.
Ideally, I would like one .so file called strategy.so that encompasses a set of
classes. Is there an example or other documentation that would help me here?
Thanks.
-Jon
___
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi Jon, what you are describing makes perfect sense, and should work without problem. From your description it isn't clear why this isn't working, so I suggest you put together a self-contained test that doesn't work as you expect, and send that out so we can have a look. Otherwise we'd have to guess. The online docs at http://boostorg.github.io/python/doc/html/index.html should contain everything you need. Stefan -- ...ich hab' noch einen Koffer in Berlin... ___ Cplusplus-sig mailing list [email protected] https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi,
Thanks for responding. Here is my header file. I am compiling this to a
shared object called opus_strategy.so. If I set the argument of
BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to have
the name opus_encoder_strategy.so,I can load the boost python module into my
python interpreter and see the OpusEncoderStrategy class as an attribute.
However, if I choose other names such as opus_strategy for the argument to
BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear to
have any recognized attributes. I don’t understand why the name should matter.
As I had noted in my previous email, I would like to have a shared object file
with the name opus_strategy.so that encompasses a set of classes. Just can’t
figure out how to get it to work. I am on OS X, BTW if that matters.
Any help would be greatly appreciated.
Thanks.
-Jon
#ifndef OPUS_ENCODER_STRATEGY_H_
#define OPUS_ENCODER_STRATEGY_H_
#include "memory"
#include "opus/opus.h"
#include "opus/opus_defines.h"
#include "opus/opus_multistream.h"
#include "opus/opus_types.h"
#include
#include
#include
#include
#include
#include
#include
namespace bp = boost::python;
namespace np = boost::numpy;
using namespace std;
class OpusEncoderStrategy {
public:
OpusEncoderStrategy(const int sample_rate, const int number_channels,
const int opus_application);
~OpusEncoderStrategy();
opus_int32 encode(const float* pcm, const int frame_size, const
unsigned char* data, opus_int32 max_data_bytes);
bool setComplexity(const int c);
int getComplexity();
private:
bool encoderCtl();
int getPacketDurationBytes();
OpusEncoder* encoder;
int fs;
int channels;
int application;
int error;
};
BOOST_PYTHON_MODULE(opus_strategy)
{
using namespace boost::python;
class_("OpusEncoderStrategy", init())
.def("setComplexity", &OpusEncoderStrategy::setComplexity)
.def("getComplexity", &OpusEncoderStrategy::getComplexity);
}
#endif
> On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
>
> Hi Jon,
>
> what you are describing makes perfect sense, and should work without
> problem. From your description it isn't clear why this isn't working, so
> I suggest you put together a self-contained test that doesn't work as
> you expect, and send that out so we can have a look. Otherwise we'd have
> to guess.
> The online docs at http://boostorg.github.io/python/doc/html/index.html
> should contain everything you need.
>
>Stefan
>
> --
>
> ...ich hab' noch einen Koffer in Berlin...
>
> ___
> Cplusplus-sig mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi Jon,
please remove the dependency on the "opus/*" headers, so we can compile
the module ourselves and try to reproduce what you are reporting.
(That's what I meant with "self-contained test".)
Thanks,
Stefan
On 08.09.2016 17:30, Jon Lederman wrote:
> Hi,
>
> Thanks for responding. Here is my header file. I am compiling this to a
> shared object called opus_strategy.so. If I set the argument of
> BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to have
> the name opus_encoder_strategy.so,I can load the boost python module into my
> python interpreter and see the OpusEncoderStrategy class as an attribute.
>
> However, if I choose other names such as opus_strategy for the argument to
> BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear to
> have any recognized attributes. I don’t understand why the name should
> matter. As I had noted in my previous email, I would like to have a shared
> object file with the name opus_strategy.so that encompasses a set of classes.
> Just can’t figure out how to get it to work. I am on OS X, BTW if that
> matters.
>
> Any help would be greatly appreciated.
>
> Thanks.
>
> -Jon
> #ifndef OPUS_ENCODER_STRATEGY_H_
> #define OPUS_ENCODER_STRATEGY_H_
>
>
>
>
>
> #include "memory"
> #include "opus/opus.h"
> #include "opus/opus_defines.h"
> #include "opus/opus_multistream.h"
> #include "opus/opus_types.h"
>
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
> namespace bp = boost::python;
> namespace np = boost::numpy;
>
> using namespace std;
>
>
> class OpusEncoderStrategy {
>
> public:
>
> OpusEncoderStrategy(const int sample_rate, const int number_channels,
> const int opus_application);
> ~OpusEncoderStrategy();
>
> opus_int32 encode(const float* pcm, const int frame_size, const
> unsigned char* data, opus_int32 max_data_bytes);
>
> bool setComplexity(const int c);
> int getComplexity();
>
>
> private:
>
> bool encoderCtl();
> int getPacketDurationBytes();
>
>
>
> OpusEncoder* encoder;
>
> int fs;
> int channels;
> int application;
> int error;
>
>
> };
>
>
> BOOST_PYTHON_MODULE(opus_strategy)
> {
> using namespace boost::python;
>
>
> class_("OpusEncoderStrategy", init const int, const int>())
> .def("setComplexity", &OpusEncoderStrategy::setComplexity)
> .def("getComplexity", &OpusEncoderStrategy::getComplexity);
> }
>
>
> #endif
>> On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
>>
>> Hi Jon,
>>
>> what you are describing makes perfect sense, and should work without
>> problem. From your description it isn't clear why this isn't working, so
>> I suggest you put together a self-contained test that doesn't work as
>> you expect, and send that out so we can have a look. Otherwise we'd have
>> to guess.
>> The online docs at http://boostorg.github.io/python/doc/html/index.html
>> should contain everything you need.
>>
>>Stefan
>>
>> --
>>
>> ...ich hab' noch einen Koffer in Berlin...
>>
>> ___
>> Cplusplus-sig mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/cplusplus-sig
> ___
> Cplusplus-sig mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/cplusplus-sig
--
...ich hab' noch einen Koffer in Berlin...
___
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi,
Ok. I have removed all the opus library dependencies and stripped away much of
everything else. It seems to me that the name of the generated .so has to
match the name of the module. Perhaps I am building incorrectly. I am using
make.
-Jon
#ifndef OPUS_ENCODER_STRATEGY_H_
#define OPUS_ENCODER_STRATEGY_H_
#include "memory"
#include
#include
#include
#include
#include
#include
#include
namespace bp = boost::python;
namespace np = boost::numpy;
using namespace std;
class OpusEncoderStrategy {
public:
OpusEncoderStrategy(){};
~OpusEncoderStrategy(){};
int fs;
int channels;
int application;
int error;
};
BOOST_PYTHON_MODULE(opus_strategy)
{
using namespace boost::python;
class_("OpusEncoderStrategy", init());
}
#endif
> On Sep 8, 2016, at 6:00 PM, Stefan Seefeld wrote:
>
> Hi Jon,
>
> please remove the dependency on the "opus/*" headers, so we can compile
> the module ourselves and try to reproduce what you are reporting.
> (That's what I meant with "self-contained test".)
>
>
> Thanks,
>Stefan
>
> On 08.09.2016 17:30, Jon Lederman wrote:
>> Hi,
>>
>> Thanks for responding. Here is my header file. I am compiling this to a
>> shared object called opus_strategy.so. If I set the argument of
>> BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to
>> have the name opus_encoder_strategy.so,I can load the boost python module
>> into my python interpreter and see the OpusEncoderStrategy class as an
>> attribute.
>>
>> However, if I choose other names such as opus_strategy for the argument to
>> BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear
>> to have any recognized attributes. I don’t understand why the name should
>> matter. As I had noted in my previous email, I would like to have a shared
>> object file with the name opus_strategy.so that encompasses a set of
>> classes. Just can’t figure out how to get it to work. I am on OS X, BTW if
>> that matters.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks.
>>
>> -Jon
>> #ifndef OPUS_ENCODER_STRATEGY_H_
>> #define OPUS_ENCODER_STRATEGY_H_
>>
>>
>>
>>
>>
>> #include "memory"
>> #include "opus/opus.h"
>> #include "opus/opus_defines.h"
>> #include "opus/opus_multistream.h"
>> #include "opus/opus_types.h"
>>
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>>
>> namespace bp = boost::python;
>> namespace np = boost::numpy;
>>
>> using namespace std;
>>
>>
>> class OpusEncoderStrategy {
>>
>> public:
>>
>> OpusEncoderStrategy(const int sample_rate, const int number_channels,
>> const int opus_application);
>> ~OpusEncoderStrategy();
>>
>> opus_int32 encode(const float* pcm, const int frame_size, const
>> unsigned char* data, opus_int32 max_data_bytes);
>>
>> bool setComplexity(const int c);
>> int getComplexity();
>>
>>
>> private:
>>
>> bool encoderCtl();
>> int getPacketDurationBytes();
>>
>>
>>
>> OpusEncoder* encoder;
>>
>> int fs;
>> int channels;
>> int application;
>> int error;
>>
>>
>> };
>>
>>
>> BOOST_PYTHON_MODULE(opus_strategy)
>> {
>> using namespace boost::python;
>>
>>
>> class_("OpusEncoderStrategy", init> const int, const int>())
>> .def("setComplexity", &OpusEncoderStrategy::setComplexity)
>> .def("getComplexity", &OpusEncoderStrategy::getComplexity);
>> }
>>
>>
>> #endif
>>> On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
>>>
>>> Hi Jon,
>>>
>>> what you are describing makes perfect sense, and should work without
>>> problem. From your description it isn't clear why this isn't working, so
>>> I suggest you put together a self-contained test that doesn't work as
>>> you expect, and send that out so we can have a look. Otherwise we'd have
>>> to guess.
>>> The online docs at http://boostorg.github.io/python/doc/html/index.html
>>> should contain everything you need.
>>>
>>> Stefan
>>>
>>> --
>>>
>>> ...ich hab' noch einen Koffer in Berlin...
>>>
>>> ___
>>> Cplusplus-sig mailing list
>>> [email protected]
>>> https://mail.python.org/mailman/listinfo/cplusplus-sig
>> ___
>> Cplusplus-sig mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/cplusplus-sig
>
>
> --
>
> ...ich hab' noch einen Koffer in Berlin...
>
> ___
> Cplusplus-sig mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi,
I think this text on this page: https://www.preney.ca/paul/archives/107
relates to the issue I’m having:
It is very important that "libyay" in BOOST_PYTHON_MODULE(libyay) matches the
name of the library you're generating in CMakeLists.txt (without the extension).
NOTE: On Linux / Unix systems you will need to prefix the name with "lib" as
CMake defaults to prepending the file with "lib" as per convention on Linux /
Unix systems.
Essentially, the BOOST_PYTHON_MODULE clause exports the "yay" function as the
Python symbol name "yay". This will allow you to call the "yay" function from
Python later.
> On Sep 8, 2016, at 6:33 PM, Jon Lederman wrote:
>
> Hi,
>
> Ok. I have removed all the opus library dependencies and stripped away much
> of everything else. It seems to me that the name of the generated .so has to
> match the name of the module. Perhaps I am building incorrectly. I am using
> make.
>
>
>
> -Jon
>
> #ifndef OPUS_ENCODER_STRATEGY_H_
> #define OPUS_ENCODER_STRATEGY_H_
>
> #include "memory"
> #include
> #include
> #include
> #include
> #include
> #include
> #include
>
> namespace bp = boost::python;
> namespace np = boost::numpy;
>
> using namespace std;
>
>
> class OpusEncoderStrategy {
>
> public:
>
> OpusEncoderStrategy(){};
> ~OpusEncoderStrategy(){};
>
> int fs;
> int channels;
> int application;
> int error;
>
>
> };
>
>
> BOOST_PYTHON_MODULE(opus_strategy)
> {
> using namespace boost::python;
>
> class_("OpusEncoderStrategy", init const int, const int>());
> }
>
>
> #endif
>> On Sep 8, 2016, at 6:00 PM, Stefan Seefeld wrote:
>>
>> Hi Jon,
>>
>> please remove the dependency on the "opus/*" headers, so we can compile
>> the module ourselves and try to reproduce what you are reporting.
>> (That's what I meant with "self-contained test".)
>>
>>
>> Thanks,
>> Stefan
>>
>> On 08.09.2016 17:30, Jon Lederman wrote:
>>> Hi,
>>>
>>> Thanks for responding. Here is my header file. I am compiling this to a
>>> shared object called opus_strategy.so. If I set the argument of
>>> BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to
>>> have the name opus_encoder_strategy.so,I can load the boost python module
>>> into my python interpreter and see the OpusEncoderStrategy class as an
>>> attribute.
>>>
>>> However, if I choose other names such as opus_strategy for the argument to
>>> BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear
>>> to have any recognized attributes. I don’t understand why the name should
>>> matter. As I had noted in my previous email, I would like to have a shared
>>> object file with the name opus_strategy.so that encompasses a set of
>>> classes. Just can’t figure out how to get it to work. I am on OS X, BTW
>>> if that matters.
>>>
>>> Any help would be greatly appreciated.
>>>
>>> Thanks.
>>>
>>> -Jon
>>> #ifndef OPUS_ENCODER_STRATEGY_H_
>>> #define OPUS_ENCODER_STRATEGY_H_
>>>
>>>
>>>
>>>
>>>
>>> #include "memory"
>>> #include "opus/opus.h"
>>> #include "opus/opus_defines.h"
>>> #include "opus/opus_multistream.h"
>>> #include "opus/opus_types.h"
>>>
>>> #include
>>> #include
>>> #include
>>> #include
>>> #include
>>> #include
>>> #include
>>>
>>> namespace bp = boost::python;
>>> namespace np = boost::numpy;
>>>
>>> using namespace std;
>>>
>>>
>>> class OpusEncoderStrategy {
>>>
>>> public:
>>>
>>> OpusEncoderStrategy(const int sample_rate, const int number_channels,
>>> const int opus_application);
>>> ~OpusEncoderStrategy();
>>>
>>> opus_int32 encode(const float* pcm, const int frame_size, const
>>> unsigned char* data, opus_int32 max_data_bytes);
>>>
>>> bool setComplexity(const int c);
>>> int getComplexity();
>>>
>>>
>>> private:
>>>
>>> bool encoderCtl();
>>> int getPacketDurationBytes();
>>>
>>>
>>>
>>> OpusEncoder* encoder;
>>>
>>> int fs;
>>> int channels;
>>> int application;
>>> int error;
>>>
>>>
>>> };
>>>
>>>
>>> BOOST_PYTHON_MODULE(opus_strategy)
>>> {
>>> using namespace boost::python;
>>>
>>>
>>> class_("OpusEncoderStrategy", init>> const int, const int>())
>>> .def("setComplexity", &OpusEncoderStrategy::setComplexity)
>>> .def("getComplexity", &OpusEncoderStrategy::getComplexity);
>>> }
>>>
>>>
>>> #endif
On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
Hi Jon,
what you are describing makes perfect sense, and should work without
problem. From your description it isn't clear why this isn't working, so
I suggest you put together a self-contained test that doesn't work as
you expect, and send that out so we can have a look. Otherwise we'd have
to guess.
The online docs at http://boostorg.github.io/python/doc/html/index.html
should contain everything you need.
Stefan
--
...ich ha
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
For example in this example, does the name of my shared object file (.so) need
to be zoo.so in order to see the attribute Animal? I am very confused about
all of this.
/*
* This inclusion should be put at the beginning. It will include .
*/
#include
#include
#include
#include
#include
#include
/*
* This is the C++ function we write and want to expose to Python.
*/
const std::string hello() {
return std::string("hello, zoo");
}
/*
* Create a C++ class to represent animals in the zoo.
*/
class Animal {
public:
// Constructor. Note no default constructor is defined.
Animal(std::string const & in_name): m_name(in_name) {}
// Copy constructor.
Animal(Animal const & in_other): m_name(in_other.m_name) {}
// Copy assignment.
Animal & operator=(Animal const & in_other) {
this->m_name = in_other.m_name;
return *this;
}
// Utility method to get the address of the instance.
uintptr_t get_address() const {
return reinterpret_cast(this);
}
// Getter of the name property.
std::string get_name() const {
return this->m_name;
}
// Setter of the name property.
void set_name(std::string const & in_name) {
this->m_name = in_name;
}
private:
// The only property: the name of the animal.
std::string m_name;
};
/*
* This is a macro Boost.Python provides to signify a Python extension module.
*/
BOOST_PYTHON_MODULE(zoo) {
// An established convention for using boost.python.
using namespace boost::python;
// Expose the function hello().
def("hello", hello);
// Expose the class Animal.
class_("Animal",
init())
.def("get_address", &Animal::get_address)
.add_property("name", &Animal::get_name, &Animal::set_name)
;
}
// vim: set ai et nu sw=4 ts=4 tw=79:
> On Sep 8, 2016, at 6:00 PM, Stefan Seefeld wrote:
>
> Hi Jon,
>
> please remove the dependency on the "opus/*" headers, so we can compile
> the module ourselves and try to reproduce what you are reporting.
> (That's what I meant with "self-contained test".)
>
>
> Thanks,
>Stefan
>
> On 08.09.2016 17:30, Jon Lederman wrote:
>> Hi,
>>
>> Thanks for responding. Here is my header file. I am compiling this to a
>> shared object called opus_strategy.so. If I set the argument of
>> BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to
>> have the name opus_encoder_strategy.so,I can load the boost python module
>> into my python interpreter and see the OpusEncoderStrategy class as an
>> attribute.
>>
>> However, if I choose other names such as opus_strategy for the argument to
>> BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear
>> to have any recognized attributes. I don’t understand why the name should
>> matter. As I had noted in my previous email, I would like to have a shared
>> object file with the name opus_strategy.so that encompasses a set of
>> classes. Just can’t figure out how to get it to work. I am on OS X, BTW if
>> that matters.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks.
>>
>> -Jon
>> #ifndef OPUS_ENCODER_STRATEGY_H_
>> #define OPUS_ENCODER_STRATEGY_H_
>>
>>
>>
>>
>>
>> #include "memory"
>> #include "opus/opus.h"
>> #include "opus/opus_defines.h"
>> #include "opus/opus_multistream.h"
>> #include "opus/opus_types.h"
>>
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>>
>> namespace bp = boost::python;
>> namespace np = boost::numpy;
>>
>> using namespace std;
>>
>>
>> class OpusEncoderStrategy {
>>
>> public:
>>
>> OpusEncoderStrategy(const int sample_rate, const int number_channels,
>> const int opus_application);
>> ~OpusEncoderStrategy();
>>
>> opus_int32 encode(const float* pcm, const int frame_size, const
>> unsigned char* data, opus_int32 max_data_bytes);
>>
>> bool setComplexity(const int c);
>> int getComplexity();
>>
>>
>> private:
>>
>> bool encoderCtl();
>> int getPacketDurationBytes();
>>
>>
>>
>> OpusEncoder* encoder;
>>
>> int fs;
>> int channels;
>> int application;
>> int error;
>>
>>
>> };
>>
>>
>> BOOST_PYTHON_MODULE(opus_strategy)
>> {
>> using namespace boost::python;
>>
>>
>> class_("OpusEncoderStrategy", init> const int, const int>())
>> .def("setComplexity", &OpusEncoderStrategy::setComplexity)
>> .def("getComplexity", &OpusEncoderStrategy::getComplexity);
>> }
>>
>>
>> #endif
>>> On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
>>>
>>> Hi Jon,
>>>
>>> what you are describing makes perfect sense, and should work without
>>> problem. From your description it isn't clear why this isn't working, so
>>> I suggest you put together a self-contained test that doesn't work as
>>> you expect, and send that out so we can have a look. Otherwise we'd have
>>> to guess.
>>> The online docs at http://boostorg.gith
Re: [C++-sig] Boost Python Question - Multiple Classes and Modules not appearing as attribute
Hi,
And here is yet another person who seems to encounter the same issue:
http://stackoverflow.com/questions/9140572/c-boost-python-2-problems
-Jon
> On Sep 8, 2016, at 6:00 PM, Stefan Seefeld wrote:
>
> Hi Jon,
>
> please remove the dependency on the "opus/*" headers, so we can compile
> the module ourselves and try to reproduce what you are reporting.
> (That's what I meant with "self-contained test".)
>
>
> Thanks,
>Stefan
>
> On 08.09.2016 17:30, Jon Lederman wrote:
>> Hi,
>>
>> Thanks for responding. Here is my header file. I am compiling this to a
>> shared object called opus_strategy.so. If I set the argument of
>> BOOST_PYTHON_MODULE to opus_encoder_strategy, and compile my .so file to
>> have the name opus_encoder_strategy.so,I can load the boost python module
>> into my python interpreter and see the OpusEncoderStrategy class as an
>> attribute.
>>
>> However, if I choose other names such as opus_strategy for the argument to
>> BOOST_PYTHON_MODULE, when I load the boost python object it doesn’t appear
>> to have any recognized attributes. I don’t understand why the name should
>> matter. As I had noted in my previous email, I would like to have a shared
>> object file with the name opus_strategy.so that encompasses a set of
>> classes. Just can’t figure out how to get it to work. I am on OS X, BTW if
>> that matters.
>>
>> Any help would be greatly appreciated.
>>
>> Thanks.
>>
>> -Jon
>> #ifndef OPUS_ENCODER_STRATEGY_H_
>> #define OPUS_ENCODER_STRATEGY_H_
>>
>>
>>
>>
>>
>> #include "memory"
>> #include "opus/opus.h"
>> #include "opus/opus_defines.h"
>> #include "opus/opus_multistream.h"
>> #include "opus/opus_types.h"
>>
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>> #include
>>
>> namespace bp = boost::python;
>> namespace np = boost::numpy;
>>
>> using namespace std;
>>
>>
>> class OpusEncoderStrategy {
>>
>> public:
>>
>> OpusEncoderStrategy(const int sample_rate, const int number_channels,
>> const int opus_application);
>> ~OpusEncoderStrategy();
>>
>> opus_int32 encode(const float* pcm, const int frame_size, const
>> unsigned char* data, opus_int32 max_data_bytes);
>>
>> bool setComplexity(const int c);
>> int getComplexity();
>>
>>
>> private:
>>
>> bool encoderCtl();
>> int getPacketDurationBytes();
>>
>>
>>
>> OpusEncoder* encoder;
>>
>> int fs;
>> int channels;
>> int application;
>> int error;
>>
>>
>> };
>>
>>
>> BOOST_PYTHON_MODULE(opus_strategy)
>> {
>> using namespace boost::python;
>>
>>
>> class_("OpusEncoderStrategy", init> const int, const int>())
>> .def("setComplexity", &OpusEncoderStrategy::setComplexity)
>> .def("getComplexity", &OpusEncoderStrategy::getComplexity);
>> }
>>
>>
>> #endif
>>> On Sep 8, 2016, at 4:47 PM, Stefan Seefeld wrote:
>>>
>>> Hi Jon,
>>>
>>> what you are describing makes perfect sense, and should work without
>>> problem. From your description it isn't clear why this isn't working, so
>>> I suggest you put together a self-contained test that doesn't work as
>>> you expect, and send that out so we can have a look. Otherwise we'd have
>>> to guess.
>>> The online docs at http://boostorg.github.io/python/doc/html/index.html
>>> should contain everything you need.
>>>
>>> Stefan
>>>
>>> --
>>>
>>> ...ich hab' noch einen Koffer in Berlin...
>>>
>>> ___
>>> Cplusplus-sig mailing list
>>> [email protected]
>>> https://mail.python.org/mailman/listinfo/cplusplus-sig
>> ___
>> Cplusplus-sig mailing list
>> [email protected]
>> https://mail.python.org/mailman/listinfo/cplusplus-sig
>
>
> --
>
> ...ich hab' noch einen Koffer in Berlin...
>
> ___
> Cplusplus-sig mailing list
> [email protected]
> https://mail.python.org/mailman/listinfo/cplusplus-sig
___
Cplusplus-sig mailing list
[email protected]
https://mail.python.org/mailman/listinfo/cplusplus-sig
