mirror of
https://github.com/danog/php-libtgvoip.git
synced 2024-11-30 04:19:26 +01:00
Fixes
This commit is contained in:
parent
353d52ca65
commit
c8b40b1e62
@ -17,6 +17,7 @@ AudioInputPHP::AudioInputPHP(Php::Value callbacks){
|
|||||||
startMethod = callbacks["start"];
|
startMethod = callbacks["start"];
|
||||||
stopMethod = callbacks["stop"];
|
stopMethod = callbacks["stop"];
|
||||||
configureMethod = callbacks["configure"];
|
configureMethod = callbacks["configure"];
|
||||||
|
running = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -39,11 +40,12 @@ void AudioInputPHP::Stop(){
|
|||||||
stopMethod();
|
stopMethod();
|
||||||
running = false;
|
running = false;
|
||||||
}
|
}
|
||||||
void AudioInputPHP::writeFrames(Php::Parameters ¶ms){
|
bool AudioInputPHP::writeFrames(const char* data){
|
||||||
if(!running)
|
if(!running)
|
||||||
return;
|
return false;
|
||||||
unsigned char * buf;
|
unsigned char * buf;
|
||||||
memcpy(buf, params[0], 960*2);
|
memcpy(buf, data, 960*2);
|
||||||
InvokeCallback(buf, 960*2);
|
InvokeCallback(buf, 960*2);
|
||||||
delete buf;
|
delete buf;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
#ifndef LIBTGVOIP_AUDIOINPUTPHP_H
|
#ifndef LIBTGVOIP_AUDIOINPUTPHP_H
|
||||||
#define LIBTGVOIP_AUDIOINPUTPHP_H
|
#define LIBTGVOIP_AUDIOINPUTPHP_H
|
||||||
|
|
||||||
#include "phpcpp.h"
|
|
||||||
#include "../libtgvoip/audio/AudioInput.h"
|
#include "../libtgvoip/audio/AudioInput.h"
|
||||||
#include "../libtgvoip/threading.h"
|
#include "../libtgvoip/threading.h"
|
||||||
|
|
||||||
@ -21,7 +20,7 @@ public:
|
|||||||
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
virtual void Configure(uint32_t sampleRate, uint32_t bitsPerSample, uint32_t channels);
|
||||||
virtual void Start();
|
virtual void Start();
|
||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
void writeFrames(Php::Parameters ¶ms);
|
bool writeFrames(const char* data);
|
||||||
private:
|
private:
|
||||||
Php::Value configureMethod;
|
Php::Value configureMethod;
|
||||||
Php::Value startMethod;
|
Php::Value startMethod;
|
||||||
|
@ -47,7 +47,7 @@ float AudioOutputPHP::GetLevel(){
|
|||||||
return (double)getLevelMethod();
|
return (double)getLevelMethod();
|
||||||
}
|
}
|
||||||
|
|
||||||
Php::Value AudioOutputPHP::readFrames() {
|
unsigned char* AudioOutputPHP::readFrames() {
|
||||||
unsigned char* buf;
|
unsigned char* buf;
|
||||||
InvokeCallback(buf, 960*2);
|
InvokeCallback(buf, 960*2);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#define LIBTGVOIP_AUDIOOUTPUTPHP_H
|
#define LIBTGVOIP_AUDIOOUTPUTPHP_H
|
||||||
|
|
||||||
#include "../libtgvoip/audio/AudioOutput.h"
|
#include "../libtgvoip/audio/AudioOutput.h"
|
||||||
#include "phpcpp.h"
|
|
||||||
|
|
||||||
namespace tgvoip{ namespace audio{
|
namespace tgvoip{ namespace audio{
|
||||||
class AudioOutputPHP : public AudioOutput{
|
class AudioOutputPHP : public AudioOutput{
|
||||||
@ -22,7 +21,7 @@ public:
|
|||||||
virtual void Stop();
|
virtual void Stop();
|
||||||
virtual bool IsPlaying() override;
|
virtual bool IsPlaying() override;
|
||||||
virtual float GetLevel() override;
|
virtual float GetLevel() override;
|
||||||
Php::Value readFrames();
|
unsigned char* readFrames();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Php::Value configureMethod;
|
Php::Value configureMethod;
|
||||||
|
4
main.cpp
4
main.cpp
@ -94,9 +94,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void writeFrames(Php::Parameters ¶ms) {
|
Php::Value writeFrames(Php::Parameters ¶ms) {
|
||||||
AudioInputPHP* in=(AudioInputPHP*)(intptr_t)inst;
|
AudioInputPHP* in=(AudioInputPHP*)(intptr_t)inst;
|
||||||
in->writeFrames(params);
|
return in->writeFrames(params[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Php::Value readFrames() {
|
Php::Value readFrames() {
|
||||||
|
Loading…
Reference in New Issue
Block a user