repo_name
stringlengths 5
122
| path
stringlengths 3
232
| text
stringlengths 6
1.05M
|
|---|---|---|
kelvin943/ZQFoundation
|
ZQCommon/Category/Other/NSObject+ZQAdd.h
|
<filename>ZQCommon/Category/Other/NSObject+ZQAdd.h
//
// NSObject+ZQAdd.h
// ZQDemoApp
//
// Created by macro on 2018/8/24.
// Copyright © 2018年 张泉. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
typedef IMP* IMPPointer;
#define ZQExchangeInstanceMethod(__oriSel__,__newSel__,__class__ ) \
[NSObject exchangeInstanceMethod:__oriSel__ \
withMethod:__newSel__ \
andClass:__class__]; \
#define ZQExchangeClassMethod(__oriSel__,__newSel__,__class__ ) \
[NSObject exchangeClassMethod:__oriSel__ \
withMethod:__newSel__ \
andClass:__class__]; \
@interface NSObject (ZQAdd)
#pragma mark - 获取类结构相关方法
/** 获取成员变量,包括属性生成的成员变量 */
+ (NSArray *)fetchIvarList;
/** 获取类的属性列表,包括私有和公有属性,也包括分类中的属性 */
+ (NSArray *)fetchPropertyList;
/** 获取对象方法列表:包括getter, setter, 分类中的方法等 */
+ (NSArray *)fetchInstanceMethodList;
/** 获取类方法列表 包括分类里面的 */
+ (NSArray *)fetchClassMethodList;
/** 获取协议列表,包括.h .m 和分类里的 */
+ (NSArray *)fetchProtocolList;
#pragma mark - 快速方法交换实现
/*交换的必须是类中存在的方法,若类中不存改方法则会交换,可能出现各种问题,方法指针会错乱*/
+ (void)addMethod:(SEL)methodSel newMethodSel:(SEL)newMethodSel;
+ (BOOL)swapMethod:(SEL)originMethod currentMethod:(SEL)currentMethod;
+ (BOOL)swapClassMethod:(SEL)originMethod currentMethod:(SEL)currentMethod;
#pragma mark - 标准的方法交换实现
/*可以交换类中没有的方法,若类中不存在该方法则会给类添加添加一个方法并指向新的实现*/
+ (BOOL)swizzle:(SEL)original with:(IMP)replacement store:(IMPPointer)store;
+ (void)exchangeInstanceMethod:(SEL)originalSelector withMethod:(SEL)swizzledSelector andClass:(Class) target;
+ (void)exchangeClassMethod:(SEL)originalSelector withMethod:(SEL)swizzledSelector andClass:(Class) target;
@end
@interface NSObject (Method)
- (BOOL)isNilOrNull;
- (id)performSelector:(SEL)aSelector withObjects:(NSArray *)objects;
@end
|
kelvin943/ZQFoundation
|
ZQCommon/Category/Other/NSString+ZQAdd.h
|
//
// NSString+ZQSafe.h
// ZQDemoApp
//
// Created by macro on 2018/8/24.
// Copyright © 2018年 张泉. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSString (ZQSafe)
@end
@interface NSMutableString (ZQSafe)
@end
@interface NSDateFormatter (Static)
@end
@interface NSString (NSDate)
/* 从日期生成字符串 */
+ (NSString *)stringFromDate:(NSDate *)date;
@end
|
kelvin943/ZQFoundation
|
ZQUIKit/ZQBaseViewController/BaseViewController.h
|
<reponame>kelvin943/ZQFoundation<filename>ZQUIKit/ZQBaseViewController/BaseViewController.h<gh_stars>1-10
//
// BaseViewController.h
// MJRefresh
//
// Created by macro on 2019/9/6.
//
#import <UIKit/UIKit.h>
@protocol BaseViewControllerProtocol <NSObject>
@optional
//default is no
- (BOOL)disableInteractiveGesture;
//default is no
- (BOOL)needAddTapGestureDismissKeyborad;
@end
@protocol ZQNavigatorProtocol <NSObject>
@required
//参数化构建
- (instancetype)initWithQuery:(NSDictionary *)query;
@end
NS_ASSUME_NONNULL_BEGIN
@interface BaseViewController : UIViewController<BaseViewControllerProtocol,ZQNavigatorProtocol>
@end
NS_ASSUME_NONNULL_END
|
kelvin943/ZQFoundation
|
ZQCommon/Category/View/UIViewController+ZQAdd.h
|
<gh_stars>1-10
//
// UIViewController+ZQAdd.h
// ZQFoundation
//
// Created by 张泉(macro) on 2019/9/25.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, UIViewExceptionType) {
UIViewExceptionTypeServiceError = 1, // 服务出错
UIViewExceptionTypeNetworkError = 2, // 网络出错
/*空数据的情况放在 UITableView 分类中 由 UITableView 自动处理*/
//UIViewExceptionTypeNullData = 3, // 数据为空
};
@interface ZQExceptionView : UIView
// 设置异常标题
- (void)setText:(NSString *)title;
// 设置异常图片
- (void)setImage:(NSString *)imageNamed;
@end
@interface UIViewController (Exception)
- (void)showExceptionTitle:(NSString *)title imageName:(NSString *)imageName;
- (void)showExceptionTitle:(NSString *)title imageName:(NSString *)imageName atView:(UIView *)view;
- (void)showExceptionTitle:(NSString *)title imageName:(NSString *)imageName top:(CGFloat)top;
- (void)showExceptionView:(UIViewExceptionType)exceptionType;
- (void)showExceptionView:(UIViewExceptionType)exceptionType atView:(UIView *)view;
- (void)showExceptionView:(UIViewExceptionType)exceptionType top:(CGFloat)top;
- (void)hideExceptionView;
// 设置服务异常图片
- (NSString *)serviceErrorImageNameForExceptionView;
// 设置服务出错文字
- (NSString *)serviceErrorTitleForExceptionView;
// 设置网络出错图片
- (NSString *)networkErrorImageNameForExceptionView;
// 设置网络出错文字
- (NSString *)networkErrorTitleForExceptionView;
// 异常视图被点击事件
- (void)exceptionViewClickAction;
@end
|
kelvin943/ZQFoundation
|
ZQCommon/Category/View/UIView+ZQExten.h
|
//
// UIView+ZQExten.h
// ZQDemoApp
//
// Created by 张泉(macro) on 2018/8/17.
// Copyright © 2018年 张泉. All rights reserved.
//
#import <UIKit/UIKit.h>
#pragma mark - UIView 布局
@interface UIView (Layout)
@property (nonatomic) CGFloat left; ///< Shortcut for frame.origin.x.
@property (nonatomic) CGFloat top; ///< Shortcut for frame.origin.y
@property (nonatomic) CGFloat right; ///< Shortcut for frame.origin.x + frame.size.width
@property (nonatomic) CGFloat bottom; ///< Shortcut for frame.origin.y + frame.size.height
@property (nonatomic) CGFloat width; ///< Shortcut for frame.size.width.
@property (nonatomic) CGFloat height; ///< Shortcut for frame.size.height.
@property (nonatomic) CGFloat centerX; ///< Shortcut for center.x
@property (nonatomic) CGFloat centerY; ///< Shortcut for center.y
@property (nonatomic) CGPoint origin; ///< Shortcut for frame.origin.
@property (nonatomic) CGSize size; ///< Shortcut for frame.size.
@end
#pragma mark - layoutSubviews 布局回调
@interface UIView (LayoutSubviewsFinish)
/**
layoutSubviews callback with block
you need do something about layer with view's frame
then you can do it in this block
*/
@property (nonatomic,copy) void (^layoutSubviewsFinish)(UIView * view);
@end
#pragma mark - UIView 拖动
@interface UIView (Draggable)
/**
* Make view draggable.
*
* @param view Animator reference view, usually is super view.
* @param damping Value from 0.0 to 1.0. 0.0 is the least oscillation. default is 0.4.
*/
- (void)makeDraggableInView:(UIView *)view damping:(CGFloat)damping;
- (void)makeDraggable;
/**
* Disable view draggable.
*/
- (void)removeDraggable;
@end
|
kelvin943/ZQFoundation
|
ZQUIKit/Common/ZQToastUtil.h
|
//
// ZQToastUtil.h
// ZQFoundation
//
// Created by macro on 2019/9/26.
//
#import <Foundation/Foundation.h>
typedef enum : NSUInteger {
ToastUtilPositionCenter,
ToastUtilPositionBottom,
ToastUtilPositionTop,
} ToastUtilPosition;
@interface ZQToastUtil : NSObject
// 显示提示信息, s代表提示内容,view为要展示信息得view,一般为self.view
+ (void)showNotice:(NSString *)text;
+ (void)showNotice:(NSString *)text inView:(UIView *)view;
+ (void)showNotice:(NSString *)text inView:(UIView *)view duration:(NSTimeInterval)duration;
+ (void)showNotice:(NSString *)text inView:(UIView *)view duration:(NSTimeInterval)duration completion:(void(^)(void))completion;
+ (void)showNotice:(NSString *)aText inView:(UIView *)aView position:(ToastUtilPosition)aPosition space:(CGFloat)aSpace;
+ (void)hideNotice;
@end
|
kelvin943/ZQFoundation
|
ZQUIKit/ZQTableViewController/BaseTableViewController.h
|
<reponame>kelvin943/ZQFoundation
//
// BaseTableViewController.h
// MJRefresh
//
// Created by macro on 2019/9/6.
//
#import "BaseViewController.h"
#import "BaseTableViewAdaptor.h"
typedef void(^TableViewDidScrollAction)(UIScrollView* scrollView);
NS_ASSUME_NONNULL_BEGIN
@interface BaseTableViewController : BaseViewController<BaseTableViewAdaptorDelegate>
@property (nonatomic, strong) IBOutlet UITableView * tableView;
@property (nonatomic, strong) IBOutlet BaseTableViewAdaptor * tableViewAdaptor;
//tableView是否可以滑动
@property (nonatomic, assign) BOOL isCanScroll;
@property (nonatomic, copy) TableViewDidScrollAction scrollAction;
@end
@interface UITableView (registerExtern)
- (void)registerNibsWithReuseIds:(NSArray<NSString*> *)arr;
- (void)registerClassesWithReuseIds:(NSArray<NSString*> *)arr;
@end
NS_ASSUME_NONNULL_END
|
kelvin943/ZQFoundation
|
ZQCommon/Category/Other/NSArray+ZQAdd.h
|
<filename>ZQCommon/Category/Other/NSArray+ZQAdd.h
//
// NSArray+ZQAdd.h
// ZQFoundation
//
// Created by macro on 2019/9/11.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSArray (ZQPrint)
@end
@interface NSDictionary(ZQPrint)
@end
NS_ASSUME_NONNULL_END
|
kelvin943/ZQFoundation
|
ZQCommon/Category/Other/NSTimer+ZQBlock.h
|
//
// NSTimer+ZQBlock.h
// ZQDemoApp
//
// Created by macro on 2018/8/17.
// Copyright © 2018年 张泉. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSTimer (ZQBlock)
+ (NSTimer *)zq_scheduledTimerWithTimeInterval:(NSTimeInterval)interval
block:(void (^)(NSTimer * timer))block
repeats:(BOOL)repeats;
@end
NS_ASSUME_NONNULL_END
|
kelvin943/ZQFoundation
|
ZQUIKit/ZQBaseTabBarVC/BaseTabBarVC.h
|
//
// BaseTabBarVC.h
// ZQDemoApp
//
// Created by 张泉(macro) on 2019/9/24.
// Copyright © 2019 张泉. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UITabBar (Category)
@property (nonatomic, strong, readonly) NSMutableArray<UIView*> *imageViewArray;
@end
@interface UITabBar (Badge)
- (void)showBadgeOnItemIndex:(int)index; //显示小红点
- (void)hideBadgeOnItemIndex:(int)index; //隐藏小红点
@end
@interface BaseTabBarVC : UITabBarController
@end
|
kelvin943/ZQFoundation
|
ZQCommon/Category/Other/UIColor+ZQAdd.h
|
<filename>ZQCommon/Category/Other/UIColor+ZQAdd.h
//
// UIColor+ZQHex.h
// ZQFoundation
//
// Created by macro on 2019/9/10.
//
#import <UIKit/UIKit.h>
/*
hex
e.g: with alpha fully opaque: UIColorHex(0xFFFFFF)
or with alpha no fully : UIColorHex(0xFFFFFFFF)
*/
#define ZQColorHex(_hex_) [UIColor colorWithHex:_hex_]
/*
hex + alpha
e.g: with alpha no fully :UIColorWithHexAlpha(0xFFFFFF,0.1)
*/
#define ZQColorWithHexAlpha(_hex_,a) [UIColor colorWithHex:_hex_ alpha:a]
/*
randomColr
*/
#define ZQRandomColor [UIColor randomColor]
@interface UIColor (ZQHex)
+ (UIColor *)randomColor;
+ (UIColor *)colorWithHex:(NSUInteger)hex;
+ (UIColor *)colorWithHex:(NSUInteger)hex alpha:(CGFloat)alpha;
@end
|
kelvin943/ZQFoundation
|
ZQUIKit/ZQHoverViewController/HoverTableViewController.h
|
<filename>ZQUIKit/ZQHoverViewController/HoverTableViewController.h
//
// HoverTableViewController.h
// ZQFoundation
//
// Created by 张泉(Macro) on 2019/10/16.
//
#import "BaseViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface HoverTableView : UITableView
@end
@interface HoverTableViewController : BaseViewController
@property (nonatomic, assign) BOOL isCanScroll;
@property (nonatomic, strong) IBOutlet HoverTableView * tableView;
- (void)reloadPage;
@end
NS_ASSUME_NONNULL_END
|
Newton-Kim/mycurl
|
src/curl/mc-curl.h
|
<reponame>Newton-Kim/mycurl<gh_stars>0
#pragma once
#include "mc-types.h"
#include "mc-curl-header.h"
#include <map>
#include <string>
#include <iostream>
#include <curl/curl.h>
using namespace std;
class mcCurl {
private:
// map<string, curl_slist*> m_headers;
map<string, vector<string> > m_headers;
map<string, vector<string> > m_forms;
CURL* m_curl;
string m_url;
string m_mnymonic;
bool m_verbose;
bool m_follow;
void perform(void);
public:
mcCurl(string url, string mnymonic);
~mcCurl();
string mnymonic(void);
void verbose(bool onoff);
bool verbose(void);
void follow(bool onoff);
bool follow(void);
void get(string path);
void del(void);
void post(string inpath, bool chunk, string outpath);
void put(string inpath, bool chunk, string outpath);
mcCurlHeader* header(void);
mcCurlHeader* form(void);
};
|
Newton-Kim/mycurl
|
src/curl/mc-curl-file.h
|
<gh_stars>0
#pragma once
#include <cstdio>
class mcCurlFile {
private:
FILE* m_fd;
size_t m_chunk;
public:
mcCurlFile(const char* path, const char* mode, size_t chunk);
~mcCurlFile();
size_t fread(void* buffer, size_t size, size_t nmemb);
size_t fwrite(void* buffer, size_t size, size_t nmemb);
size_t fsize(void);
};
|
Newton-Kim/mycurl
|
src/performer/mc-curl-performer-context.h
|
<filename>src/performer/mc-curl-performer-context.h
#pragma once
#include "stackframe/mc-curl-stack-frame.h"
#include <vector>
using namespace std;
enum mcContextState {
MC_CURL_CONTEXT_ROOT = 0,
MC_CURL_CONTEXT_CONNECT
};
class mcICurlPerformerContext {
public:
virtual void set_context(mcContextState state,
vector<mcIStackFrame*>* stack = NULL) = 0;
};
|
Newton-Kim/mycurl
|
src/performer/stackframe/mc-curl-stack-frame.h
|
#pragma once
#include <string>
using namespace std;
class mcIStackFrame {
public:
virtual mcIStackFrame* open(string url, string alias) = 0;
virtual void verbose(bool onoff) = 0;
virtual bool verbose(void) = 0;
virtual void follow(bool onoff) = 0;
virtual bool follow(void) = 0;
virtual void list(ostream& stream) = 0;
virtual string mnymonic(void) = 0;
virtual void get(string path) = 0;
virtual void del(void) = 0;
virtual void post(string inpath, bool chunk, string outpath) = 0;
virtual void put(string inpath, bool chunk, string outpath) = 0;
virtual void add(string key, string value) = 0;
virtual void rm(string key) = 0;
};
|
Newton-Kim/mycurl
|
src/performer/mc-curl-performer-factory.h
|
<gh_stars>0
#pragma once
#include "mc-types.h"
class mcCurlPerformerFactory {
public:
static mcIPerformer* create(void);
};
|
Newton-Kim/mycurl
|
include/mc-scan.h
|
<reponame>Newton-Kim/mycurl<filename>include/mc-scan.h
#pragma once
#include <string>
using namespace std;
typedef enum {
//General commands
MC_TOKEN_NONE,
MC_TOKEN_LIST,
MC_TOKEN_RUN,
MC_TOKEN_OPEN,
MC_TOKEN_CLOSE,
MC_TOKEN_LEAVE,
MC_TOKEN_QUIT,
MC_TOKEN_HELP,
//CURL commands
MC_TOKEN_GET,
MC_TOKEN_PUT,
MC_TOKEN_POST,
MC_TOKEN_DELETE,
//CURL setting commands
MC_TOKEN_HEADER,
MC_TOKEN_VERBOSE,
MC_TOKEN_FOLLOW,
MC_TOKEN_FORM,
MC_TOKEN_ADD,
MC_TOKEN_RM,
//parsing tokens
MC_TOKEN_STRING,
MC_TOKEN_EXCLAMATION,
MC_TOKEN_HIPEN,
MC_TOKEN_PLUS,
MC_TOKEN_LT,
MC_TOKEN_GT,
MC_TOKEN_ON,
MC_TOKEN_OFF,
MC_TOKEN_EOL
} mcTokenID;
class mcToken {
public:
string buffer;
mcTokenID id;
mcToken(mcTokenID tid = MC_TOKEN_NONE, string str = "")
: id(tid), buffer(str) {}
mcToken(const mcToken& token) : id(token.id), buffer(token.buffer) {}
mcToken operator=(mcToken token) {
id = token.id;
buffer = token.buffer;
return *this;
}
};
class mcScanner {
private:
const char* m_line;
char* m_pos;
public:
mcScanner(const char* line);
mcToken tokenize(void);
mcToken scan(void);
};
|
Newton-Kim/mycurl
|
include/mc-cmd.h
|
#pragma once
#include "mc-scan.h"
#include "mc-types.h"
#include "mc-scan.h"
#include <string>
using namespace std;
class mcCommand {
public:
virtual string command(void) = 0;
virtual void help(void) = 0;
virtual mcLanguageState parse(mcScanner& scanner,
mcIPerformer* performer) = 0;
};
|
Newton-Kim/mycurl
|
src/curl/mc-curl-header.h
|
<filename>src/curl/mc-curl-header.h
#pragma once
#include <map>
#include <vector>
#include <string>
#include <iostream>
using namespace std;
class mcCurlHeader {
private:
map<string, vector<string> >& m_header;
public:
mcCurlHeader(map<string, vector<string> >& header);
void add(string key, string value);
void rm(string key);
void list(ostream& os);
};
|
Newton-Kim/mycurl
|
src/performer/stackframe/mc-curl-performer-connection.h
|
#pragma once
#include "mc-curl-stack-frame.h"
#include "mc-curl.h"
#include <iostream>
class mcCurlPerformerConnection : public mcIStackFrame {
private:
mcCurl* m_curl;
public:
mcCurlPerformerConnection(string url, string alias);
~mcCurlPerformerConnection();
mcIStackFrame* open(string url, string alias);
void verbose(bool onoff);
bool verbose(void);
void follow(bool onoff);
bool follow(void);
void list(ostream& stream);
string mnymonic(void);
void get(string path);
void del(void);
void post(string inpath, bool chunk, string outpath);
void put(string inpath, bool chunk, string outpath);
void add(string key, string value);
void rm(string key);
};
|
Newton-Kim/mycurl
|
src/performer/mc-curl-performer-state-root.h
|
#pragma once
#include "mc-types.h"
#include "mc-curl-performer-context.h"
#include "stackframe/mc-curl-stack-frame.h"
#include <vector>
#include <map>
using namespace std;
class mcCurlPerformerStateRoot : public mcIPerformer {
private:
mcICurlPerformerContext* m_context;
map<string, vector<mcIStackFrame*> > m_pool;
public:
mcCurlPerformerStateRoot(mcICurlPerformerContext* context);
~mcCurlPerformerStateRoot();
void set_context(mcContextState state);
void open(string url, string alias);
void close(void);
void verbose(bool& onoff);
void verbose_on(void);
void verbose_off(void);
void follow(bool& onoff);
void follow_on(void);
void follow_off(void);
void leave(void);
void list(void);
string mnymonic(void);
void get(string path);
void del(void);
void post(string inpath, bool chunk, string outpath);
void put(string inpath, bool chunk, string outpath);
bool follow(void);
void add(string key, string value);
void rm(string key);
};
|
Newton-Kim/mycurl
|
include/mc-types.h
|
<filename>include/mc-types.h
#pragma once
#include <string>
using namespace std;
typedef enum {
MC_LANG_END, //quit is called
MC_LANG_ERROR, //an error has happened
MC_LANG_CONTINUE, //continue to the next line
MC_LANG_HANG //end of the process but more input is expected
} mcLanguageState;
class mcIPerformer {
public:
virtual void open(string url, string alias) = 0;
virtual void close(void) = 0;
virtual void leave(void) = 0;
virtual void list(void) = 0;
virtual string mnymonic(void) = 0;
virtual void get(string path) = 0;
virtual void del(void) = 0;
virtual void post(string inpath, bool chunk, string outpath) = 0;
virtual void put(string inpath, bool chunk, string outpath) = 0;
virtual void verbose_on(void) = 0;
virtual void verbose_off(void) = 0;
virtual void verbose(bool& onoff) = 0;
virtual void follow_on(void) = 0;
virtual void follow_off(void) = 0;
virtual void follow(bool& onoff) = 0;
virtual void add(string key, string value) = 0;
virtual void rm(string key) = 0;
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generator_core/GridMask.h
|
<filename>Source/MultiDimensionMaze/maze_generator_core/GridMask.h
// maze algorithm from:
// https://github.com/sbj42/maze-generator
#pragma once
#include <vector>
#include "Position.h"
#include "CoreMinimal.h"
struct GridMaskOptions { bool interior; bool exterior; };
/**
*
*/
class MULTIDIMENSIONMAZE_API GridMask
{
public:
GridMask(int u_size, int v_size, int w_size, int depth, int height, int width, GridMaskOptions options);
~GridMask();
int u_size();
int v_size();
int w_size();
int depth();
int height();
int width();
bool get(Position pos);
void set(Position pos, bool value);
private:
int _u_size;
int _v_size;
int _w_size;
int _depth;
int _height;
int _width;
bool _interior;
bool _exterior;
// note the original grid array is replaced by a multi dimensional vector of bool objects
std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<bool>>>>>> bool_grid;
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generator_core/dirs.h
|
// maze algorithm from:
// https://github.com/sbj42/maze-generator
#pragma once
#include "CoreMinimal.h"
enum Direction { U_PLUS, U_MINUS, V_PLUS, V_MINUS, W_PLUS, W_MINUS, UP_ /* z increase */, DOWN_ /* z decrease */, SOUTH /* y increase */, NORTH /* y decrease */, EAST /* x increase */, WEST /* x decrease */, NONE, END };
static const char* DIRECTION_TEXT[] =
{ "U_PLUS", "U_MINUS", "V_PLUS", "V_MINUS", "W_PLUS", "W_MINUS", "UP_", "DOWN_", "SOUTH", "NORTH", "EAST", "WEST", "NONE", "END" };
static const int DIRECTION_COUNT = NONE;
/**
*
*/
class MULTIDIMENSIONMAZE_API dirs
{
public:
dirs();
~dirs();
static Direction opposite(Direction dir);
static int du(Direction dir);
static int dv(Direction dir);
static int dw(Direction dir);
static int dz(Direction dir);
static int dy(Direction dir);
static int dx(Direction dir);
static int bitmask(Direction dir);
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/MazeBuild.h
|
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Components/StaticMeshComponent.h"
#include "UObject/UObjectGlobals.h"
#include "maze_generator_core/dirs.h"
#include <vector>
#include <string>
#include <set>
#include "Kismet/GameplayStatics.h"
#include "GameFramework/Character.h"
#include "Components/PointLightComponent.h"
#include "maze_generators/BacktrackGenerator.h"
#include "maze_generator_core/Maze.h"
#include "Math/Color.h"
#include "Components/TextRenderComponent.h"
#include "Engine/TextRenderActor.h"
#include "Runtime/Engine/Classes/Kismet/GameplayStatics.h"
#include "Runtime/Engine/Classes/Kismet/KismetSystemLibrary.h"
#include "Particles/ParticleSystemComponent.h"
#include "Particles/ParticleSystem.h"
#include "MazeBuild.generated.h"
static const int MIN_DIMENSION_SIZE = 1; // minimum size of any dimension
static const int MAX_DIMENSION_SIZE = 8; // maximum size of any dimension
static constexpr double DEFAULT_SIZE = 100.0; // size of UE4 grid
static constexpr double TEXT_SCALE = 2.0;
static const FColor NO_COLOR = FColor::Black;
static const FColor U_COLOR = FColor::Red;
static const FColor V_COLOR = FColor::Green;
static const FColor W_COLOR = FColor::Blue;
static const FColor DIMENSION_TEXT_COLOR[12] = { U_COLOR, U_COLOR, V_COLOR, V_COLOR, W_COLOR, W_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR, NO_COLOR };
static const FText DIMENSION_PLUS = FText::FromString(TEXT("+"));
static const FText DIMENSION_MINUS = FText::FromString(TEXT("-"));
static const FText DIMENSION_TEXT[12] = { DIMENSION_PLUS, DIMENSION_MINUS, DIMENSION_PLUS, DIMENSION_MINUS, DIMENSION_PLUS, DIMENSION_MINUS, DIMENSION_PLUS, DIMENSION_MINUS, DIMENSION_PLUS, DIMENSION_MINUS, DIMENSION_PLUS, DIMENSION_MINUS };
static const char DIMENSION_INCDEC_CHAR[12] = { '+', '-', '+', '-', '+', '-', '+', '-', '+', '-', '+', '-' };
static const char DIMENSION_CHAR[12] = { 'U', 'U', 'V', 'V', 'W', 'W', 'Z', 'Z', 'Y', 'Y', 'X', 'X' };
static const double DIMENSION_TEXT_X = +0.5;
static const double DIMENSION_TEXT_Y = +0.5;//+0.75;//+0.9;
static const double DIMENSION_TEXT_Z = +0.5;//-0.35;
static const FVector DIMENSION_TEXT_DELTA(0.0, 0.15, -0.3);
static const double DIMENSION_TEXT_HORZ[12] = { -0.25, -0.25, 0, 0, 0.25, 0.25, 0, 0, 0, 0, 0, 0 };
static const double DIMENSION_TEXT_VERT[12] = { 0.1, -0.1, 0.1, -0.1, 0.1, -0.1, 0, 0, 0, 0, 0, 0 };
static const FRotator NO_ROTATOR = FRotator(0.0, 0.0, 0.0);
static const FRotator X_ROTATOR = FRotator(90.0, 0.0, 0.0);
static const FRotator Y_ROTATOR = FRotator(0.0, 90.0, 0.0);
static const FRotator Z_ROTATOR = FRotator(0.0, 0.0, 90.0);
static const int MIN_VIRTUAL_DIRECTION = U_PLUS;
static const int MAX_VIRTUAL_DIRECTION = W_MINUS;
static const int MIN_REAL_DIRECTION = UP_;
static const int MAX_REAL_DIRECTION = WEST;
static const int TEXTURE_COUNT = 5;
static const FRotator WALL_ROTATOR[DIRECTION_COUNT] = { NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, X_ROTATOR, X_ROTATOR, Y_ROTATOR, Y_ROTATOR, NO_ROTATOR, NO_ROTATOR };
static const std::set<Direction> wallDirs = { UP_, SOUTH, EAST };
UCLASS()
class MULTIDIMENSIONMAZE_API AMazeBuild : public AActor
{
GENERATED_BODY()
public:
UPROPERTY()
class UParticleSystem* FireworksParticleSystem;
UFUNCTION(BlueprintImplementableEvent, Category = "Output")
void playFireworksSound();
UFUNCTION(BlueprintImplementableEvent, Category = "Output")
void startShowWin();
UFUNCTION(BlueprintImplementableEvent, Category = "Output")
void endShowWin();
UFUNCTION(BlueprintImplementableEvent, Category = "Output")
void displayRandSeed(int randSeed);
UFUNCTION(BlueprintImplementableEvent, Category = "Output")
void displayDimensionTransition(float displayPercent);
static constexpr double CUBE_ACTUAL_SIZE = 80.0;
static constexpr double CUBE_SIZE = CUBE_ACTUAL_SIZE / DEFAULT_SIZE;
static constexpr double WALL_RATIO = 1.0 / 100.0;
static constexpr double WALL_ACTUAL_THICKNESS = CUBE_ACTUAL_SIZE * WALL_RATIO;
static constexpr double WALL_THICKNESS = WALL_ACTUAL_THICKNESS / DEFAULT_SIZE;
static constexpr double WALL_SIZE = CUBE_SIZE;
static constexpr double TERMINATION_DIAMETER = CUBE_SIZE / 8.0;
static constexpr double DIM_LETTER_SHORT = CUBE_SIZE / 24;
static constexpr double DIM_LETTER_LONG = 3 * DIM_LETTER_SHORT;
AMazeBuild();
void BeginPlay();
void NewMaze(int u_size, int v_size, int w_size, int depth, int height, int width);
void startMaze();
Position MoveDimension(Position pos, Direction dir);
void ChangeDirection(Direction dir);
Position locationToPosition(int u, int v, int w, FVector location);
FVector positionToLocation(Position pos, FVector delta);
FVector positionToLocation(Position pos);
Maze GetMaze();
void changeWall();
void playWin();
private:
void OuterWall(Position pos);
void InnerWall(Position pos);
void Termination(Position pos, bool isStart);
void RotateDimensionLetters(USceneComponent* letters, Direction dir);
UInstancedStaticMeshComponent* DimensionLetter(Position pos, Direction dir);
void DimensionText(Position pos);
void ProcessCell(Position pos);
void clearBuild();
void DisplayMaze();
void SetDimension(Position pos);
void TriggerFireworks();
UInstancedStaticMeshComponent* createWall(Direction dir, Position pos);
UInstancedStaticMeshComponent* createTermination(Direction dir, bool isStart);
static constexpr float FIREWORKS_DELTA_TIME = 0.5f;
static constexpr float FIREWORKS_DELTA_DELTA_END_LOCATION = 10.0f;
static const FVector DELTA_WALL[DIRECTION_COUNT];
static const FVector FIREWORKS_DELTA_END_LOCATION[9];
static const int WALL_TEXTURE_COUNT = WEST - UP_;
int selectU = 0;
int selectV = 0;
int selectW = 0;
UStaticMesh* WallMeshRef;
UStaticMesh* PlusMeshRef;
UStaticMesh* MinusMeshRef;
UStaticMesh* StartMeshRef;
UStaticMesh* EndMeshRef;
UMaterial* StartMaterial;
UMaterial* EndMaterial;
UMaterialInstanceDynamic* DynamicMaterial;
UMaterial* WallTestMaterial;
UMaterialInstanceDynamic* WallTest2Material;
UMaterial* WallParam;
int WallTextureIndex = 0;
UMaterialInstanceDynamic* WallMaterials[WALL_TEXTURE_COUNT];
UTexture2D* TextureColor[TEXTURE_COUNT];
UTexture2D* TextureNormal[TEXTURE_COUNT];
UMaterial* UDimensionMaterial;
UMaterial* VDimensionMaterial;
UMaterial* WDimensionMaterial;
BacktrackGenerator backtrackGenerator;
private:
FTimerHandle TriggerFireworkTimerHandle;
int fireworksCount;
std::vector<UMaterial*> DIMENSION_MATERIAL;
std::vector<UInstancedStaticMeshComponent*> DIM_LETTERS;
FRotator DIM_LETTER_ROTATORS[12] = { NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, NO_ROTATOR, X_ROTATOR, X_ROTATOR, Y_ROTATOR, Y_ROTATOR, NO_ROTATOR, NO_ROTATOR };
Maze _maze;
UInstancedStaticMeshComponent* startTermination;
UInstancedStaticMeshComponent* endTermination;
std::vector<std::vector<std::vector<std::vector<UInstancedStaticMeshComponent*>>>> walls; // z, y, x, dir
std::vector<std::vector<std::vector<USceneComponent*>>> dimensionLetters; // z, y, x -> for rotating letter sets
std::vector<std::vector<std::vector<std::vector<UInstancedStaticMeshComponent*>>>> dimensionLetter; // z, y, x, dir -> for showing/hiding letters
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/TouchBlueprintFunctionLibrary.h
|
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "maze_generator_core/Maze.h"
#include "MazeBuild.h"
#include "Components/CapsuleComponent.h"
#include "Engine/SkyLight.h"
#include "Components/SkyLightComponent.h"
#include "GameFramework/Character.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GeneralProjectSettings.h"
#include <cmath>
#include <math.h>
#include <set>
#include "TouchBlueprintFunctionLibrary.generated.h"
typedef void (*PlayerFunction) (bool isPress);
/**
*
*/
UCLASS()
class MULTIDIMENSIONMAZE_API UTouchBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasUp();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasDown();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasLeft();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasRight();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasForward();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasReverse();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasUPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasUMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasVPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasVMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasWPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool hasWMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool isUp();
UFUNCTION(BlueprintCallable, Category = "Dim")
static bool isDown();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void turnPlayerUp(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void turnPlayerDown(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void turnPlayerLeft(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void turnPlayerRight(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void goPlayerForward(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void turnPlayerReverse(bool isPress);
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickUPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickUMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickVPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickVMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickWPlus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static void clickWMinus();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionUDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionVDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionWDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionXDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionYDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getPlayerPositionZDisplay();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getHint();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FString getOrientation();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionU();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionV();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionW();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionX();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionY();
UFUNCTION(BlueprintCallable, Category = "Dim")
static int getPlayerPositionZ();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FVector getPlayerForward();
UFUNCTION(BlueprintCallable, Category = "Dim")
static FVector getPlayerPosition();
UFUNCTION(BlueprintCallable, Category = "Dim")
static float getPlayerRotationPitch();
UFUNCTION(BlueprintCallable, Category = "Dim")
static float getPlayerRotationYaw();
UFUNCTION(BlueprintCallable, Category = "Dim")
static float getPlayerRotationRoll();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getUSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getVSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getWSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getXSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getYSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getZSize();
UFUNCTION(BlueprintCallable, Category = "Settings")
static int getDimensionSize(int dimensionIndex);
UFUNCTION(BlueprintCallable, Category = "Settings")
static void updateSettings(int uSize, int vSize, int wSize, int xSize, int ySize, int zSize, int seed);
UFUNCTION(BlueprintCallable, Category = "Settings")
static void changeWall();
UFUNCTION(BlueprintCallable, Category = "Settings")
static void newMap(AMazeBuild* mazeBuild, APlayerController* playerController, ASkyLight* skyLight, float animationDuration);
UFUNCTION(BlueprintCallable, Category = "Settings")
static bool isWin();
UFUNCTION(BlueprintCallable, Category = "Settings")
static void MazeTick(float animationTime);
UFUNCTION(BlueprintCallable, Category = "Settings")
static FString getScore();
UFUNCTION(BlueprintCallable, Category = "State")
static void setTutorial(bool tutorial);
UFUNCTION(BlueprintCallable, Category = "State")
static bool isTutorial();
UFUNCTION(BlueprintCallable, Category = "State")
static void setDemo(bool demo);
UFUNCTION(BlueprintCallable, Category = "State")
static bool isDemo();
UFUNCTION(BlueprintCallable, Category = "State")
static void resetState();
UFUNCTION(BlueprintPure, Category = "Meta")
static FString getProjectVersion();
static void initMaze(int seed);
static void setPlayer(ACharacter* player);
static void startRotatePlayer(FRotator rotator);
static void finishRotatePlayer();
static void startPlayerForward(Position position);
static void finishPlayerForward();
static void startPlayerDimension(Direction direction);
static void switchPlayerDimension();
static Direction getPlayerForwardDirection();
static void ShowWin();
static void playWin();
static void FinishWin();
static void MovePlayerTo(Position pos);
static FVector PLAYER_UP;
static FVector PLAYER_FORWARD[];
static ACharacter* _player;
private:
const static int DEFAULT_DIMENSION_SIZE = 5;
constexpr static float DEFAULT_PLAYER_SPEED = 0.2;
constexpr static float DEFAULT_CELL_SIZE = 1.0;
const static int DEMO_U_DIMENSION = 1;
const static int DEMO_V_DIMENSION = 1;
const static int DEMO_W_DIMENSION = 2;
const static int DEMO_X_DIMENSION = 3;
const static int DEMO_Y_DIMENSION = 3;
const static int DEMO_Z_DIMENSION = 2;
const static int MAX_RAND_SEED = 1000000;
const static int RAND_SEED_COUNT = 1000;
static int RAND_SEEDS[RAND_SEED_COUNT];
static Position START;
static FRotator INIT_PLAYER_ROTATION;
static FVector INIT_PLAYER_FORWARD;
static FString MAIN_LEVEL_NAME;
static AMazeBuild* _mazeBuild;
static USkyLightComponent* _skyLightComponent;
static FRotator _playerRotator;
static FVector _playerForward;
static AController* _playerController;
static Position _playerPosition;
static int moveCount;
static FRotator oldRotation;
static FRotator newRotation;
static FVector oldPositionXYZ;
static FVector newPositionXYZ;
static Position newPosition;
static Direction dimensionTransitionDirection;
static bool isDimensionTransition;
static float _animationDuration;
constexpr static float WIN_DISPLAY_TIME = 6.0;
static int randSeedIndex;
static int _u_size;
static int _v_size;
static int _w_size;
static int _depth;
static int _height;
static int _width;
static int _save_u_size;
static int _save_v_size;
static int _save_w_size;
static int _save_depth;
static int _save_height;
static int _save_width;
static float _cellSize;
static bool _win_shown;
static bool _is_tutorial;
static bool _is_demo;
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generator_core/Maze.h
|
<reponame>sentamugo7/MultiDimensionalMaze
// maze algorithm from:
// https://github.com/sbj42/maze-generator
#pragma once
#include <vector>
#include "Cell.h"
#include "dirs.h"
#include "Position.h"
#include "CoreMinimal.h"
static const Position START(0, 0, 0, 0, 0, 0);
/**
*
*/
class MULTIDIMENSIONMAZE_API Maze
{
public:
Maze();
Maze(int u_size, int v_size, int w_size, int depth, int height, int width);
~Maze();
int getUSize();
int getVSize();
int getWSize();
int getDepth();
int getHeight();
int getWidth();
int getDimensionCount();
bool isPosInMaze(Position pos);
bool getPassage(Position pos, Direction dir);
void setPassage(Position pos, Direction dir, bool value);
Position getEnd();
Direction getHintAt(Position pos);
void solve();
int solutionCount();
int basisCount();
private:
int _u_size;
int _v_size;
int _w_size;
int _depth;
int _height;
int _width;
// note the original grid array is replaced by a multi dimensional vector of Cell objects
std::vector<std::vector<std::vector<std::vector<std::vector<std::vector<Cell>>>>>> cell_grid;
Cell* getCellAt(Position pos);
void solveAt(Position pos);
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generator_core/Position.h
|
<gh_stars>0
#pragma once
#include "dirs.h"
#include "CoreMinimal.h"
/**
*
*/
class MULTIDIMENSIONMAZE_API Position
{
public:
Position();
Position(int u, int v, int w, int z, int y, int x);
~Position();
int getU();
int getV();
int getW();
int getZ();
int getY();
int getX();
Position neighbor(Direction dir);
Position clone();
bool operator== (const Position& rhs) const {
return _u == rhs._u && _v == rhs._v && _w == rhs._w && _z == rhs._z && _y == rhs._y && _x == rhs._x;
}
private:
int _u;
int _v;
int _w;
int _z;
int _y;
int _x;
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generators/BacktrackGenerator.h
|
// maze algorithm from:
// https://github.com/sbj42/maze-generator
#pragma once
#include <vector>
#include <array>
#include "../maze_generator_core/dirs.h"
#include "../maze_generator_core/Position.h"
#include "../maze_generator_core/Maze.h"
#include "../maze_generator_core/GridMask.h"
#include <cmath>
#include "CoreMinimal.h"
struct MGOptions { };
/**
*
*/
class MULTIDIMENSIONMAZE_API BacktrackGenerator
{
public:
BacktrackGenerator();
~BacktrackGenerator();
void generate(Maze& maze);
int randomInt(MGOptions options, int max);
Direction randomChoice(MGOptions options, std::vector<Direction> array);
std::vector<Direction> getUnvisitedDirections(MGOptions options, GridMask visited, Position pos);
void backtrack(Maze& maze, MGOptions mgOptions);
private:
};
|
sentamugo7/MultiDimensionalMaze
|
Source/MultiDimensionMaze/maze_generator_core/Cell.h
|
<reponame>sentamugo7/MultiDimensionalMaze<filename>Source/MultiDimensionMaze/maze_generator_core/Cell.h
// maze algorithm from:
// https://github.com/sbj42/maze-generator
#pragma once
#include "dirs.h"
#include "CoreMinimal.h"
/**
*
*/
class MULTIDIMENSIONMAZE_API Cell
{
public:
Cell();
~Cell();
bool u_plus();
bool u_minus();
bool v_plus();
bool v_minus();
bool w_plus();
bool w_minus();
bool up_();
bool down_();
bool south();
bool north();
bool east();
bool west();
bool is_open(Direction dir);
void set_open(Direction dir, bool value);
Direction getSolution();
void setSolution(Direction solution);
private:
int _passages;
Direction _solution;
};
|
andrekandore/C-With-Classes
|
test-oo/main.c
|
//
// main.c
// test-oo
//
// Created by アンドレ on 2018/02/26.
// Copyright © 2018年 アンドレ. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "class.h"
void _class_open(void);
void _class_close(void);
typedef struct _classFunctions {
void (* const volatile open)(void);
void (* const volatile close)(void);
} ClassFunctions;
typedef struct _class_variables {
volatile char *name;
volatile u_int age;
} ClassVariables;
typedef struct _class_constants {
volatile const char *defaultName;
volatile const u_int defaultAge;
} ClassConstants;
const volatile ClassConstants __class_constants = {.defaultName = "Unkown",.defaultAge = 18};
typedef struct _class {
struct _class (* const volatile init)(struct _class);
const volatile ClassFunctions functions;
volatile ClassVariables variables;
const volatile ClassConstants constants;
} Class;
void _class_open() {
printf("%s \n",__PRETTY_FUNCTION__);
}
void _class_close() {
printf("%s \n",__PRETTY_FUNCTION__);
}
Class _class_init(Class aClass);
Class _class_init(Class aClass){
return aClass;
}
Class NewClass() {
Class aClass = {.init = _class_init,
.functions = (const volatile ClassFunctions){.open = _class_open,.close = _class_close},
.variables = {(volatile char *)__class_constants.defaultName,__class_constants.defaultAge},
.constants = __class_constants
};
return aClass;
}
Class *ClassByAllocation() {
Class aClass = NewClass();
Class *allocClass = (Class *)malloc(sizeof(Class));
memcpy(allocClass,&aClass,sizeof(Class));
return allocClass;
}
uint8_t fromStack(void *ptr) {
int dummy = 1;
return (ptr > (void *)&dummy ? 1 : 0);
}
int main(int argc, const char * argv[]) {
// insert code here...
printf("Hello, World!\n\n");
Class aClass = NewClass();
aClass.functions.open();
aClass.functions.close();
printf("'aClass Age' %d\n",aClass.variables.age);
printf("'aClass Name' %s\n",aClass.variables.name);
aClass.variables.age = 21;
aClass.variables.name = "Johnny";
printf("'aClass Age' %d\n",aClass.variables.age);
printf("'aClass Name' %s\n",aClass.variables.name);
printf("'aClass' On Stack? %d \n\n",fromStack(&aClass));
Class *heapClass = ClassByAllocation();
heapClass->functions.close();
heapClass->functions.open();
printf("'heapClass Age' %d\n",heapClass->variables.age);
printf("'heapClass Name' %s\n",heapClass->variables.name);
heapClass->variables.age = 21;
heapClass->variables.name = "Johnny";
printf("'heapClass Age' %d\n",heapClass->variables.age);
printf("'heapClass Name' %s\n",heapClass->variables.name);
printf("'heapClass' On Stack? %d \n\n",fromStack(heapClass));
free(heapClass);
return 0;
}
|
andrekandore/C-With-Classes
|
test-oo/class.h
|
<filename>test-oo/class.h
//
// class.h
// test-oo
//
// Created by アンドレ on 2018/02/26.
// Copyright © 2018年 アンドレ. All rights reserved.
//
#ifndef class_h
#define class_h
struct Class;
struct ClassFunctions;
#endif /* class_h */
|
RootCyberjet/Jacobi-s_Method
|
NRSM.c
|
/* ****************************************************************************
(MAIN PROGRAM FILE)
JACOBI METHOD TO FIND ALL EIGEN VALUES OF A REAL SYMMETRIC MATRIX
Author- <NAME>
Designation- M.Sc (Mathematics) Student at University of North Bengal
gmail- <EMAIL>
INDIA
***************************************************************************** */
#include<stdio.h>
#include<math.h>
#include"Function.h"
void main()
{
int i,j,k,n,p,q,M;
float a[10][10],b[10][10],r[10][10],A,B,C,S,big,t;
printline(60);
printf("Enter The order of the non-singular symmetric matrix : ");
scanf("%d",&n);
printline(60);
read(a,n);
printline(60);
printf("The given non-singular symmetric matrix is :\n");
write(a,n);
printline(60);
printf("Enter the number of iteration : ");
scanf("%d",&M);
for(k=1;k<=M;k++)
{
big=0;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(i<j)
{
if(fabs(a[i][j])>big)
{
big=fabs(a[i][j]);
p=i;
q=j;
}
}
}
}
if(a[p][p]<a[q][q])
{
t=-1;
}
else
{
t=1;
}
A=2*a[p][q]*t;
B=fabs(a[p][p]-a[q][q]);
C=pow(0.5*(1+(B/pow(A*A+B*B,0.5))),0.5);
S=A/(2*C*pow(A*A+B*B,0.5));
cons(C,S,n,p,q,b);
STAS(b,a,n,r);
fun(r,b,n,a);
}
printline(60);
printf("The required eigen values are :\n");
for(i=1;i<=n;i++)
{
printf("a%d%d = %f.\n",i,i,a[i][i]);
}
printline(60);
}
|
RootCyberjet/Jacobi-s_Method
|
Function.h
|
/* ****************************************************************************
(FUNCTION HEADER FILE)
JACOBI METHOD TO FIND ALL EIGEN VALUES OF A REAL SYMMETRIC MATRIX
Author- <NAME>
Designation- M.Sc (Mathematics) Student at University of North Bengal
gmail- <EMAIL>
INDIA
***************************************************************************** */
void printline(int k) //Function to print a mergin line
{
int i;
for(i=1;i<=k;i++)
{
printf("_");
}
printf("\n");
}
float read(float x[][10],int a) //Function to read an square matrix of order 'a'
{
int i,j;
printf("Enter %d entries = ",a*a);
for(i=1;i<=a;i++)
{
for(j=1;j<=a;j++)
{
scanf("%f",&x[i][j]);
}
}
}
float write(float x[][10],int a) //Function to print an square matrix of order 'a'
{
int i,j;
for(i=1;i<=a;i++)
{
for(j=1;j<=a;j++)
{
printf("%f\t",x[i][j]);
}
printf("\n");
}
}
float trans(float a[][10],int n,float b[][10]) //Function to transpose an square matrix of order 'n'
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
b[i][j]=a[j][i];
}
}
}
float mul(float x[][10],float y[][10],int n,float s[][10]) //Function for square matrix (of order 'n') multiplication
{
int i,j,k;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
s[i][j]=0;
for(k=1;k<=n;k++)
{
s[i][j]=s[i][j]+x[i][k]*y[k][j];
}
}
}
}
float cons(float C,float S,int n,int l,int k,float a[][10]) //Function to construct an orthogonal symmetric matrix followed from Jacobi Method's algorithm
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
if(i==j)
{
a[i][j]=1;
}
if(i!=j)
{
a[i][j]=0;
}
}
}
a[l][l]=C;
a[l][k]=-S;
a[k][l]=S;
a[k][k]=C;
}
float STAS(float x[][10],float y[][10],int n,float r[][10]) //Function to compute matrix multiplication of type (S'A S), where S' means transpose of S
{
float x1[10][10],r1[10][10];
trans(x,n,x1);
mul(x1,y,n,r1);
mul(r1,x,n,r);
}
float fun(float r[][10],float b[][10],int n,float a[][10]) //Function to clear values of all unnecessary arrays to make computation procedure smooth
{
int i,j;
for(i=1;i<=n;i++)
{
for(j=1;j<=n;j++)
{
a[i][j]=r[i][j];
r[i][j]=0;
b[i][j]=0;
}
}
}
|
mt-caret/io_uring
|
src/io_uring_stubs.c
|
<gh_stars>1-10
#include "io_uring_stubs.h"
#include <fcntl.h>
CAMLprim value io_uring_sizeof_io_uring_cqe(value __unused v_unit)
{
return Val_int(sizeof(struct io_uring_cqe));
}
CAMLprim value io_uring_offsetof_user_data(value __unused v_unit)
{
return Val_int(offsetof(struct io_uring_cqe, user_data));
}
CAMLprim value io_uring_offsetof_res(value __unused v_unit)
{
return Val_int(offsetof(struct io_uring_cqe, res));
}
CAMLprim value io_uring_offsetof_flags(value __unused v_unit)
{
return Val_int(offsetof(struct io_uring_cqe, flags));
}
CAMLprim value io_uring_queue_init_stub(value v_submission_entries, value v_completion_entries)
{
struct io_uring_params p;
CAMLparam2(v_submission_entries, v_completion_entries);
CAMLlocal1(v_io_uring);
memset(&p, 0, sizeof(p));
p.flags = IORING_SETUP_CQSIZE | IORING_FEAT_RW_CUR_POS;
p.cq_entries = Int_val(v_completion_entries);
struct io_uring *io_uring = caml_stat_alloc(sizeof(struct io_uring));
v_io_uring = caml_alloc_small(1, Abstract_tag);
// TOIMPL : make it possible to set IORING_SETUP_IOPOLL and IORING_SETUP_SQPOLL here.
int retcode = io_uring_queue_init(Int_val(v_submission_entries), io_uring, 0);
if (retcode < 0) {
uerror("io_uring_queue_init", Nothing);
}
Io_uring_val(v_io_uring) = io_uring;
CAMLreturn(v_io_uring);
}
CAMLprim value io_uring_queue_exit_stub(value v_io_uring)
{
CAMLparam1(v_io_uring);
io_uring_queue_exit(Io_uring_val(v_io_uring));
caml_stat_free(Io_uring_val(v_io_uring));
CAMLreturn(Val_unit);
}
CAMLprim value io_uring_prep_nop_stub(value v_io_uring, value v_sqe_flags, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
}
io_uring_prep_nop(sqe);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
CAMLprim value io_uring_prep_open_stub(value v_io_uring, value v_sqe_flags, value v_path, value v_flags, value v_mode, value v_bstr, value v_bstr_pos, value v_bstr_len, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
}
if (Long_val(v_bstr_len) < sizeof(struct open_how)) {
uerror("bstr memory", Nothing);
}
struct open_how* flags = (struct open_how*) get_bstr(v_bstr, v_bstr_pos);
flags->flags = Long_val(v_flags);
flags->mode = Long_val(v_mode);
debug("open parameters: %li %li\n", flags->flags, flags->mode);
io_uring_prep_openat2(sqe, AT_FDCWD, String_val(v_path), flags);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
CAMLprim value io_uring_prep_open_bytecode_stub(value *argv, int argn)
{
return io_uring_prep_open_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8]);
}
CAMLprim value io_uring_prep_write_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_pos, value v_len, value v_bstr, value v_offset, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
}
io_uring_prep_write(sqe,
(int) Long_val(v_fd),
get_bstr(v_bstr, v_pos),
(unsigned) Long_val(v_len),
(off_t) Long_val(v_offset));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
CAMLprim value io_uring_prep_write_bytecode_stub(value *argv, int argn)
{
return io_uring_prep_write_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
}
CAMLprim value io_uring_prep_read_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_pos, value v_len, value v_bstr, value v_offset, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
}
io_uring_prep_read(sqe,
(int) Long_val(v_fd),
get_bstr(v_bstr, v_pos),
(unsigned) Long_val(v_len),
(off_t) Long_val(v_offset));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
CAMLprim value io_uring_prep_read_bytecode_stub(value *argv, int argn)
{
return io_uring_prep_read_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6], argv[7]);
}
typedef enum {
IOVECS,
SOCKADDR,
MSGHDR
} tag_type;
struct queued_sockaddr {
union sock_addr_union addr;
socklen_t addr_len;
bool completed;
int retcode;
};
struct tagged_immediate {
tag_type tag_type;
union {
struct iovec *iovecs;
struct queued_sockaddr *sockaddr;
struct msghdr *msghdr;
};
value immediate;
};
// TODO: we should CAMLparam here
CAMLprim value io_uring_prep_writev_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_iovecs, value v_count, value v_offset, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
} else {
int count = Int_val(v_count);
size_t total_len = 0;
assert(Is_long(v_user_data));
struct tagged_immediate* user_data =
caml_stat_alloc(sizeof(struct tagged_immediate));
assert(Is_block((uintptr_t)user_data));
user_data->tag_type = IOVECS;
user_data->iovecs = copy_iovecs(&total_len, v_iovecs, count);
user_data->immediate = v_user_data;
io_uring_prep_writev(sqe,
(int) Long_val(v_fd),
user_data->iovecs,
count,
(off_t) Long_val(v_offset));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *) user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_writev_bytecode_stub(value *argv, int argn) {
return io_uring_prep_writev_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
}
CAMLprim value io_uring_prep_readv_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_iovecs, value v_count, value v_offset, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
} else {
int count = Int_val(v_count);
size_t total_len = 0;
assert(Is_long(v_user_data));
struct tagged_immediate* user_data =
caml_stat_alloc(sizeof(struct tagged_immediate));
assert(Is_block((uintptr_t)user_data));
user_data->tag_type = IOVECS;
user_data->iovecs = copy_iovecs(&total_len, v_iovecs, count);
user_data->immediate = v_user_data;
io_uring_prep_readv(sqe,
(int) Long_val(v_fd),
user_data->iovecs,
count,
(off_t) Long_val(v_offset));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *) user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_readv_bytecode_stub(value *argv, int argn) {
return io_uring_prep_readv_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
}
CAMLprim value io_uring_prep_send_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_pos, value v_len, value v_bstr, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
debug("io_uring_prep_send_stub");
if (sqe == NULL) {
return Val_bool(true);
} else {
// TODO: possibly pass some flags to send()?
io_uring_prep_send(sqe,
(int) Long_val(v_fd),
get_bstr(v_bstr, v_pos),
(unsigned) Long_val(v_len),
0);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_send_bytecode_stub(value *argv, int argn) {
return io_uring_prep_send_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
}
CAMLprim value io_uring_prep_recv_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_pos, value v_len, value v_bstr, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
debug("io_uring_prep_recv_stub\n");
if (!sqe) {
return Val_bool(true);
}
// TODO: possibly pass some flags to recv()?
io_uring_prep_recv(sqe,
(int) Long_val(v_fd),
get_bstr(v_bstr, v_pos),
(unsigned) Long_val(v_len),
0);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
CAMLprim value io_uring_prep_recv_bytecode_stub(value *argv, int argn) {
return io_uring_prep_recv_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]);
}
CAMLprim value io_uring_prep_sendmsg_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_iovecs, value v_count, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
debug("io_uring_prep_sendmsg_stub");
if (sqe == NULL) {
return Val_bool(true);
} else {
int count = Int_val(v_count);
size_t total_len = 0;
struct msghdr *msghdr = caml_stat_alloc(sizeof(struct msghdr));
msghdr->msg_name = (void *) NULL;
msghdr->msg_namelen = 0;
msghdr->msg_iov = copy_iovecs(&total_len, v_iovecs, count);
msghdr->msg_iovlen = count;
msghdr->msg_control = (void *) NULL;
msghdr->msg_controllen = 0;
msghdr->msg_flags = 0;
assert(Is_long(v_user_data));
struct tagged_immediate* user_data =
caml_stat_alloc(sizeof(struct tagged_immediate));
assert(Is_block((uintptr_t)user_data));
user_data->tag_type = MSGHDR;
user_data->msghdr = msghdr;
user_data->immediate = v_user_data;
// TODO: possibly pass some flags to send()?
io_uring_prep_sendmsg(sqe,
(int) Long_val(v_fd),
msghdr,
0);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *) user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_sendmsg_bytecode_stub(value *argv, int argn) {
return io_uring_prep_sendmsg_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}
CAMLprim value io_uring_prep_recvmsg_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_iovecs, value v_count, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
debug("io_uring_prep_recvmsg_stub\n");
if (sqe == NULL) {
return Val_bool(true);
} else {
int count = Int_val(v_count);
size_t total_len = 0;
struct msghdr *msghdr = caml_stat_alloc(sizeof(struct msghdr));
msghdr->msg_name = (void *) NULL;
msghdr->msg_namelen = 0;
msghdr->msg_iov = copy_iovecs(&total_len, v_iovecs, count);
msghdr->msg_iovlen = count;
msghdr->msg_control = (void *) NULL;
msghdr->msg_controllen = 0;
msghdr->msg_flags = 0;
assert(Is_long(v_user_data));
struct tagged_immediate* user_data =
caml_stat_alloc(sizeof(struct tagged_immediate));
assert(Is_block((uintptr_t)user_data));
user_data->tag_type = MSGHDR;
user_data->msghdr = msghdr;
user_data->immediate = v_user_data;
// TODO: possibly pass some flags to recv()?
io_uring_prep_recvmsg(sqe,
(int) Long_val(v_fd),
msghdr,
0);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *) user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_recvmsg_bytecode_stub(value *argv, int argn) {
return io_uring_prep_recvmsg_stub(argv[0], argv[1], argv[2], argv[3], argv[4], argv[5]);
}
CAMLprim value io_uring_prep_close_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_user_data) {
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
} else {
io_uring_prep_close(sqe, (int) Long_val(v_fd));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
}
#define Queued_sockaddr_val(v) *((struct tagged_immediate **) Data_abstract_val(v))
CAMLprim value io_uring_prep_accept_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_user_data)
{
CAMLparam2(v_io_uring, v_user_data);
CAMLlocal1(v);
// debug: puts("io_uring_prep_accept_stub");
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
CAMLreturn(Val_none);
} else {
struct queued_sockaddr* p = caml_stat_alloc(sizeof(struct queued_sockaddr));
assert (Is_block((uintptr_t) p));
p->addr_len = sizeof(union sock_addr_union);
p->completed = false;
assert(Is_long(v_user_data));
struct tagged_immediate* user_data =
caml_stat_alloc(sizeof(struct tagged_immediate));
assert(Is_block((uintptr_t)user_data));
user_data->tag_type = SOCKADDR;
user_data->sockaddr = p;
user_data->immediate = v_user_data;
// TODO: support accept4() flags?
io_uring_prep_accept(sqe, (int) Long_val(v_fd), &(p->addr.s_gen), &(p->addr_len), 0);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
io_uring_sqe_set_data(sqe, (void *) user_data);
v = caml_alloc(1, Abstract_tag);
Queued_sockaddr_val(v) = user_data;
CAMLreturn(Val_some(v));
}
}
CAMLprim value io_uring_get_sockaddr(value v_queued_sockaddr) {
CAMLparam1(v_queued_sockaddr);
CAMLlocal1(sockaddr);
debug("io_uring_get_sockaddr\n");
struct tagged_immediate *p = Queued_sockaddr_val(v_queued_sockaddr);
assert(p->tag_type == SOCKADDR);
struct queued_sockaddr *q = p->sockaddr;
if (q->completed) {
CAMLreturn(Val_some(alloc_sockaddr(&(q->addr), q->addr_len, q->retcode)));
} else {
CAMLreturn(Val_none);
}
}
CAMLprim value io_uring_free_sockaddr(value v_queued_sockaddr) {
debug("io_uring_free_sockaddr\n");
struct tagged_immediate *p = Queued_sockaddr_val(v_queued_sockaddr);
assert(p->tag_type == SOCKADDR);
caml_stat_free(p->sockaddr);
p->sockaddr = NULL;
caml_stat_free(p);
}
CAMLprim value io_uring_prep_poll_add_stub(value v_io_uring, value v_sqe_flags, value v_fd, value v_flags, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
if (sqe == NULL) {
return Val_bool(true);
} else {
io_uring_prep_poll_add(sqe,
(int) Long_val(v_fd),
(short) Int63_val(v_flags));
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
debug("user_data: %d\n", v_user_data);
io_uring_sqe_set_data(sqe, (void *)(uintptr_t) v_user_data);
return Val_bool(false);
}
}
CAMLprim value io_uring_prep_poll_add_bytecode_stub(value *argv, int argn){
return io_uring_prep_poll_add_stub(argv[0], argv[1], argv[2], argv[3], argv[4]);
}
CAMLprim value io_uring_prep_poll_remove_stub(value v_io_uring, value v_sqe_flags, value v_user_data)
{
struct io_uring_sqe *sqe = io_uring_get_sqe(Io_uring_val(v_io_uring));
debug("entered io_uring_prep_poll_remove\n");
if (sqe) {
// debug: printf("poll_remove: tag: %llx, %llx\n", v_a, User_data_val(v_a));
io_uring_prep_poll_remove((struct io_uring_sqe *) Data_abstract_val(sqe),
(void *)(uintptr_t) v_user_data);
io_uring_sqe_set_flags(sqe, Int63_val(v_sqe_flags));
io_uring_sqe_set_data(sqe, NULL);
return Val_bool(false);
} else {
debug("returning none\n");
return Val_bool(true);
}
}
CAMLprim value io_uring_submit_stub(value v_io_uring)
{
int retcode = io_uring_submit(Io_uring_val(v_io_uring));
if (retcode < 0) {
uerror("io_uring_submit", Nothing);
}
return Val_int(retcode);
}
#define NSECS_IN_SEC 1000000000LL
// TODO: possibly release runtime lock for longer periods of time?
CAMLprim value io_uring_wait_stub(value v_io_uring, value v_array, value v_timeout) {
CAMLparam3(v_io_uring, v_array, v_timeout);
int retcode;
struct io_uring_cqe *cqe;
long long timeout = Long_val(v_timeout);
struct io_uring *io_uring = Io_uring_val(v_io_uring);
/*
* timeout, in nanoseconds returns immediately if 0 is given, waits
* forever with -1 (similar to epoll_wait()).
*/
if (timeout == 0) {
/* returns immediately, skip enter()/leave() pair */
retcode = io_uring_peek_cqe(io_uring, &cqe);
// TOIMPL: not sure why we get ETIMEs here
if (retcode != -EAGAIN && retcode != -ETIME && retcode < 0) {
printf("error %d (%s)\n", -retcode, strerror(-retcode));
printf("cqe ptr: %lu\n", (uint64_t) cqe);
uerror("io_uring_peek_cqe (if branch)", Nothing);
}
} else if (timeout < 0) {
caml_enter_blocking_section();
retcode = io_uring_wait_cqe_nr(io_uring, &cqe, -timeout);
caml_leave_blocking_section();
if (retcode < 0) uerror("io_uring_wait_cqe", Nothing);
} else {
struct __kernel_timespec ts = {
.tv_sec = timeout / NSECS_IN_SEC,
.tv_nsec = timeout % NSECS_IN_SEC
};
caml_enter_blocking_section();
retcode = io_uring_wait_cqe_timeout(io_uring, &cqe, &ts);
caml_leave_blocking_section();
if (retcode != -ETIME && retcode < 0) {
printf("error %d (%s)\n", -retcode, strerror(-retcode));
printf("cqe ptr: %lu\n", (uint64_t) cqe);
uerror("io_uring_wait_cqe_timeout", Nothing);
}
}
struct io_uring_cqe *buffer = (struct io_uring_cqe *) Caml_ba_data_val(v_array);
int num_seen = 0;
int max_cqes = Caml_ba_array_val(v_array)->dim[0] / sizeof(struct io_uring_cqe);
while (cqe != NULL && num_seen < max_cqes && retcode != -EAGAIN && retcode != -ETIME) {
memcpy(buffer, cqe, sizeof(struct io_uring_cqe));
debug("io_uring_wait: in loop\n");
io_uring_cqe_seen(Io_uring_val(v_io_uring), cqe);
retcode = io_uring_peek_cqe(Io_uring_val(v_io_uring), &cqe);
if (retcode != -EAGAIN && retcode != -ETIME && retcode < 0) {
printf("error %d (%s)\n", -retcode, strerror(-retcode));
printf("cqe ptr: %lu\n", (uint64_t) cqe);
uerror("io_uring_peek_cqe (loop)", Nothing);
}
// skip results from io_uring_prep_poll_remove
if ((void *) buffer->user_data != NULL) {
// debug: printf("handling user_data: %lld\n", buffer->user_data);
if (Is_block(buffer->user_data)) {
struct tagged_immediate *p = (struct tagged_immediate *) buffer->user_data;
buffer->user_data = p->immediate;
assert(Is_long(buffer->user_data));
switch (p->tag_type) {
case IOVECS:
caml_stat_free(p->iovecs);
caml_stat_free(p);
break;
case SOCKADDR:
// debug: puts("found sockaddr!");
p->sockaddr->completed = true;
p->sockaddr->retcode = retcode;
// debug: puts("finished handling sockaddr");
break;
case MSGHDR:
caml_stat_free(p->msghdr->msg_iov);
caml_stat_free(p->msghdr);
break;
default:
assert(false);
}
}
num_seen++;
buffer++;
}
}
debug("out of loop\n");
CAMLreturn(Val_int(num_seen));
}
CAMLprim value io_uring_get_user_data(value v_array, value v_index) {
debug("io_uring_get_user_data\n");
value user_data = ((struct io_uring_cqe *) Caml_ba_data_val(v_array) + Int_val(v_index))->user_data;
return
Is_block(user_data) ?
((struct tagged_immediate *) user_data)->immediate :
user_data;
}
|
mt-caret/io_uring
|
src/io_uring_stubs.h
|
#include "config.h"
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <poll.h>
#ifndef ENOATTR
# define ENOATTR ENODATA
#endif
#include <arpa/inet.h>
#include <assert.h>
#include <sys/un.h>
// TOIMPL: move this to jst-config?
#include <liburing.h>
#include "ocaml_utils.h"
#include "unix_utils.h"
#include "socketaddr.h"
/* Bytes_val is only available from 4.06 */
#ifndef Bytes_val
#define Bytes_val String_val
#endif
#ifndef Val_some
static value Val_some(value mlvalue) {
CAMLparam1(mlvalue);
CAMLlocal1(aout);
aout = caml_alloc(1, 0);
Store_field(aout, 0, mlvalue);
CAMLreturn(aout);
}
#endif
#ifndef Val_none
#define Val_none Val_int(0)
#endif
#ifndef Some_val
#define Some_val(v) Field(v, 0)
#endif
#ifdef DEBUG
#define debug(fmt, ...) \
do { fprintf(stderr, fmt, __VA_ARGS__); } while (0)
#else
#define debug(fmt, ...) \
do {} while (0)
#endif
/** Core io_uring methods **/
#define POLL_FLAG(FLAG) DEFINE_INT63_CONSTANT (poll_##FLAG##_flag, FLAG)
POLL_FLAG(POLLIN)
POLL_FLAG(POLLOUT)
POLL_FLAG(POLLPRI)
POLL_FLAG(POLLERR)
POLL_FLAG(POLLHUP)
#define SQE_FLAG(FLAG) DEFINE_INT63_CONSTANT (sqe_##FLAG##_flag, FLAG)
SQE_FLAG(IOSQE_FIXED_FILE)
SQE_FLAG(IOSQE_IO_DRAIN)
SQE_FLAG(IOSQE_IO_LINK)
SQE_FLAG(IOSQE_IO_HARDLINK)
SQE_FLAG(IOSQE_ASYNC)
SQE_FLAG(IOSQE_BUFFER_SELECT)
#define Io_uring_val(v) (*((struct io_uring **) Data_abstract_val(v)))
#define Io_uring_cqe_val(v) ((struct io_uring_cqe *) Data_abstract_val(v))
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/BridgeInterface/Thread.h
|
#pragma once
class __declspec(dllexport) Thread {
private:
HANDLE thread_handle;
unsigned int thread_id;
public:
Thread();
virtual ~Thread();
void Start();
void Join();
bool Join(int milliseconds);
void Suspend();
void Resume();
// void Interrupt();
static void Sleep(int milliseconds);
void Dispose();
virtual void Run() = 0;
};
class __declspec(dllexport) CriticalSection {
CRITICAL_SECTION critical_section;
public:
CriticalSection();
virtual ~CriticalSection();
void Lock();
void Unlock();
};
class __declspec(dllexport) Mutex {
friend class ConditionVariable;
HANDLE mutex_handle;
public:
Mutex();
virtual ~Mutex();
void Lock();
void Unlock();
};
class __declspec(dllexport) Semaphore {
friend class ConditionVariable;
HANDLE semaphore_handle;
public:
Semaphore();
~Semaphore();
int Release(int count);
};
class __declspec(dllexport) Event {
friend class ConditionVariable;
HANDLE event_handle;
public:
Event();
~Event();
void Wait();
};
class __declspec(dllexport) ConditionVariable {
// Number of waiting threads
int waiters_count;
// Lock access to waiters_count
CriticalSection waiters_count_lock;
// Semaphore used to queue up threads waiting for the condition to
// become signaled.
Semaphore semaphore;
// An auto-reset event used by the broadcast/signal thread to wait
// for all the waiting thread(s) to wake up and be released from the
// semaphore.
Event waiters_done;
// Keeps track of whether we were broadcasting or signaling. This
// allows us to optimize the code if we're just signaling.
bool was_broadcast;
// The external mutex that should be held before calls to
// Wait, Pulse, or PulseAll
Mutex *mutex;
public:
ConditionVariable(Mutex *m);
void Wait();
void Pulse();
void PulseAll();
};
class __declspec(dllexport) Monitor {
Mutex mutex;
ConditionVariable condition_variable;
public:
Monitor();
void Enter();
void Exit();
void Wait();
void Pulse();
void PulseAll();
};
class __declspec(dllexport) ReaderWriterLock {
int readers;
int writers;
int writers_pending;
Monitor monitor;
public:
ReaderWriterLock();
void AcquireReaderLock();
void ReleaseReaderLock();
void AcquireWriterLock();
void ReleaseWriterLock();
};
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/exporter/include/OgreMayaExporter.h
|
<filename>tools/MayaExport/exporter/include/OgreMayaExporter.h
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYAEXPORTER_H_
#define _OGREMAYAEXPORTER_H_
#include <maya/MPxCommand.h>
#include <maya/MStatus.h>
#include <maya/MArgList.h>
#include <maya/MSyntax.h>
#include <string>
#include <map>
using namespace std;
class OgreMayaExporter : public MPxCommand {
public:
// Maya API functions.
static void *creator( void );
virtual MStatus doIt( const MArgList &args );
static MSyntax exporterSyntax(void);
};
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/shared/include/OgreMayaSkeleton.h
|
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_SKELETON_H_
#define _OGREMAYA_SKELETON_H_
#include "OgreMayaCommon.h"
#include <maya/MGlobal.h>
#include <maya/MDagPath.h>
#include <maya/MFloatArray.h>
#include <maya/MPointArray.h>
#include <maya/MFloatVectorArray.h>
#include <maya/MColorArray.h>
#include <maya/MObjectArray.h>
#include <maya/MFnMesh.h>
#include <maya/MStatus.h>
#include <maya/MItMeshPolygon.h>
#include <maya/MMatrix.h>
#include <maya/MQuaternion.h>
#include <maya/MFnTransform.h>
#include <maya/MVector.h>
#include <fstream>
#include <string>
#include <list>
#include <vector>
#include <map>
namespace OgreMaya {
// using namespace std;
using std::list;
using std::vector;
using std::map;
using std::string;
// Debug methods
void printMQuaternion(MQuaternion const& q);
void printMVector(MVector const& v);
void printMMatrix(MMatrix const& m);
struct Keyframe {
Keyframe(Real time, MVector pos, MQuaternion rot):
time(time), pos(pos), rot(rot) {}
Real time; // in s
MVector pos;
MQuaternion rot;
};
typedef list<Keyframe> KeyframeList;
typedef map<string, KeyframeList> KeyframesMap;
struct Animation {
Animation(): time(0) {}
float time;
KeyframesMap keyframes; // bonename -> keyframelist
};
typedef map<string, Animation> AnimationMap;
// ===========================================================================
/** \struct SkeletonJoint
stores joint data
*/
// ===========================================================================
struct SkeletonJoint {
MDagPath dagPath;
int logical_index;
int bone_index;
std::string name;
std::string parentName;
bool hasParent;
// This is a bit of a misnomer, since it is really
// based on the bind matrix, rather than a true world
// transform matrix.
// Tranform relative to the world - unscaled
MMatrix worldMatrix;
MMatrix invWorldMatrix;
// Transform relative to parent - unscaled
MMatrix localMatrix;
MMatrix invLocalMatrix;
SkeletonJoint* parent;
// Translation relative to parent object - in scaled space.
MVector relPos;
MQuaternion relRot;
};
typedef vector<SkeletonJoint*> SkeletonJointList;
struct IndexLess : std::binary_function<SkeletonJoint *, SkeletonJoint *, bool> {
bool operator()(const SkeletonJoint *psj1, const SkeletonJoint *psj2) const
{
return psj1->bone_index < psj2->bone_index;
}
};
// ===========================================================================
/** \class SkeletonGenerator
\author Ivica "macross" Aracic, Bytelords
\version 1.0
\date August 2003
Generates an Ogre skeleton from a Maya scene.
*/
// ===========================================================================
class SkeletonGenerator {
public:
/// Standard constructor.
SkeletonGenerator();
/// Destructor.
virtual ~SkeletonGenerator();
/// Export the complete Maya scene (called by OgreMaya.mll or OgreMaya.exe).
virtual bool exportAll();
/// Export selected parts of the Maya scene (called by OgreMaya.mll).
virtual bool exportSelection();
int getJointCount() {
return jointList.size();
}
protected:
bool _querySkeleton();
bool _querySkeletonAnim();
bool _exportSkeleton();
bool _exportAnimations();
bool _exportAnimations(std::ostream &out);
bool _queryJoint(SkeletonJoint *pkJoint, MDagPath &kDagPath);
SkeletonJoint* _getSkeletonJoint(int boneId) const;
SkeletonJoint* _getSkeletonJoint(const std::string &jointName) const;
SkeletonJoint* _getSkeletonJoint(const MDagPath &dagPath) const;
static MMatrix SkeletonGenerator::_getTransformTree(const SkeletonJoint *j) {
if (j->hasParent)
return j->localMatrix * _getTransformTree(j->parent);
return j->localMatrix;
}
protected:
SkeletonJointList jointList;
SkeletonJoint* root;
AnimationMap animations;
MDagPath rootDagPath;
};
} // namespace OgreMaya
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/SessionState.h
|
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __SESSIONSTATE_H
#define __SESSIONSTATE_H
#include <map>
#include <set>
#include <string>
class VxSession
{
private:
std::string sessionHandle;
std::string sessionUri;
int mediaState;
int textState;
int incoming;
bool isTransmitting;
public:
VxSession(std::string session_handle, std::string uri);
~VxSession();
std::string GetSessionHandle();
std::string GetSessionURI();
int GetMediaState();
void SetMediaState(int state);
int GetTextState();
void SetTextState(int state);
int GetIsIncoming();
void SetIsIncoming(int state);
bool GetIsTransmitting();
void SetIsTransmitting(bool state);
};
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/psy.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: psychoacoustics not including preecho
last mod: $Id: psy.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "vorbis/codec.h"
#include "codec_internal.h"
#include "masking.h"
#include "psy.h"
#include "os.h"
#include "lpc.h"
#include "smallft.h"
#include "scales.h"
#include "misc.h"
#define NEGINF -9999.f
static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
codec_setup_info *ci=vi->codec_setup;
vorbis_info_psy_global *gi=&ci->psy_g_param;
vorbis_look_psy_global *look=_ogg_calloc(1,sizeof(*look));
look->channels=vi->channels;
look->ampmax=-9999.;
look->gi=gi;
return(look);
}
void _vp_global_free(vorbis_look_psy_global *look){
if(look){
memset(look,0,sizeof(*look));
_ogg_free(look);
}
}
void _vi_gpsy_free(vorbis_info_psy_global *i){
if(i){
memset(i,0,sizeof(*i));
_ogg_free(i);
}
}
void _vi_psy_free(vorbis_info_psy *i){
if(i){
memset(i,0,sizeof(*i));
_ogg_free(i);
}
}
static void min_curve(float *c,
float *c2){
int i;
for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i];
}
static void max_curve(float *c,
float *c2){
int i;
for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i];
}
static void attenuate_curve(float *c,float att){
int i;
for(i=0;i<EHMER_MAX;i++)
c[i]+=att;
}
static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
float center_boost, float center_decay_rate){
int i,j,k,m;
float ath[EHMER_MAX];
float workc[P_BANDS][P_LEVELS][EHMER_MAX];
float athc[P_LEVELS][EHMER_MAX];
float *brute_buffer=alloca(n*sizeof(*brute_buffer));
float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS);
memset(workc,0,sizeof(workc));
for(i=0;i<P_BANDS;i++){
/* we add back in the ATH to avoid low level curves falling off to
-infinity and unnecessarily cutting off high level curves in the
curve limiting (last step). */
/* A half-band's settings must be valid over the whole band, and
it's better to mask too little than too much */
int ath_offset=i*4;
for(j=0;j<EHMER_MAX;j++){
float min=999.;
for(k=0;k<4;k++)
if(j+k+ath_offset<MAX_ATH){
if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset];
}else{
if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1];
}
ath[j]=min;
}
/* copy curves into working space, replicate the 50dB curve to 30
and 40, replicate the 100dB curve to 110 */
for(j=0;j<6;j++)
memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j]));
memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
/* apply centered curve boost/decay */
for(j=0;j<P_LEVELS;j++){
for(k=0;k<EHMER_MAX;k++){
float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate;
if(adj<0. && center_boost>0)adj=0.;
if(adj>0. && center_boost<0)adj=0.;
workc[i][j][k]+=adj;
}
}
/* normalize curves so the driving amplitude is 0dB */
/* make temp curves with the ATH overlayed */
for(j=0;j<P_LEVELS;j++){
attenuate_curve(workc[i][j],curveatt_dB[i]+100.-(j<2?2:j)*10.-P_LEVEL_0);
memcpy(athc[j],ath,EHMER_MAX*sizeof(**athc));
attenuate_curve(athc[j],+100.-j*10.f-P_LEVEL_0);
max_curve(athc[j],workc[i][j]);
}
/* Now limit the louder curves.
the idea is this: We don't know what the playback attenuation
will be; 0dB SL moves every time the user twiddles the volume
knob. So that means we have to use a single 'most pessimal' curve
for all masking amplitudes, right? Wrong. The *loudest* sound
can be in (we assume) a range of ...+100dB] SL. However, sounds
20dB down will be in a range ...+80], 40dB down is from ...+60],
etc... */
for(j=1;j<P_LEVELS;j++){
min_curve(athc[j],athc[j-1]);
min_curve(workc[i][j],athc[j]);
}
}
for(i=0;i<P_BANDS;i++){
int hi_curve,lo_curve,bin;
ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS);
/* low frequency curves are measured with greater resolution than
the MDCT/FFT will actually give us; we want the curve applied
to the tone data to be pessimistic and thus apply the minimum
masking possible for a given bin. That means that a single bin
could span more than one octave and that the curve will be a
composite of multiple octaves. It also may mean that a single
bin may span > an eighth of an octave and that the eighth
octave values may also be composited. */
/* which octave curves will we be compositing? */
bin=floor(fromOC(i*.5)/binHz);
lo_curve= ceil(toOC(bin*binHz+1)*2);
hi_curve= floor(toOC((bin+1)*binHz)*2);
if(lo_curve>i)lo_curve=i;
if(lo_curve<0)lo_curve=0;
if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1;
for(m=0;m<P_LEVELS;m++){
ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2));
for(j=0;j<n;j++)brute_buffer[j]=999.;
/* render the curve into bins, then pull values back into curve.
The point is that any inherent subsampling aliasing results in
a safe minimum */
for(k=lo_curve;k<=hi_curve;k++){
int l=0;
for(j=0;j<EHMER_MAX;j++){
int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
if(lo_bin<0)lo_bin=0;
if(lo_bin>n)lo_bin=n;
if(lo_bin<l)l=lo_bin;
if(hi_bin<0)hi_bin=0;
if(hi_bin>n)hi_bin=n;
for(;l<hi_bin && l<n;l++)
if(brute_buffer[l]>workc[k][m][j])
brute_buffer[l]=workc[k][m][j];
}
for(;l<n;l++)
if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
brute_buffer[l]=workc[k][m][EHMER_MAX-1];
}
/* be equally paranoid about being valid up to next half ocatve */
if(i+1<P_BANDS){
int l=0;
k=i+1;
for(j=0;j<EHMER_MAX;j++){
int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz;
int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1;
if(lo_bin<0)lo_bin=0;
if(lo_bin>n)lo_bin=n;
if(lo_bin<l)l=lo_bin;
if(hi_bin<0)hi_bin=0;
if(hi_bin>n)hi_bin=n;
for(;l<hi_bin && l<n;l++)
if(brute_buffer[l]>workc[k][m][j])
brute_buffer[l]=workc[k][m][j];
}
for(;l<n;l++)
if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
brute_buffer[l]=workc[k][m][EHMER_MAX-1];
}
for(j=0;j<EHMER_MAX;j++){
int bin=fromOC(j*.125+i*.5-2.)/binHz;
if(bin<0){
ret[i][m][j+2]=-999.;
}else{
if(bin>=n){
ret[i][m][j+2]=-999.;
}else{
ret[i][m][j+2]=brute_buffer[bin];
}
}
}
/* add fenceposts */
for(j=0;j<EHMER_OFFSET;j++)
if(ret[i][m][j+2]>-200.f)break;
ret[i][m][0]=j;
for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--)
if(ret[i][m][j+2]>-200.f)
break;
ret[i][m][1]=j;
}
}
return(ret);
}
void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
vorbis_info_psy_global *gi,int n,long rate){
long i,j,lo=-99,hi=1;
long maxoc;
memset(p,0,sizeof(*p));
p->eighth_octave_lines=gi->eighth_octave_lines;
p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1;
p->firstoc=toOC(.25f*rate*.5/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines;
maxoc=toOC((n+.25f)*rate*.5/n)*(1<<(p->shiftoc+1))+.5f;
p->total_octave_lines=maxoc-p->firstoc+1;
p->ath=_ogg_malloc(n*sizeof(*p->ath));
p->octave=_ogg_malloc(n*sizeof(*p->octave));
p->bark=_ogg_malloc(n*sizeof(*p->bark));
p->vi=vi;
p->n=n;
p->rate=rate;
/* AoTuV HF weighting */
p->m_val = 1.;
if(rate < 26000) p->m_val = 0;
else if(rate < 38000) p->m_val = .94; /* 32kHz */
else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
/* set up the lookups for a given blocksize and sample rate */
for(i=0,j=0;i<MAX_ATH-1;i++){
int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate);
float base=ATH[i];
if(j<endpos){
float delta=(ATH[i+1]-base)/(endpos-j);
for(;j<endpos && j<n;j++){
p->ath[j]=base+100.;
base+=delta;
}
}
}
for(i=0;i<n;i++){
float bark=toBARK(rate/(2*n)*i);
for(;lo+vi->noisewindowlomin<i &&
toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++);
for(;hi<=n && (hi<i+vi->noisewindowhimin ||
toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++);
p->bark[i]=((lo-1)<<16)+(hi-1);
}
for(i=0;i<n;i++)
p->octave[i]=toOC((i+.25f)*.5*rate/n)*(1<<(p->shiftoc+1))+.5f;
p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n,
vi->tone_centerboost,vi->tone_decay);
/* set up rolling noise median */
p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
for(i=0;i<P_NOISECURVES;i++)
p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
for(i=0;i<n;i++){
float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
int inthalfoc;
float del;
if(halfoc<0)halfoc=0;
if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
inthalfoc=(int)halfoc;
del=halfoc-inthalfoc;
for(j=0;j<P_NOISECURVES;j++)
p->noiseoffset[j][i]=
p->vi->noiseoff[j][inthalfoc]*(1.-del) +
p->vi->noiseoff[j][inthalfoc+1]*del;
}
#if 0
{
static int ls=0;
_analysis_output_always("noiseoff0",ls,p->noiseoffset[0],n,1,0,0);
_analysis_output_always("noiseoff1",ls,p->noiseoffset[1],n,1,0,0);
_analysis_output_always("noiseoff2",ls++,p->noiseoffset[2],n,1,0,0);
}
#endif
}
void _vp_psy_clear(vorbis_look_psy *p){
int i,j;
if(p){
if(p->ath)_ogg_free(p->ath);
if(p->octave)_ogg_free(p->octave);
if(p->bark)_ogg_free(p->bark);
if(p->tonecurves){
for(i=0;i<P_BANDS;i++){
for(j=0;j<P_LEVELS;j++){
_ogg_free(p->tonecurves[i][j]);
}
_ogg_free(p->tonecurves[i]);
}
_ogg_free(p->tonecurves);
}
if(p->noiseoffset){
for(i=0;i<P_NOISECURVES;i++){
_ogg_free(p->noiseoffset[i]);
}
_ogg_free(p->noiseoffset);
}
memset(p,0,sizeof(*p));
}
}
/* octave/(8*eighth_octave_lines) x scale and dB y scale */
static void seed_curve(float *seed,
const float **curves,
float amp,
int oc, int n,
int linesper,float dBoffset){
int i,post1;
int seedptr;
const float *posts,*curve;
int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f);
choice=max(choice,0);
choice=min(choice,P_LEVELS-1);
posts=curves[choice];
curve=posts+2;
post1=(int)posts[1];
seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1);
for(i=posts[0];i<post1;i++){
if(seedptr>0){
float lin=amp+curve[i];
if(seed[seedptr]<lin)seed[seedptr]=lin;
}
seedptr+=linesper;
if(seedptr>=n)break;
}
}
static void seed_loop(vorbis_look_psy *p,
const float ***curves,
const float *f,
const float *flr,
float *seed,
float specmax){
vorbis_info_psy *vi=p->vi;
long n=p->n,i;
float dBoffset=vi->max_curve_dB-specmax;
/* prime the working vector with peak values */
for(i=0;i<n;i++){
float max=f[i];
long oc=p->octave[i];
while(i+1<n && p->octave[i+1]==oc){
i++;
if(f[i]>max)max=f[i];
}
if(max+6.f>flr[i]){
oc=oc>>p->shiftoc;
if(oc>=P_BANDS)oc=P_BANDS-1;
if(oc<0)oc=0;
seed_curve(seed,
curves[oc],
max,
p->octave[i]-p->firstoc,
p->total_octave_lines,
p->eighth_octave_lines,
dBoffset);
}
}
}
static void seed_chase(float *seeds, int linesper, long n){
long *posstack=alloca(n*sizeof(*posstack));
float *ampstack=alloca(n*sizeof(*ampstack));
long stack=0;
long pos=0;
long i;
for(i=0;i<n;i++){
if(stack<2){
posstack[stack]=i;
ampstack[stack++]=seeds[i];
}else{
while(1){
if(seeds[i]<ampstack[stack-1]){
posstack[stack]=i;
ampstack[stack++]=seeds[i];
break;
}else{
if(i<posstack[stack-1]+linesper){
if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] &&
i<posstack[stack-2]+linesper){
/* we completely overlap, making stack-1 irrelevant. pop it */
stack--;
continue;
}
}
posstack[stack]=i;
ampstack[stack++]=seeds[i];
break;
}
}
}
}
/* the stack now contains only the positions that are relevant. Scan
'em straight through */
for(i=0;i<stack;i++){
long endpos;
if(i<stack-1 && ampstack[i+1]>ampstack[i]){
endpos=posstack[i+1];
}else{
endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is
discarded in short frames */
}
if(endpos>n)endpos=n;
for(;pos<endpos;pos++)
seeds[pos]=ampstack[i];
}
/* there. Linear time. I now remember this was on a problem set I
had in Grad Skool... I didn't solve it at the time ;-) */
}
/* bleaugh, this is more complicated than it needs to be */
#include<stdio.h>
static void max_seeds(vorbis_look_psy *p,
float *seed,
float *flr){
long n=p->total_octave_lines;
int linesper=p->eighth_octave_lines;
long linpos=0;
long pos;
seed_chase(seed,linesper,n); /* for masking */
pos=p->octave[0]-p->firstoc-(linesper>>1);
while(linpos+1<p->n){
float minV=seed[pos];
long end=((p->octave[linpos]+p->octave[linpos+1])>>1)-p->firstoc;
if(minV>p->vi->tone_abs_limit)minV=p->vi->tone_abs_limit;
while(pos+1<=end){
pos++;
if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF)
minV=seed[pos];
}
end=pos+p->firstoc;
for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
if(flr[linpos]<minV)flr[linpos]=minV;
}
{
float minV=seed[p->total_octave_lines-1];
for(;linpos<p->n;linpos++)
if(flr[linpos]<minV)flr[linpos]=minV;
}
}
static void bark_noise_hybridmp(int n,const long *b,
const float *f,
float *noise,
const float offset,
const int fixed){
float *N=alloca(n*sizeof(*N));
float *X=alloca(n*sizeof(*N));
float *XX=alloca(n*sizeof(*N));
float *Y=alloca(n*sizeof(*N));
float *XY=alloca(n*sizeof(*N));
float tN, tX, tXX, tY, tXY;
int i;
int lo, hi;
float R, A, B, D;
float w, x, y;
tN = tX = tXX = tY = tXY = 0.f;
y = f[0] + offset;
if (y < 1.f) y = 1.f;
w = y * y * .5;
tN += w;
tX += w;
tY += w * y;
N[0] = tN;
X[0] = tX;
XX[0] = tXX;
Y[0] = tY;
XY[0] = tXY;
for (i = 1, x = 1.f; i < n; i++, x += 1.f) {
y = f[i] + offset;
if (y < 1.f) y = 1.f;
w = y * y;
tN += w;
tX += w * x;
tXX += w * x * x;
tY += w * y;
tXY += w * x * y;
N[i] = tN;
X[i] = tX;
XX[i] = tXX;
Y[i] = tY;
XY[i] = tXY;
}
for (i = 0, x = 0.f;; i++, x += 1.f) {
lo = b[i] >> 16;
if( lo>=0 ) break;
hi = b[i] & 0xffff;
tN = N[hi] + N[-lo];
tX = X[hi] - X[-lo];
tXX = XX[hi] + XX[-lo];
tY = Y[hi] + Y[-lo];
tXY = XY[hi] - XY[-lo];
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R < 0.f)
R = 0.f;
noise[i] = R - offset;
}
for ( ;; i++, x += 1.f) {
lo = b[i] >> 16;
hi = b[i] & 0xffff;
if(hi>=n)break;
tN = N[hi] - N[lo];
tX = X[hi] - X[lo];
tXX = XX[hi] - XX[lo];
tY = Y[hi] - Y[lo];
tXY = XY[hi] - XY[lo];
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R < 0.f) R = 0.f;
noise[i] = R - offset;
}
for ( ; i < n; i++, x += 1.f) {
R = (A + x * B) / D;
if (R < 0.f) R = 0.f;
noise[i] = R - offset;
}
if (fixed <= 0) return;
for (i = 0, x = 0.f;; i++, x += 1.f) {
hi = i + fixed / 2;
lo = hi - fixed;
if(lo>=0)break;
tN = N[hi] + N[-lo];
tX = X[hi] - X[-lo];
tXX = XX[hi] + XX[-lo];
tY = Y[hi] + Y[-lo];
tXY = XY[hi] - XY[-lo];
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R - offset < noise[i]) noise[i] = R - offset;
}
for ( ;; i++, x += 1.f) {
hi = i + fixed / 2;
lo = hi - fixed;
if(hi>=n)break;
tN = N[hi] - N[lo];
tX = X[hi] - X[lo];
tXX = XX[hi] - XX[lo];
tY = Y[hi] - Y[lo];
tXY = XY[hi] - XY[lo];
A = tY * tXX - tX * tXY;
B = tN * tXY - tX * tY;
D = tN * tXX - tX * tX;
R = (A + x * B) / D;
if (R - offset < noise[i]) noise[i] = R - offset;
}
for ( ; i < n; i++, x += 1.f) {
R = (A + x * B) / D;
if (R - offset < noise[i]) noise[i] = R - offset;
}
}
static float FLOOR1_fromdB_INV_LOOKUP[256]={
0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F,
7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F,
5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F,
4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F,
3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F,
2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F,
2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F,
1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F,
1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F,
973377.F, 913981.F, 858210.F, 805842.F,
756669.F, 710497.F, 667142.F, 626433.F,
588208.F, 552316.F, 518613.F, 486967.F,
457252.F, 429351.F, 403152.F, 378551.F,
355452.F, 333762.F, 313396.F, 294273.F,
276316.F, 259455.F, 243623.F, 228757.F,
214798.F, 201691.F, 189384.F, 177828.F,
166977.F, 156788.F, 147221.F, 138237.F,
129802.F, 121881.F, 114444.F, 107461.F,
100903.F, 94746.3F, 88964.9F, 83536.2F,
78438.8F, 73652.5F, 69158.2F, 64938.1F,
60975.6F, 57254.9F, 53761.2F, 50480.6F,
47400.3F, 44507.9F, 41792.0F, 39241.9F,
36847.3F, 34598.9F, 32487.7F, 30505.3F,
28643.8F, 26896.0F, 25254.8F, 23713.7F,
22266.7F, 20908.0F, 19632.2F, 18434.2F,
17309.4F, 16253.1F, 15261.4F, 14330.1F,
13455.7F, 12634.6F, 11863.7F, 11139.7F,
10460.0F, 9821.72F, 9222.39F, 8659.64F,
8131.23F, 7635.06F, 7169.17F, 6731.70F,
6320.93F, 5935.23F, 5573.06F, 5232.99F,
4913.67F, 4613.84F, 4332.30F, 4067.94F,
3819.72F, 3586.64F, 3367.78F, 3162.28F,
2969.31F, 2788.13F, 2617.99F, 2458.24F,
2308.24F, 2167.39F, 2035.14F, 1910.95F,
1794.35F, 1684.85F, 1582.04F, 1485.51F,
1394.86F, 1309.75F, 1229.83F, 1154.78F,
1084.32F, 1018.15F, 956.024F, 897.687F,
842.910F, 791.475F, 743.179F, 697.830F,
655.249F, 615.265F, 577.722F, 542.469F,
509.367F, 478.286F, 449.101F, 421.696F,
395.964F, 371.803F, 349.115F, 327.812F,
307.809F, 289.026F, 271.390F, 254.830F,
239.280F, 224.679F, 210.969F, 198.096F,
186.008F, 174.658F, 164.000F, 153.993F,
144.596F, 135.773F, 127.488F, 119.708F,
112.404F, 105.545F, 99.1046F, 93.0572F,
87.3788F, 82.0469F, 77.0404F, 72.3394F,
67.9252F, 63.7804F, 59.8885F, 56.2341F,
52.8027F, 49.5807F, 46.5553F, 43.7144F,
41.0470F, 38.5423F, 36.1904F, 33.9821F,
31.9085F, 29.9614F, 28.1332F, 26.4165F,
24.8045F, 23.2910F, 21.8697F, 20.5352F,
19.2822F, 18.1056F, 17.0008F, 15.9634F,
14.9893F, 14.0746F, 13.2158F, 12.4094F,
11.6522F, 10.9411F, 10.2735F, 9.64662F,
9.05798F, 8.50526F, 7.98626F, 7.49894F,
7.04135F, 6.61169F, 6.20824F, 5.82941F,
5.47370F, 5.13970F, 4.82607F, 4.53158F,
4.25507F, 3.99542F, 3.75162F, 3.52269F,
3.30774F, 3.10590F, 2.91638F, 2.73842F,
2.57132F, 2.41442F, 2.26709F, 2.12875F,
1.99885F, 1.87688F, 1.76236F, 1.65482F,
1.55384F, 1.45902F, 1.36999F, 1.28640F,
1.20790F, 1.13419F, 1.06499F, 1.F
};
void _vp_remove_floor(vorbis_look_psy *p,
float *mdct,
int *codedflr,
float *residue,
int sliding_lowpass){
int i,n=p->n;
if(sliding_lowpass>n)sliding_lowpass=n;
for(i=0;i<sliding_lowpass;i++){
residue[i]=
mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
}
for(;i<n;i++)
residue[i]=0.;
}
void _vp_noisemask(vorbis_look_psy *p,
float *logmdct,
float *logmask){
int i,n=p->n;
float *work=alloca(n*sizeof(*work));
bark_noise_hybridmp(n,p->bark,logmdct,logmask,
140.,-1);
for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
bark_noise_hybridmp(n,p->bark,work,logmask,0.,
p->vi->noisewindowfixed);
for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
#if 0
{
static int seq=0;
float work2[n];
for(i=0;i<n;i++){
work2[i]=logmask[i]+work[i];
}
if(seq&1)
_analysis_output("median2R",seq/2,work,n,1,0,0);
else
_analysis_output("median2L",seq/2,work,n,1,0,0);
if(seq&1)
_analysis_output("envelope2R",seq/2,work2,n,1,0,0);
else
_analysis_output("envelope2L",seq/2,work2,n,1,0,0);
seq++;
}
#endif
for(i=0;i<n;i++){
int dB=logmask[i]+.5;
if(dB>=NOISE_COMPAND_LEVELS)dB=NOISE_COMPAND_LEVELS-1;
if(dB<0)dB=0;
logmask[i]= work[i]+p->vi->noisecompand[dB];
}
}
void _vp_tonemask(vorbis_look_psy *p,
float *logfft,
float *logmask,
float global_specmax,
float local_specmax){
int i,n=p->n;
float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
float att=local_specmax+p->vi->ath_adjatt;
for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
/* set the ATH (floating below localmax, not global max by a
specified att) */
if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
for(i=0;i<n;i++)
logmask[i]=p->ath[i]+att;
/* tone masking */
seed_loop(p,(const float ***)p->tonecurves,logfft,logmask,seed,global_specmax);
max_seeds(p,seed,logmask);
}
void _vp_offset_and_mix(vorbis_look_psy *p,
float *noise,
float *tone,
int offset_select,
float *logmask,
float *mdct,
float *logmdct){
int i,n=p->n;
float de, coeffi, cx;/* AoTuV */
float toneatt=p->vi->tone_masteratt[offset_select];
cx = p->m_val;
for(i=0;i<n;i++){
float val= noise[i]+p->noiseoffset[offset_select][i];
if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
logmask[i]=max(val,tone[i]+toneatt);
/* AoTuV */
/** @ M1 **
The following codes improve a noise problem.
A fundamental idea uses the value of masking and carries out
the relative compensation of the MDCT.
However, this code is not perfect and all noise problems cannot be solved.
by Aoyumi @ 2004/04/18
*/
if(offset_select == 1) {
coeffi = -17.2; /* coeffi is a -17.2dB threshold */
val = val - logmdct[i]; /* val == mdct line value relative to floor in dB */
if(val > coeffi){
/* mdct value is > -17.2 dB below floor */
de = 1.0-((val-coeffi)*0.005*cx);
/* pro-rated attenuation:
-0.00 dB boost if mdct value is -17.2dB (relative to floor)
-0.77 dB boost if mdct value is 0dB (relative to floor)
-1.64 dB boost if mdct value is +17.2dB (relative to floor)
etc... */
if(de < 0) de = 0.0001;
}else
/* mdct value is <= -17.2 dB below floor */
de = 1.0-((val-coeffi)*0.0003*cx);
/* pro-rated attenuation:
+0.00 dB atten if mdct value is -17.2dB (relative to floor)
+0.45 dB atten if mdct value is -34.4dB (relative to floor)
etc... */
mdct[i] *= de;
}
}
}
float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
vorbis_info *vi=vd->vi;
codec_setup_info *ci=vi->codec_setup;
vorbis_info_psy_global *gi=&ci->psy_g_param;
int n=ci->blocksizes[vd->W]/2;
float secs=(float)n/vi->rate;
amp+=secs*gi->ampmax_att_per_sec;
if(amp<-9999)amp=-9999;
return(amp);
}
static void couple_lossless(float A, float B,
float *qA, float *qB){
int test1=fabs(*qA)>fabs(*qB);
test1-= fabs(*qA)<fabs(*qB);
if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
if(test1==1){
*qB=(*qA>0.f?*qA-*qB:*qB-*qA);
}else{
float temp=*qB;
*qB=(*qB>0.f?*qA-*qB:*qB-*qA);
*qA=temp;
}
if(*qB>fabs(*qA)*1.9999f){
*qB= -fabs(*qA)*2.f;
*qA= -*qA;
}
}
static float hypot_lookup[32]={
-0.009935, -0.011245, -0.012726, -0.014397,
-0.016282, -0.018407, -0.020800, -0.023494,
-0.026522, -0.029923, -0.033737, -0.038010,
-0.042787, -0.048121, -0.054064, -0.060671,
-0.068000, -0.076109, -0.085054, -0.094892,
-0.105675, -0.117451, -0.130260, -0.144134,
-0.159093, -0.175146, -0.192286, -0.210490,
-0.229718, -0.249913, -0.271001, -0.292893};
static void precomputed_couple_point(float premag,
int floorA,int floorB,
float *mag, float *ang){
int test=(floorA>floorB)-1;
int offset=31-abs(floorA-floorB);
float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
*mag=premag*floormag;
*ang=0.f;
}
/* just like below, this is currently set up to only do
single-step-depth coupling. Otherwise, we'd have to do more
copying (which will be inevitable later) */
/* doing the real circular magnitude calculation is audibly superior
to (A+B)/sqrt(2) */
static float dipole_hypot(float a, float b){
if(a>0.){
if(b>0.)return sqrt(a*a+b*b);
if(a>-b)return sqrt(a*a-b*b);
return -sqrt(b*b-a*a);
}
if(b<0.)return -sqrt(a*a+b*b);
if(-a>b)return -sqrt(a*a-b*b);
return sqrt(b*b-a*a);
}
static float round_hypot(float a, float b){
if(a>0.){
if(b>0.)return sqrt(a*a+b*b);
if(a>-b)return sqrt(a*a+b*b);
return -sqrt(b*b+a*a);
}
if(b<0.)return -sqrt(a*a+b*b);
if(-a>b)return -sqrt(a*a+b*b);
return sqrt(b*b+a*a);
}
/* revert to round hypot for now */
float **_vp_quantize_couple_memo(vorbis_block *vb,
vorbis_info_psy_global *g,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
float **mdct){
int i,j,n=p->n;
float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
for(i=0;i<vi->coupling_steps;i++){
float *mdctM=mdct[vi->coupling_mag[i]];
float *mdctA=mdct[vi->coupling_ang[i]];
ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
for(j=0;j<limit;j++)
ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]);
for(;j<n;j++)
ret[i][j]=round_hypot(mdctM[j],mdctA[j]);
}
return(ret);
}
/* this is for per-channel noise normalization */
static int apsort(const void *a, const void *b){
float f1=fabs(**(float**)a);
float f2=fabs(**(float**)b);
return (f1<f2)-(f1>f2);
}
int **_vp_quantize_couple_sort(vorbis_block *vb,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
float **mags){
if(p->vi->normal_point_p){
int i,j,k,n=p->n;
int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
int partition=p->vi->normal_partition;
float **work=alloca(sizeof(*work)*partition);
for(i=0;i<vi->coupling_steps;i++){
ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
for(j=0;j<n;j+=partition){
for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
qsort(work,partition,sizeof(*work),apsort);
for(k=0;k<partition;k++)ret[i][k+j]=work[k]-mags[i];
}
}
return(ret);
}
return(NULL);
}
void _vp_noise_normalize_sort(vorbis_look_psy *p,
float *magnitudes,int *sortedindex){
int i,j,n=p->n;
vorbis_info_psy *vi=p->vi;
int partition=vi->normal_partition;
float **work=alloca(sizeof(*work)*partition);
int start=vi->normal_start;
for(j=start;j<n;j+=partition){
if(j+partition>n)partition=n-j;
for(i=0;i<partition;i++)work[i]=magnitudes+i+j;
qsort(work,partition,sizeof(*work),apsort);
for(i=0;i<partition;i++){
sortedindex[i+j-start]=work[i]-magnitudes;
}
}
}
void _vp_noise_normalize(vorbis_look_psy *p,
float *in,float *out,int *sortedindex){
int flag=0,i,j=0,n=p->n;
vorbis_info_psy *vi=p->vi;
int partition=vi->normal_partition;
int start=vi->normal_start;
if(start>n)start=n;
if(vi->normal_channel_p){
for(;j<start;j++)
out[j]=rint(in[j]);
for(;j+partition<=n;j+=partition){
float acc=0.;
int k;
for(i=j;i<j+partition;i++)
acc+=in[i]*in[i];
for(i=0;i<partition;i++){
k=sortedindex[i+j-start];
if(in[k]*in[k]>=.25f){
out[k]=rint(in[k]);
acc-=in[k]*in[k];
flag=1;
}else{
if(acc<vi->normal_thresh)break;
out[k]=unitnorm(in[k]);
acc-=1.;
}
}
for(;i<partition;i++){
k=sortedindex[i+j-start];
out[k]=0.;
}
}
}
for(;j<n;j++)
out[j]=rint(in[j]);
}
void _vp_couple(int blobno,
vorbis_info_psy_global *g,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
float **res,
float **mag_memo,
int **mag_sort,
int **ifloor,
int *nonzero,
int sliding_lowpass){
int i,j,k,n=p->n;
/* perform any requested channel coupling */
/* point stereo can only be used in a first stage (in this encoder)
because of the dependency on floor lookups */
for(i=0;i<vi->coupling_steps;i++){
/* once we're doing multistage coupling in which a channel goes
through more than one coupling step, the floor vector
magnitudes will also have to be recalculated an propogated
along with PCM. Right now, we're not (that will wait until 5.1
most likely), so the code isn't here yet. The memory management
here is all assuming single depth couplings anyway. */
/* make sure coupling a zero and a nonzero channel results in two
nonzero channels. */
if(nonzero[vi->coupling_mag[i]] ||
nonzero[vi->coupling_ang[i]]){
float *rM=res[vi->coupling_mag[i]];
float *rA=res[vi->coupling_ang[i]];
float *qM=rM+n;
float *qA=rA+n;
int *floorM=ifloor[vi->coupling_mag[i]];
int *floorA=ifloor[vi->coupling_ang[i]];
float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
int pointlimit=limit;
nonzero[vi->coupling_mag[i]]=1;
nonzero[vi->coupling_ang[i]]=1;
/* The threshold of a stereo is changed with the size of n */
if(n > 1000)
postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
for(j=0;j<p->n;j+=partition){
float acc=0.f;
for(k=0;k<partition;k++){
int l=k+j;
if(l<sliding_lowpass){
if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
(fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
precomputed_couple_point(mag_memo[i][l],
floorM[l],floorA[l],
qM+l,qA+l);
if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
}else{
couple_lossless(rM[l],rA[l],qM+l,qA+l);
}
}else{
qM[l]=0.;
qA[l]=0.;
}
}
if(p->vi->normal_point_p){
for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
int l=mag_sort[i][j+k];
if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
qM[l]=unitnorm(qM[l]);
acc-=1.f;
}
}
}
}
}
}
}
/* AoTuV */
/** @ M2 **
The boost problem by the combination of noise normalization and point stereo is eased.
However, this is a temporary patch.
by Aoyumi @ 2004/04/18
*/
void hf_reduction(vorbis_info_psy_global *g,
vorbis_look_psy *p,
vorbis_info_mapping0 *vi,
float **mdct){
int i,j,n=p->n, de=0.3*p->m_val;
int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
int start=p->vi->normal_start;
for(i=0; i<vi->coupling_steps; i++){
/* for(j=start; j<limit; j++){} // ???*/
for(j=limit; j<n; j++)
mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
}
}
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/ethereal/packet-rudp-mv.c
|
<filename>tools/ethereal/packet-rudp-mv.c
/* packet-rudp.c
* Routines for Reliable UDP Protocol.
* Copyright 2004, <NAME> <<EMAIL>>
*
* $Id: packet-rudp-mv.c 792 2005-02-17 20:05:09Z mccollum $
*
* Ethereal - Network traffic analyzer
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gmodule.h>
#include <epan/packet.h>
#include "plugins/plugin_api.h"
#include "plugins/plugin_api_defs.h"
/* Define version if we are not building ethereal statically */
/*
#include "moduleinfo.h"
*/
static int proto_rudp_mv = -1;
static int hf_rudp_mv_oid = -1;
static int hf_rudp_mv_msgtype = -1;
static int hf_rudp_mv_data = -1;
static gint ett_rudp_mv = -1;
static void
dissect_mv_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
{
proto_tree *rudp_mv_tree = NULL;
proto_item *ti = NULL;
if (tree) {
ti = proto_tree_add_item(tree, proto_rudp_mv, tvb, 0, 12, FALSE);
rudp_mv_tree = proto_item_add_subtree(ti, ett_rudp_mv);
proto_tree_add_item(rudp_mv_tree, hf_rudp_mv_oid, tvb, 0, 8, FALSE);
proto_tree_add_item(rudp_mv_tree, hf_rudp_mv_msgtype, tvb, 8, 4, FALSE);
proto_tree_add_item(rudp_mv_tree, hf_rudp_mv_data, tvb, 12, -1, FALSE);
}
}
void proto_register_rudp_mv(void)
{
static hf_register_info hf[] = {
{ &hf_rudp_mv_oid,
{ "Oid", "rudp.mvwp.oid",
FT_UINT64, BASE_DEC, NULL, 0x0,
"Multiverse Oid", HFILL }
},
{ &hf_rudp_mv_msgtype,
{ "MsgType", "rudp.mvwp.msgtype",
FT_UINT32, BASE_DEC, NULL, 0x80,
"", HFILL }
},
{ &hf_rudp_mv_data,
{ "Data", "rudp.mvwp.data",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Multiverse Data", HFILL }
},
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_rudp_mv
};
if (proto_rudp_mv == -1) {
proto_rudp_mv = proto_register_protocol (
"Multiverse World Protocol", /* name */
"MVWP", /* short name */
"rudp.mvwp" /* abbrev */
);
}
proto_register_field_array(proto_rudp_mv, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_rudp_mv(void)
{
dissector_handle_t rudp_mv_handle = NULL;
rudp_mv_handle = create_dissector_handle(dissect_mv_rudp, proto_rudp_mv);
dissector_add("rudp.mvwp", 0, rudp_mv_handle);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/Vxc.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __VXC_H__
#define __VXC_H__
#include <assert.h>
#include "VxcExports.h"
#define SAFE_STRDUP(s) s ? strdup(s) : NULL;
#define SAFE_FREE(s) s ? free(s) : NULL;
#define SAFE_STR(s) (s) ? (s) : ""
#ifdef __cplusplus
extern "C" {
#endif
VIVOXSDK_DLLEXPORT char *safe_strdup(const char *s);
VIVOXSDK_DLLEXPORT void safe_free(char *s);
typedef char* VX_COOKIE;
typedef VX_COOKIE VX_HANDLE;
VIVOXSDK_DLLEXPORT void vx_cookie_create(const char* value, VX_COOKIE* cookie);
VIVOXSDK_DLLEXPORT void vx_cookie_free(VX_COOKIE* cookie);
enum vx_log_level
{
log_error = 0,
log_warning,
log_info,
log_debug,
log_trace
};
typedef enum vx_attempt_stun {
attempt_stun_unspecified,
attempt_stun_on,
attempt_stun_off,
};
typedef enum vx_connector_mode {
connector_mode_normal=0,
connector_mode_legacy,
};
typedef enum vx_message_type {
msg_none=0,
msg_request=1,
msg_response,
msg_event,
};
typedef enum vx_media_type {
media_type_none=0,
media_type_text,
media_type_audio,
media_type_video,
media_type_audiovideo,
};
typedef enum vx_channel_type {
channel_type_normal=0,
channel_type_dir,
channel_type_positional
};
typedef enum vx_channel_search_type {
channel_search_type_all=0,
channel_search_type_non_positional,
channel_search_type_positional
};
typedef struct vx_message_base {
vx_message_type type;
unsigned long long create_time_ms;
unsigned long long last_step_ms;
} vx_message_base_t;
/** The set of requests that can be issued. */
typedef enum vx_request_type {
req_none=0,
req_connector_create,
req_connector_initiate_shutdown,
req_account_login,
req_account_logout,
req_account_set_login_properties,
req_sessiongroup_create,
req_sessiongroup_terminate,
req_sessiongroup_add_session,
req_sessiongroup_remove_session,
req_sessiongroup_set_focus,
req_sessiongroup_unset_focus,
req_sessiongroup_reset_focus,
req_sessiongroup_set_tx_session,
req_sessiongroup_set_tx_all_sessions,
req_sessiongroup_set_tx_no_session,
req_session_create,
req_session_connect,
req_session_media_connect,
req_session_media_disconnect,
req_session_terminate,
req_session_mute_local_speaker,
req_session_set_local_speaker_volume,
req_session_get_local_audio_info,
req_session_channel_invite_user,
req_session_set_participant_volume_for_me,
req_session_set_participant_mute_for_me,
req_session_set_3d_position,
req_session_render_audio_start,
req_session_render_audio_stop,
req_session_channel_get_participants,
req_account_channel_get_list,
req_account_channel_create,
req_account_channel_update,
req_account_channel_delete,
req_account_channel_create_and_invite,
req_account_channel_folder_create,
req_account_channel_folder_update,
req_account_channel_folder_delete,
req_account_channel_folder_get_info,
req_account_channel_favorites_get_list,
req_account_channel_favorite_set,
req_account_channel_favorite_delete,
req_account_channel_favorite_group_set,
req_account_channel_favorite_group_delete,
req_account_channel_get_info,
req_account_channel_search,
req_account_buddy_search,
req_account_channel_add_moderator,
req_account_channel_remove_moderator,
req_account_channel_get_moderators,
req_account_channel_add_acl,
req_account_channel_remove_acl,
req_account_channel_get_acl,
req_channel_mute_user,
req_channel_ban_user,
req_channel_get_banned_users,
req_channel_kick_user,
req_channel_mute_all_users,
req_connector_mute_local_mic,
req_connector_mute_local_speaker,
req_connector_set_local_mic_volume,
req_connector_set_local_speaker_volume,
req_connector_get_local_audio_info,
req_account_buddy_set,
req_account_buddy_delete,
req_account_buddygroup_set,
req_account_buddygroup_delete,
req_account_list_buddies_and_groups,
req_session_send_message,
req_account_set_presence,
req_account_send_subscription_reply,
req_session_send_notification,
req_account_create_block_rule,
req_account_delete_block_rule,
req_account_list_block_rules,
req_account_create_auto_accept_rule,
req_account_delete_auto_accept_rule,
req_account_list_auto_accept_rules,
req_account_update_account,
req_account_get_account,
req_account_send_sms,
req_aux_connectivity_info,
req_aux_get_render_devices,
req_aux_get_capture_devices,
req_aux_set_render_device,
req_aux_set_capture_device,
req_aux_get_mic_level,
req_aux_get_speaker_level,
req_aux_set_mic_level,
req_aux_set_speaker_level,
req_aux_render_audio_start,
req_aux_render_audio_stop,
req_aux_capture_audio_start,
req_aux_capture_audio_stop,
req_aux_global_monitor_keyboard_mouse,
req_aux_set_idle_timeout,
req_aux_create_account,
req_aux_reactivate_account,
req_aux_deactivate_account,
req_max
};
/** Response types that will be reported back to the calling app. */
typedef enum vx_response_type {
resp_none=0,
resp_connector_create,
resp_connector_initiate_shutdown,
resp_account_login,
resp_account_logout,
resp_account_set_login_properties,
resp_sessiongroup_create,
resp_sessiongroup_terminate,
resp_sessiongroup_add_session,
resp_sessiongroup_remove_session,
resp_sessiongroup_set_focus,
resp_sessiongroup_unset_focus,
resp_sessiongroup_reset_focus,
resp_sessiongroup_set_tx_session,
resp_sessiongroup_set_tx_all_sessions,
resp_sessiongroup_set_tx_no_session,
resp_session_create,
resp_session_connect,
resp_session_media_connect,
resp_session_media_disconnect,
resp_session_terminate,
resp_session_mute_local_speaker,
resp_session_set_local_speaker_volume,
resp_session_get_local_audio_info,
resp_session_channel_invite_user,
resp_session_set_participant_volume_for_me,
resp_session_set_participant_mute_for_me,
resp_session_set_3d_position,
resp_session_render_audio_start,
resp_session_render_audio_stop,
resp_session_channel_get_participants,
resp_account_channel_get_list,
resp_account_channel_create,
resp_account_channel_update,
resp_account_channel_delete,
resp_account_channel_create_and_invite,
resp_account_channel_folder_create,
resp_account_channel_folder_update,
resp_account_channel_folder_delete,
resp_account_channel_folder_get_info,
resp_account_channel_favorites_get_list,
resp_account_channel_favorite_set,
resp_account_channel_favorite_delete,
resp_account_channel_favorite_group_set,
resp_account_channel_favorite_group_delete,
resp_account_channel_get_info,
resp_account_channel_search,
resp_account_buddy_search,
resp_account_channel_add_moderator,
resp_account_channel_remove_moderator,
resp_account_channel_get_moderators,
resp_account_channel_add_acl,
resp_account_channel_remove_acl,
resp_account_channel_get_acl,
resp_channel_mute_user,
resp_channel_ban_user,
resp_channel_get_banned_users,
resp_channel_kick_user,
resp_channel_mute_all_users,
resp_connector_mute_local_mic,
resp_connector_mute_local_speaker,
resp_connector_set_local_mic_volume,
resp_connector_set_local_speaker_volume,
resp_connector_get_local_audio_info,
resp_account_buddy_set,
resp_account_buddy_delete,
resp_account_buddygroup_set,
resp_account_buddygroup_delete,
resp_account_list_buddies_and_groups,
resp_session_send_message,
resp_account_set_presence,
resp_account_send_subscription_reply,
resp_session_send_notification,
resp_account_create_block_rule,
resp_account_delete_block_rule,
resp_account_list_block_rules,
resp_account_create_auto_accept_rule,
resp_account_delete_auto_accept_rule,
resp_account_list_auto_accept_rules,
resp_account_update_account,
resp_account_get_account,
resp_account_send_sms,
resp_aux_connectivity_info,
resp_aux_get_render_devices,
resp_aux_get_capture_devices,
resp_aux_set_render_device,
resp_aux_set_capture_device,
resp_aux_get_mic_level,
resp_aux_get_speaker_level,
resp_aux_set_mic_level,
resp_aux_set_speaker_level,
resp_aux_render_audio_start,
resp_aux_render_audio_stop,
resp_aux_capture_audio_start,
resp_aux_capture_audio_stop,
resp_aux_global_monitor_keyboard_mouse,
resp_aux_set_idle_timeout,
resp_aux_create_account,
resp_aux_reactivate_account,
resp_aux_deactivate_account,
resp_max
};
/** Event types that will be reported back to the calling app. */
typedef enum vx_event_type {
evt_none=0,
evt_login_state_change, //DEPRECATED, legacy mode only
evt_account_login_state_change,
evt_session_new, //DEPRECATED, legacy mode only
evt_session_state_change, //DEPRECATED, legacy mode only
evt_participant_state_change, //DEPRECATED, legacy mode only
evt_participant_properties, //DEPRECATED, legacy mode only
evt_buddy_presence,
evt_subscription,
evt_session_notification,
evt_message,
evt_aux_audio_properties,
evt_participant_list, //DEPRECATED, legacy mode only
evt_session_participant_list,
evt_session_media, //DEPRECATED, legacy mode only
evt_buddy_changed,
evt_buddy_group_changed,
evt_buddy_and_group_list_changed,
evt_keyboard_mouse,
evt_idle_state_changed,
evt_media_stream_updated,
evt_text_stream_updated,
evt_sessiongroup_added,
evt_sessiongroup_removed,
evt_session_added,
evt_session_removed,
evt_participant_added,
evt_participant_removed,
evt_participant_updated,
evt_max
};
typedef struct vx_req_base {
vx_message_base_t message;
vx_request_type type;
VX_COOKIE cookie;
void *vcookie;
} vx_req_base_t;
typedef struct vx_resp_base {
vx_message_base_t message;
vx_response_type type;
int return_code;
int status_code;
char* status_string;
vx_req_base_t* request;
} vx_resp_base_t;
typedef struct vx_evt_base {
vx_message_base_t message;
vx_event_type type;
} vx_evt_base_t;
typedef enum {
ND_E_NO_ERROR = 0,
ND_E_TEST_NOT_RUN,
ND_E_NO_INTERFACE,
ND_E_NO_INTERFACE_WITH_GATEWAY,
ND_E_NO_INTERFACE_WITH_ROUTE,
ND_E_TIMEOUT,
ND_E_CANT_ICMP,
ND_E_CANT_RESOLVE_VIVOX_UDP_SERVER,
ND_E_CANT_RESOLVE_ROOT_DNS_SERVER,
ND_E_CANT_CONVERT_LOCAL_IP_ADDRESS,
ND_E_CANT_CONTACT_STUN_SERVER_ON_UDP_PORT_3478,
ND_E_CANT_CREATE_TCP_SOCKET,
ND_E_CANT_LOAD_ICMP_LIBRARY,
ND_E_CANT_FIND_SENDECHO2_PROCADDR,
ND_E_CANT_CONNECT_TO_ECHO_SERVER,
ND_E_ECHO_SERVER_LOGIN_SEND_FAILED,
ND_E_ECHO_SERVER_LOGIN_RECV_FAILED,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_STATUS,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_FAILED_STATUS,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_SESSIONID,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_SIPPORT,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_AUDIORTP,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_AUDIORTCP,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_VIDEORTP,
ND_E_ECHO_SERVER_LOGIN_RESPONSE_MISSING_VIDEORTCP,
ND_E_ECHO_SERVER_CANT_ALLOCATE_SIP_SOCKET,
ND_E_ECHO_SERVER_CANT_ALLOCATE_MEDIA_SOCKET,
ND_E_ECHO_SERVER_SIP_UDP_SEND_FAILED,
ND_E_ECHO_SERVER_SIP_UDP_RECV_FAILED,
ND_E_ECHO_SERVER_SIP_TCP_SEND_FAILED,
ND_E_ECHO_SERVER_SIP_TCP_RECV_FAILED,
ND_E_ECHO_SERVER_SIP_NO_UDP_OR_TCP,
ND_E_ECHO_SERVER_SIP_NO_UDP,
ND_E_ECHO_SERVER_SIP_NO_TCP,
ND_E_ECHO_SERVER_SIP_MALFORMED_TCP_PACKET,
ND_E_ECHO_SERVER_SIP_UDP_DIFFERENT_LENGTH,
ND_E_ECHO_SERVER_SIP_UDP_DATA_DIFFERENT,
ND_E_ECHO_SERVER_SIP_TCP_PACKETS_DIFFERENT,
ND_E_ECHO_SERVER_SIP_TCP_PACKETS_DIFFERENT_SIZE,
ND_E_ECHO_SERVER_LOGIN_RECV_FAILED_TIMEOUT,
ND_E_ECHO_SERVER_TCP_SET_ASYNC_FAILED,
ND_E_ECHO_SERVER_UDP_SET_ASYNC_FAILED,
ND_E_ECHO_SERVER_CANT_RESOLVE_NAME
} ND_ERROR;
typedef enum {
ND_TEST_LOCATE_INTERFACE,
ND_TEST_PING_GATEWAY,
ND_TEST_DNS,
ND_TEST_STUN,
ND_TEST_ECHO,
ND_TEST_ECHO_SIP_FIRST_PORT,
ND_TEST_ECHO_SIP_FIRST_PORT_INVITE_REQUEST,
ND_TEST_ECHO_SIP_FIRST_PORT_INVITE_RESPONSE,
ND_TEST_ECHO_SIP_FIRST_PORT_REGISTER_REQUEST,
ND_TEST_ECHO_SIP_FIRST_PORT_REGISTER_RESPONSE,
ND_TEST_ECHO_SIP_SECOND_PORT,
ND_TEST_ECHO_SIP_SECOND_PORT_INVITE_REQUEST,
ND_TEST_ECHO_SIP_SECOND_PORT_INVITE_RESPONSE,
ND_TEST_ECHO_SIP_SECOND_PORT_REGISTER_REQUEST,
ND_TEST_ECHO_SIP_SECOND_PORT_REGISTER_RESPONSE,
ND_TEST_ECHO_MEDIA,
ND_TEST_ECHO_MEDIA_LARGE_PACKET
} ND_TEST_TYPE;
typedef enum vx_session_answer_mode {
mode_none=0,
mode_auto_answer=1,
mode_verify_answer,
};
typedef enum vx_rule_type {
rule_none=0,
rule_allow,
rule_block,
rule_hide,
};
typedef enum vx_subscription_type {
subscription_presence=0,
};
typedef enum vx_notification_type {
notification_not_typing,
notification_typing//,
//state_closed_window, no longer valid in this enum
};
typedef enum vx_text_mode {
text_mode_disabled = 0,
text_mode_enabled,
};
typedef enum vx_audiosource_operation {
op_none=0,
op_safeupdate=1,
op_delete,
};
typedef enum vx_aux_audio_properties_state {
aux_audio_properties_none=0
};
typedef enum vx_login_state_change_state {
login_state_logged_out=0,
login_state_logged_in = 1,
login_state_logging_in = 2,
login_state_logging_out = 3,
login_state_resetting = 4,
login_state_error=100
};
typedef enum vx_session_new_state {
session_new_none=0
};
typedef enum vx_session_state_change_state {
session_idle=1,
session_answering,
session_inprogress,
session_connected,
session_disconnected,
session_hold,
session_refer,
session_ringing,
};
typedef enum vx_participant_properties_state {
participant_properties_none=0,
};
typedef enum vx_participant_state_change_state {
part_idle=1,
part_pending,
part_incoming,
part_answering,
part_inprogress,
part_alerting,
part_connected,
part_disconnecting,
part_disconnected,
part_moderatormuted,
part_moderatorunmuted,
};
typedef enum {
buddy_presence_unknown=0, // deprecated
buddy_presence_pending=1,
buddy_presence_online=2,
buddy_presence_busy=3,
buddy_presence_brb=4,
buddy_presence_away=5,
buddy_presence_onthephone=6,
buddy_presence_outtolunch=7,
buddy_presence_closed=0, // deprecated
buddy_presence_offline=0, // deprecated
} vx_buddy_presence_state;
typedef enum vx_subscription_state {
subscription_none=0
};
typedef enum vx_session_notification_state {
session_notification_none=0
};
typedef enum vx_message_state {
message_none=0
};
typedef enum vx_participant_list_state {
participant_list_none=0
};
/*typedef enum vx_session_media_state {
session_media_none=0
};*/
typedef enum vx_session_text_state {
session_text_disconnected = 0,
session_text_connected
};
typedef enum vx_session_media_state {
session_media_none = 0,
session_media_disconnected,
session_media_connected,
session_media_ringing,
session_media_hold,
session_media_refer
};
typedef enum vx_participant_type {
part_user=0,
part_moderator,
part_focus,
};
typedef enum {
orientation_default = 0,
orientation_legacy = 1,
orientation_vivox = 2
} orientation_type;
/** Channel participant. */
typedef struct vx_participant {
char* uri;
char* first_name;
char* last_name;
char* display_name;
char* username;
int is_moderator;
int is_moderator_muted;
int is_muted_for_me;
} vx_participant_t;
VIVOXSDK_DLLEXPORT void vx_participant_create(vx_participant_t** participant);
VIVOXSDK_DLLEXPORT void vx_participant_free(vx_participant_t* participant);
/** Creates a participant list with the given size. */
typedef vx_participant_t* vx_participant_ref_t;
typedef vx_participant_ref_t* vx_participant_list_t;
VIVOXSDK_DLLEXPORT void vx_participant_list_create(int size, vx_participant_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_participant_list_free(vx_participant_t** list, int size);
/** Channel struct. */
typedef struct vx_channel {
char* channel_name;
char* channel_desc;
char* host;
int channel_id;
int limit;
int capacity;
char* modified; /* FIXME: What is this? */
char* owner;
char* owner_user_name;
int parent_id;
int is_persistent; /* 1 true, <= 0 false */
int is_protected; /* 1 true, <= 0 false */
int size;
int type; /* FIXME: What is this? */
char* channel_uri;
int max_range;
int clamping_dist;
double roll_off;
double max_gain;
int dist_model;
} vx_channel_t;
VIVOXSDK_DLLEXPORT void vx_channel_create(vx_channel_t** channel);
VIVOXSDK_DLLEXPORT void vx_channel_free(vx_channel_t* channel);
typedef vx_channel_t* vx_channel_ref_t;
typedef vx_channel_ref_t* vx_channel_list_t;
VIVOXSDK_DLLEXPORT void vx_channel_list_create(int size, vx_channel_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_channel_list_free(vx_channel_t** list, int size);
/** Channel Favorite struct. */
typedef struct vx_channel_favorite {
int favorite_id;
int favorite_group_id;
char* favorite_display_name;
char* favorite_data;
char* channel_uri;
char* channel_description;
int channel_limit;
int channel_capacity;
char* channel_modified; /* FIXME: What is this? */
char* channel_owner_user_name;
int channel_is_persistent; /* 1 true, <= 0 false */
int channel_is_protected; /* 1 true, <= 0 false */
int channel_size;
} vx_channel_favorite_t;
VIVOXSDK_DLLEXPORT void vx_channel_favorite_create(vx_channel_favorite_t** channel);
VIVOXSDK_DLLEXPORT void vx_channel_favorite_free(vx_channel_favorite_t* channel);
typedef vx_channel_favorite_t* vx_channel_favorite_ref_t;
typedef vx_channel_favorite_ref_t* vx_channel_favorite_list_t;
VIVOXSDK_DLLEXPORT void vx_channel_favorite_list_create(int size, vx_channel_favorite_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_channel_favorite_list_free(vx_channel_favorite_t** list, int size);
/** Channel Favorite Group struct. */
typedef struct vx_channel_favorite_group {
int favorite_group_id;
char* favorite_group_name;
char* favorite_group_data;
char* favorite_group_modified;
} vx_channel_favorite_group_t;
VIVOXSDK_DLLEXPORT void vx_channel_favorite_group_create(vx_channel_favorite_group_t** channel);
VIVOXSDK_DLLEXPORT void vx_channel_favorite_group_free(vx_channel_favorite_group_t* channel);
typedef vx_channel_favorite_group_t* vx_channel_favorite_group_ref_t;
typedef vx_channel_favorite_group_ref_t* vx_channel_favorite_group_list_t;
VIVOXSDK_DLLEXPORT void vx_channel_favorite_group_list_create(int size, vx_channel_favorite_group_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_channel_favorite_group_list_free(vx_channel_favorite_group_t** list, int size);
VIVOXSDK_DLLEXPORT void vx_string_list_create(int size, char *** list_out);
VIVOXSDK_DLLEXPORT void vx_string_list_free(char ** list);
typedef struct vx_block_rule {
char* block_mask;
int presence_only;
} vx_block_rule_t;
VIVOXSDK_DLLEXPORT void vx_block_rule_create(vx_block_rule_t** block_rule);
VIVOXSDK_DLLEXPORT void vx_block_rule_free(vx_block_rule_t* block_rule);
typedef vx_block_rule_t* vx_block_rule_ref_t;
typedef vx_block_rule_ref_t* vx_block_rules_t;
VIVOXSDK_DLLEXPORT void vx_block_rules_create(int size, vx_block_rules_t* list_out);
VIVOXSDK_DLLEXPORT void vx_block_rules_free(vx_block_rule_t** list, int size);
typedef struct vx_auto_accept_rule {
char* auto_accept_mask;
int auto_add_as_buddy;
} vx_auto_accept_rule_t;
VIVOXSDK_DLLEXPORT void vx_auto_accept_rule_create(vx_auto_accept_rule_t** auto_accept_rule);
VIVOXSDK_DLLEXPORT void vx_auto_accept_rule_free(vx_auto_accept_rule_t* auto_accept_rule);
typedef vx_auto_accept_rule_t* vx_auto_accept_rule_ref_t;
typedef vx_auto_accept_rule_ref_t* vx_auto_accept_rules_t;
VIVOXSDK_DLLEXPORT void vx_auto_accept_rules_create(int size, vx_auto_accept_rules_t* list_out);
VIVOXSDK_DLLEXPORT void vx_auto_accept_rules_free(vx_auto_accept_rule_t** list, int size);
typedef struct vx_connectivity_test_result {
ND_TEST_TYPE test_type;
ND_ERROR test_error_code;
char* test_additional_info;
} vx_connectivity_test_result_t;
VIVOXSDK_DLLEXPORT void vx_connectivity_test_result_create(vx_connectivity_test_result_t** connectivity_test_result, ND_TEST_TYPE tt);
VIVOXSDK_DLLEXPORT void vx_connectivity_test_result_free(vx_connectivity_test_result_t* connectivity_test_result);
typedef vx_connectivity_test_result_t* vx_connectivity_test_result_ref_t;
typedef vx_connectivity_test_result_ref_t* vx_connectivity_test_results_t;
VIVOXSDK_DLLEXPORT void vx_connectivity_test_results_create(int size, vx_connectivity_test_results_t* list_out);
VIVOXSDK_DLLEXPORT void vx_connectivity_test_results_free(vx_connectivity_test_result_t** list, int size);
typedef struct vx_account {
char* uri;
char* firstname;
char* lastname;
char* username;
char* displayname;
char* email;
char* phone;
char* carrier;
} vx_account_t;
VIVOXSDK_DLLEXPORT void vx_account_create(vx_account_t** account);
VIVOXSDK_DLLEXPORT void vx_account_free(vx_account_t* account);
typedef struct vx_device {
char* device;
} vx_device_t;
VIVOXSDK_DLLEXPORT void vx_device_create(vx_device_t** device);
VIVOXSDK_DLLEXPORT void vx_device_free(vx_device_t* device);
typedef vx_device_t* vx_device_ref_t;
typedef vx_device_ref_t* vx_devices_t;
VIVOXSDK_DLLEXPORT void vx_devices_create(int size, vx_devices_t* list_out);
VIVOXSDK_DLLEXPORT void vx_devices_free(vx_device_t** list, int size);
typedef struct vx_buddy {
char* buddy_uri;
char* display_name;
int parent_group_id;
char* buddy_data;
} vx_buddy_t;
VIVOXSDK_DLLEXPORT void vx_buddy_create(vx_buddy_t** buddy);
VIVOXSDK_DLLEXPORT void vx_buddy_free(vx_buddy_t* buddy);
typedef vx_buddy_t* vx_buddy_ref_t;
typedef vx_buddy_ref_t* vx_buddy_list_t;
VIVOXSDK_DLLEXPORT void vx_buddy_list_create(int size, vx_buddy_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_buddy_list_free(vx_buddy_t** list, int size);
typedef struct vx_group {
int group_id;
char* group_name;
char* group_data;
} vx_group_t;
VIVOXSDK_DLLEXPORT void vx_group_create(vx_group_t** group);
VIVOXSDK_DLLEXPORT void vx_group_free(vx_group_t* group);
typedef vx_group_t* vx_group_ref_t;
typedef vx_group_ref_t* vx_group_list_t;
VIVOXSDK_DLLEXPORT void vx_group_list_create(int size, vx_group_list_t* list_out);
VIVOXSDK_DLLEXPORT void vx_group_list_free(vx_group_t** list, int size);
/* Vivox SDK functions */
VIVOXSDK_DLLEXPORT char* vx_strdup(const char*);
VIVOXSDK_DLLEXPORT void vx_free(char*);
/**
* The VxSDK polling function. Should be called periodically to check for any incoming events.
*
* @param message [out] The object containing the message data.
* @return Status of the poll, 0 = Success, 1 = Failure, -1 = No Mesasge Available
*/
VIVOXSDK_DLLEXPORT int vx_get_message(vx_message_base_t** message);
/**
* Execute the given request.
*
* @param request The request object to execute. This is of one of the vx_req_* structs.
* @return Success status of the request.
*/
VIVOXSDK_DLLEXPORT int vx_issue_request(vx_req_base_t* request);
/**
* Get the XML for the given request.
*
* @param request The request object.
* @param xml [out] The xml string.
* @return XML string.
*/
VIVOXSDK_DLLEXPORT void vx_request_to_xml(void* request, char** xml);
/**
* Get a request for the given XML string.
*
* @param xml XML string.
* @param request [out] The request struct.
* @param error [out] XML parse error string (if any error occurs). NULL otherwise.
* @return The request struct type. req_none is returned if no struct could be created from the XML.
*/
VIVOXSDK_DLLEXPORT vx_request_type vx_xml_to_request(const char* xml, void** request, char** error=0);
/**
* Get the XML for the given response.
*
* @param response The response object.
* @param xml [out] The xml string.
*/
VIVOXSDK_DLLEXPORT void vx_response_to_xml(void* response, char** xml);
/**
* Get a response for the given XML string.
*
* @param xml XML string.
* @param response [out] The response struct.
* @param error [out] XML parse error string (if any error occurs). NULL otherwise.
* @return The response struct type. resp_none is returned if no struct could be created from the XML.
*/
VIVOXSDK_DLLEXPORT vx_response_type vx_xml_to_response(const char* xml, void** response, char** error = 0);
/**
* Get the XML for the given event.
*
* @param event The event object.
* @param xml [out] The xml string.
*/
VIVOXSDK_DLLEXPORT void vx_event_to_xml(void* event, char** xml);
/**
* Get a event for the given XML string.
*
* @param xml XML string.
* @param event [out] The event struct.
* @param error [out] XML parse error string (if any error occurs). NULL otherwise.
* @return The event struct type. req_none is returned if no struct could be created from the XML.
*/
VIVOXSDK_DLLEXPORT vx_event_type vx_xml_to_event(const char* xml, void** event, char** error = 0);
/**
* Determine whether the XML refers to a request, response, or event.
*/
VIVOXSDK_DLLEXPORT vx_message_type vx_get_message_type(const char* xml);
/**
* Get Millisecond Counter
*/
VIVOXSDK_DLLEXPORT unsigned long long vx_get_time_ms();
/**
* Register a callback that will be called when a message is placed on the queue.
* The application should use this to signal the main application thread that will then wakeup and call vx_get_message;
*/
VIVOXSDK_DLLEXPORT void vx_register_message_notification_handler(void (* pf_handler)(void *), void *cookie);
/**
* Unregister a notification handler
*/
VIVOXSDK_DLLEXPORT void vx_unregister_message_notification_handler(void (* pf_handler)(void *), void *cookie);
VIVOXSDK_DLLEXPORT int vx_create_account(const char* acct_mgmt_server, const char* admin_name, const char* admin_pw, const char* uname, const char* pw);
#ifdef __cplusplus
}
#endif
#endif /* ndef __VXC_H__ */
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/shared/include/OgreMayaCommon.h
|
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_COMMON_H_
#define _OGREMAYA_COMMON_H_
#if defined( _MSC_VER )
// Turn off warnings generated by long std templates
// This warns about truncation to 255 characters in debug/browse info
# pragma warning (disable : 4786)
#endif
namespace OgreMaya {
typedef float Real;
template <typename Iterator>
void deleteAll(Iterator it, Iterator end) {
for(;it!=end; ++it)
delete *it;
}
template <typename Iterator>
bool listEqual(Iterator it1, Iterator it2, Iterator end1, Iterator end2) {
bool eq = true;
while(eq && it1!=end1 && it2!=end2) {
eq = *it1 == *it2;
++it1;
++it2;
}
return
eq && it1==end1 && it2==end2;
}
struct Vector3 {
Real x,y,z;
Vector3(): x(0), y(0), z(0) {}
bool operator ==(const Vector3& other) const {
return x==other.x && y==other.y && z==other.z;
}
Vector3 &operator *=(float mult) {
x = (Real)mult * x;
y = (Real)mult * y;
z = (Real)mult * z;
return *this;
}
};
struct ColourValue {
Real r,g,b,a;
ColourValue(): r(0), g(0), b(0), a(1) {}
bool operator ==(const ColourValue& other) const {
return r==other.r && g==other.g && b==other.b && a==other.a;
}
};
}
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/SessionGroupState.h
|
<filename>lib/Vivox/mvVoice/mvVoiceCBL/SessionGroupState.h
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __SESSIONGROUPSTATE_H
#define __SESSIONGROUPSTATE_H
#include "SessionState.h"
class VxSessionGroup
{
private:
std::string sessionGroupHandle;
std::map<std::string,VxSession*> sessions; //stores session handles and corresponding states
bool IsFirstAudioSession();
public:
VxSessionGroup(std::string session_group_handle);
~VxSessionGroup();
void AddSession(std::string session_handle, std::string uri, int incoming);
void RemoveSession(std::string session_handle);
void UpdateMediaState(std::string session_handle, int state);
void UpdateTextState(std::string session_handle, int state);
std::set<std::string> GetSessionHandles();
VxSession* GetSession(std::string session_handle);
std::string GetSessionGroupHandle();
int GetNumberOfSessions();
void SetSessionsTxValue(bool state);
};
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/analysis.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: single-block PCM analysis mode dispatch
last mod: $Id: analysis.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <ogg/ogg.h>
#include "vorbis/codec.h"
#include "codec_internal.h"
#include "registry.h"
#include "scales.h"
#include "os.h"
#include "misc.h"
int analysis_noisy=1;
/* decides between modes, dispatches to the appropriate mapping. */
int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
int ret,i;
vorbis_block_internal *vbi=vb->internal;
vb->glue_bits=0;
vb->time_bits=0;
vb->floor_bits=0;
vb->res_bits=0;
/* first things first. Make sure encode is ready */
for(i=0;i<PACKETBLOBS;i++)
oggpack_reset(vbi->packetblob[i]);
/* we only have one mapping type (0), and we let the mapping code
itself figure out what soft mode to use. This allows easier
bitrate management */
if((ret=_mapping_P[0]->forward(vb)))
return(ret);
if(op){
if(vorbis_bitrate_managed(vb))
/* The app is using a bitmanaged mode... but not using the
bitrate management interface. */
return(OV_EINVAL);
op->packet=oggpack_get_buffer(&vb->opb);
op->bytes=oggpack_bytes(&vb->opb);
op->b_o_s=0;
op->e_o_s=vb->eofflag;
op->granulepos=vb->granulepos;
op->packetno=vb->sequence; /* for sake of completeness */
}
return(0);
}
/* there was no great place to put this.... */
void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
int j;
FILE *of;
char buffer[80];
/* if(i==5870){*/
sprintf(buffer,"%s_%d.m",base,i);
of=fopen(buffer,"w");
if(!of)perror("failed to open data dump file");
for(j=0;j<n;j++){
if(bark){
float b=toBARK((4000.f*j/n)+.25);
fprintf(of,"%f ",b);
}else
if(off!=0)
fprintf(of,"%f ",(double)(j+off)/8000.);
else
fprintf(of,"%f ",(double)j);
if(dB){
float val;
if(v[j]==0.)
val=-140.;
else
val=todB(v+j);
fprintf(of,"%f\n",val);
}else{
fprintf(of,"%f\n",v[j]);
}
}
fclose(of);
/* } */
}
void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
ogg_int64_t off){
if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/ClientInterfaceEditor/MultiverseInterfaceStudioUI/VsDbgCmd.h
|
// PkgCmdID.h
// Command IDs used in defining command bars
//
#ifndef _VSDBGCMD_H_INCLUDED
#define _VSDBGCMD_H_INCLUDED
#define MULTIPLE_WATCH_WINDOWS 1
///////////////////////////////////////////////////////////////////////////////
// Menu IDs
// menus
#define IDM_DEBUG_MENU 0x0401
#define IDM_DEBUG_WINDOWS 0x0402
#define IDM_STEPINTOSPECIFIC 0x0403
#define IDM_STEP_UNIT 0x0404
#define IDM_MEMORY_WINDOWS 0x0405
#define IDM_BREAKPOINTS_WINDOW_COLUMN_LIST 0x0406
#define IDM_HIDDEN_COMMANDS 0x0407
#ifdef MULTIPLE_WATCH_WINDOWS
#define IDM_WATCH_WINDOWS 0x0408
#endif
#define IDM_DEBUG_TOOLBAR_WINDOWS 0x0409
#define IDM_DEBUGGER_CONTEXT_MENUS 0x0410
#define IDM_EXCEPTIONS 0x0411
#define IDM_BREAKPOINT_SUBMENU 0x0412
#define IDM_DISASM_BREAKPOINT_SUBMENU 0x0413
#define IDM_CALLSTACK_BREAKPOINT_SUBMENU 0x0414
#define IDM_BREAKPOINTS_WINDOW_NEW_LIST 0x0415
#define IDM_NEW_BREAKPOINT_SUBMENU 0x0416
// toolbars
// NOTE: IDM_DEBUG_CONTEXT_TOOLBAR comes before IDM_DEBUG_TOOLBAR
// so that the Debug toolbar will appear to the left of the Debug Location toolbar.
// This uses the fact that the toolbar defined earlier go to the right when on the same line
// (see VS7 bug 295621)
#define IDM_DEBUG_CONTEXT_TOOLBAR 0x0420
#define IDM_DEBUG_TOOLBAR 0x0421
#define IDM_BREAKPOINTS_WINDOW_TOOLBAR 0x0422
#define IDM_DISASM_WINDOW_TOOLBAR 0x0423
#define IDM_ATTACHED_PROCS_TOOLBAR 0x0424
#define IDM_MEMORY_WINDOW_TOOLBAR 0x0430
#define IDM_MEMORY_WINDOW_TOOLBAR1 0x0431
#define IDM_MEMORY_WINDOW_TOOLBAR2 0x0432
#define IDM_MEMORY_WINDOW_TOOLBAR3 0x0433
#define IDM_MEMORY_WINDOW_TOOLBAR4 0x0434
// context menus
#define IDM_WATCH_CONTEXT 0x0500
#define IDM_LOCALS_CONTEXT 0x0501
#define IDM_AUTOS_CONTEXT 0x0502
#define IDM_THREADS_CONTEXT 0x0503
#define IDM_CALLSTACK_CONTEXT 0x0504
#define IDM_DISASM_CONTEXT 0x0505
#define IDM_BREAKPOINTS_WINDOW_CONTEXT 0x0506
#define IDM_MEMORY_CONTEXT 0x0507
#define IDM_REGISTERS_CONTEXT 0x0508
#define IDM_MODULES_CONTEXT 0x0509
#define IDM_DATATIP_CONTEXT 0x050A
#define IDM_ATTACHED_PROCS_CONTEXT 0x050B
#define IDM_BREAKPOINT_CONTEXT 0x050C
#define IDM_CONSOLE_CONTEXT 0x050D
#define IDM_OUTPUT_CONTEXT 0x050E
#define IDM_SCRIPT_PROJECT_CONTEXT 0x050F
#define IDM_THREADTIP_CONTEXT 0x0510
#define IDM_THREAD_IP_MARKER_CONTEXT 0x0511
#define IDM_THREAD_IP_MARKERS_CONTEXT 0x0512
///////////////////////////////////////////////////////////////////////////////
// Menu Group IDs
#define IDG_DEBUG_MENU 0x0001
#define IDG_DEBUG_WINDOWS_GENERAL 0x0002
#define IDG_DEBUG_TOOLBAR 0x0003
#define IDG_EXECUTION 0x0004
#define IDG_STEPPING 0x0005
#define IDG_WATCH 0x0006
#define IDG_BREAKPOINTS 0x0007
#define IDG_HIDDEN_COMMANDS 0x0008
#define IDG_WINDOWS 0x0009
#define IDG_STEPINTOSPECIFIC 0x000A
#define IDG_VARIABLES 0x000B
#define IDG_WATCH_EDIT 0x000C
#define IDG_THREAD_CONTROL 0x000F
#define IDG_DEBUG_DISPLAY 0x0010
#define IDG_DEBUG_TOOLBAR_STEPPING 0x0011
#define IDG_DEBUGGER_CONTEXT_MENUS 0x0012
#define IDG_MEMORY_WINDOWS 0x0013
#define IDG_DISASM_NAVIGATION 0x0014
#define IDG_DISASM_BREAKPOINTS 0x0015
#define IDG_DISASM_EXECUTION 0x0016
#define IDG_DISASM_DISPLAY 0x0017
#define IDG_BREAKPOINTS_WINDOW_NEW 0x0018
#define IDG_BREAKPOINTS_WINDOW_DELETE 0x0019
#define IDG_BREAKPOINTS_WINDOW_ALL 0x001A
#define IDG_BREAKPOINTS_WINDOW_VIEW 0x001B
#define IDG_BREAKPOINTS_WINDOW_EDIT 0x001C
#define IDG_BREAKPOINTS_WINDOW_COLUMNS 0x001D
#define IDG_BREAKPOINTS_WINDOW_COLUMN_LIST 0x001E
#define IDG_BREAKPOINTS_WINDOW_NEW_LIST 0x001F
#define IDG_BREAKPOINTS_WINDOW_PROPERTIES_LIST 0x0020
#define IDG_NEW_BREAKPOINT_SUBMENU 0x0021
#define IDG_PROGRAM_TO_DEBUG 0x0024
#define IDG_DEBUG_TOOLBAR_WATCH 0x0025
#define IDG_ADDWATCH_CODEWIN 0x0026
#define IDG_DEBUG_CONTEXT_TOOLBAR 0x0027
#define IDG_DISASM_WINDOW_TOOLBAR 0x0028
#define IDG_MEMORY_FORMAT 0x0100
#define IDG_MEMORY_INT_FORMAT 0x0101
#define IDG_MEMORY_FLT_FORMAT 0x0102
#define IDG_MEMORY_TEXT 0x0103
#define IDG_MEMORY_MISC 0x0104
#define IDG_MEMORY_TOOLBAR 0x0105
#define IDG_REGISTERS_GROUPS 0x0108
#define IDG_REGISTERS_EDIT 0x0109
#define IDG_CUSTOMIZABLE_CONTEXT_MENU_COMMANDS 0x0110
#define IDG_CALLSTACK_COPY 0x0111
#define IDG_CALLSTACK_NAVIGATE 0x0112
#define IDG_CALLSTACK_BREAKPOINTS 0x0113
#define IDG_CALLSTACK_DISPLAY 0x0114
#define IDG_CALLSTACK_OPTIONS 0x0115
#define IDG_DEBUG_WINDOWS_INSPECT 0x0116
#define IDG_DEBUG_WINDOWS_CONTEXT 0x0117
#define IDG_DEBUG_WINDOWS_DISASM 0x0118
#define IDG_CRASHDUMP 0x0119
#define IDG_DEBUG_TOOLBAR_WINDOWS 0x011A
#define IDG_DEBUG_TOOLBAR_EXECUTION 0x011B
#define IDG_THREAD_COPY 0x011C
#define IDG_TOOLS_DEBUG 0x011D
#define IDG_STEP_UNIT 0x011E
#ifdef MULTIPLE_WATCH_WINDOWS
#define IDG_WATCH_WINDOWS 0x011F
#endif
#define IDG_CALLSTACK_SYMBOLS 0x0120
#define IDG_MODULES_COPY 0x0121
#define IDG_MODULES_SYMBOLS 0x0122
#define IDG_MODULES_DISPLAY 0x0123
#define IDG_DATATIP_WATCH 0x0124
#define IDG_DATATIP_VISIBILITY 0x0125
#define IDG_ATTACHED_PROCS_COPY 0x0126
#define IDG_ATTACHED_PROCS_EXECCNTRL 0x0127
#define IDG_ATTACHED_PROCS_ADDBP 0x0128
#define IDG_ATTACHED_PROCS_ATTACH 0x0129
#define IDG_ATTACHED_PROCS_COLUMNS 0x0130
#define IDG_ATTACHED_PROCS_DETACHONSTOP 0x0131
#define IDG_DEBUG_CONSOLE 0x0132
#define IDG_MODULES_JMC 0x0133
#define IDG_EXCEPTIONS_GENERAL 0x0134
#define IDG_EXCEPTIONS_SPECIFIC 0x0135
#define IDG_BREAKPOINT_CONTEXT_ADD_DELETE 0x0136
#define IDG_BREAKPOINT_CONTEXT_MODIFY 0x0137
#define IDG_ATTACHED_PROCS_STEPPING 0x0138
#define IDG_CONSOLE_CONTEXT 0x0139
#define IDG_DATATIP_CLIPBOARD 0x013A
#define IDG_ATTACHED_PROCS_EXECCNTRL2 0x013B
#define IDG_OUTPUT_CONTEXT 0x013C
#define IDG_SINGLEPROC_EXECUTION 0x013D
#define IDG_THREAD_FLAGGING 0x013E
#define IDG_THREADTIP_WATCH 0x013f
#define IDG_THREADTIP_CLIPBOARD 0x0140
#define IDG_THREAD_IP_MARKER_CONTEXT 0x0141
#define IDG_THREAD_IP_MARKERS_CONTEXT 0x0142
#define IDG_THREAD_IP_MARKERS_SWITCHCONTEXT 0x0143
#define IDG_THREAD_IP_MARKERS_FLAG 0x0144
#define IDG_THREAD_IP_MARKERS_UNFLAG 0x0145
#define IDG_DEBUG_CONTEXT_TOGGLE_SUBGROUP 0x0146
#define IDG_DEBUG_CONTEXT_STACKFRAME_SUBGROUP 0x0147
// Call out memory window instances separately for multiple toolbar support
#define IDG_MEMORY_EXPRESSION1 0x0201
#define IDG_MEMORY_EXPRESSION2 0x0202
#define IDG_MEMORY_EXPRESSION3 0x0203
#define IDG_MEMORY_EXPRESSION4 0x0204
#define IDG_MEMORY_COLUMNS1 0x0211
#define IDG_MEMORY_COLUMNS2 0x0212
#define IDG_MEMORY_COLUMNS3 0x0213
#define IDG_MEMORY_COLUMNS4 0x0214
// this group is for commands that are available in the command window,
// but are not on any menus by default
#define IDG_COMMAND_WINDOW 0x0300
///////////////////////////////////////////////////////////////////////////////
// Indexes into bitmaps (image wells)
// DbgIcons.bmp
#define IDBI_THREADS 1
#define IDBI_RUNNING_DOCS 2
#define IDBI_EXECUTE 3
#define IDBI_BREAKPOINTS_WINDOW 4
#define IDBI_ATTACH_TO_PROCESS 5
#define IDBI_EXCEPTIONS 6
#define IDBI_ENABLE_BREAKPOINT 7
#define IDBI_STACK 8
#define IDBI_LOCALS 9
#define IDBI_AUTOS 10
#define IDBI_DETACH 11
#define IDBI_DISASM 12
#define IDBI_MEMORY 13
#define IDBI_REGISTERS 14
#define IDBI_WATCH 15
#define IDBI_MODULES 16
#define IDBI_CONSOLE_WINDOW 17
#define IDBI_BREAKPOINT 18
#define IDBI_VIEW_BREAKPOINT 19
#define IDBI_AUTO_REEVALUATE 20
#define IDBI_PROCESSES 21
#define IDBI_GO_TO_SOURCE 22
#define IDBI_GO_TO_DISASSEMBLY 23
#define IDBI_APPLY_CODE_CHANGES 24
#define IDBI_STOP_APPLY_CODE_CHANGES 25
#define IDBI_BREAKPOINT_PROPERTIES 26
#define IDBI_DELETE_ALL_BREAKPOINTS 27
#define IDBI_DISABLE_ALL_BREAKPOINTS 28
#define IDBI_ENABLE_ALL_BREAKPOINTS 29
#define IDBI_TOGGLE_ALL_BREAKPOINTS 30
#define IDBI_DELETE 31
#define IDBI_UP 32
#define IDBI_DOWN 33
#define IDBI_NEWFOLDER 34
#define IDBI_REFRESH 35
#define IDBI_TERMINATE_PROCESS 36
#define IDBI_DELETE_BREAKPOINT 37
#define IDBI_FLAG 38
#define IDBI_TOGGLE_FLAG 39
#define IDBI_TOGGLE_THREAD_IPS 40
// DbgToolwindowIcons.bmp
#define IDBI_TW_THREADS 1
#define IDBI_TW_RUNNING_DOCS 2
#define IDBI_TW_INSERT_BREAKPOINT 3
#define IDBI_TW_STACK 4
#define IDBI_TW_LOCALS 5
#define IDBI_TW_AUTOS 6
#define IDBI_TW_DISASM 7
#define IDBI_TW_MEMORY 8
#define IDBI_TW_REGISTERS 9
#define IDBI_TW_WATCH 10
#define IDBI_TW_MODULES 11
#define IDBI_TW_CONSOLE_WINDOW 12
#define IDBI_TW_PROCESSES 13
#define IDBI_MAX 13
///////////////////////////////////////////////////////////////////////////////
// Command IDs
// Unfortunately several debugger cmdid's found in vs\src\common\inc\stdidcmd.h
// cannot be moved into this file for backward compatibility reasons.
// Otherwise, all V7 debugger cmdid's should be defined in here.
///////////////////////////////////////////////////////////////////////////////
// IMPORTANT: Our implementation of multiple-instance toolwindows make use of
// the high-end byte of the cmdid's to store instance information. Do not use
// this byte unless you are implementing a multiple-instance toolwindow.
///////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
inline DWORD DBGCMDID_STRIP(DWORD cmdid)
{
return cmdid & 0x00ffffff;
}
inline long DBGCMDID_TOOLWINDOW_ID(DWORD cmdid)
{
return (cmdid >> 24) & 0x000000ff;
}
#endif
// General debugger commands
#define cmdidDebuggerFirst 0x00000000
#define cmdidDebuggerLast 0x00000fff
#define cmdidBreakpointsWindowShow 0x00000100
#define cmdidDisasmWindowShow 0x00000101
#define cmdidProgramToDebugShow 0x00000102
#define cmdidRegisterWindowShow 0x00000103
#define cmdidModulesWindowShow 0x00000104
#define cmdidApplyCodeChanges 0x00000105
#define cmdidStopApplyCodeChanges 0x00000106
#define cmdidGoToDisassembly 0x00000107
#define cmdidShowDebugOutput 0x00000108
#define cmdidStepUnitLine 0x00000110
#define cmdidStepUnitStatement 0x00000111
#define cmdidStepUnitInstruction 0x00000112
#define cmdidStepUnitList 0x00000113
#define cmdidStepUnitListEnum 0x00000114
#define cmdidWriteCrashDump 0x00000115
#define cmdidProcessList 0x00000116
#define cmdidProcessListEnum 0x00000117
#define cmdidThreadList 0x00000118
#define cmdidThreadListEnum 0x00000119
#define cmdidStackFrameList 0x00000120
#define cmdidStackFrameListEnum 0x00000121
#define cmdidDisableAllBreakpoints 0x00000122
#define cmdidEnableAllBreakpoints 0x00000123
#define cmdidToggleAllBreakpoints 0x00000124
#define cmdidTerminateAll 0x00000125
#define cmdidSymbolOptions 0x00000126
#define cmdidLoadSymbols 0x00000127
#define cmdidSymbolLoadInfo 0x00000128
#define cmdidStopEvaluatingExpression 0x00000129
#define cmdidAttachedProcsWindowShow 0x00000131
#define cmdidToggleFlaggedThreads 0x00000132
#define cmdidThreadFlag 0x00000133
#define cmdidThreadUnflag 0x00000134
#define cmdidJustMyCode 0x00000135
#define cmdidNewFileBreakpoint 0x00000136
#define cmdidNewFunctionBreakpoint 0x00000137
#define cmdidNewAddressBreakpoint 0x00000138
#define cmdidNewDataBreakpoint 0x00000139
#define cmdidThreadUnflagAll 0x00000040
#define cmdidInsertTracepoint 0x00000041
#define cmdidBreakpointLocation 0x00000142
#define cmdidBreakpointCondition 0x00000143
#define cmdidBreakpointHitCount 0x00000144
#define cmdidBreakpointConstraints 0x00000145
#define cmdidBreakpointAction 0x00000146
#define cmdidCreateObjectID 0x00000147
#define cmdidRunMacrosForBreakpointsJustHit 0x00000148
#define cmdidCopyExpression 0x00000149
#define cmdidCopyValue 0x0000014A
#define cmdidDestroyObjectID 0x0000014B
#define cmdidOutputOnException 0x00000150
#define cmdidOutputOnModuleLoad 0x00000151
#define cmdidOutputOnModuleUnload 0x00000152
#define cmdidOutputOnProcessDestroy 0x00000153
#define cmdidOutputOnThreadDestroy 0x00000154
#define cmdidOutputOnOutputDebugString 0x00000155
#define cmdidSingleProcStepInto 0x00000156
#define cmdidSingleProcStepOver 0x00000157
#define cmdidSingleProcStepOut 0x00000158
#define cmdidToggleCurrentThreadFlag 0x00000159
#define cmdidShowThreadIpIndicators 0x0000015A
// See above for explanation of these constants...
#define cmdidMemoryWindowShow 0x00000200
#define cmdidMemoryWindowShow1 0x01000200
#define cmdidMemoryWindowShow2 0x02000200
#define cmdidMemoryWindowShow3 0x03000200
#define cmdidMemoryWindowShow4 0x04000200
#define cmdidWatchWindowShow 0x00000300
#define cmdidWatchWindowShow1 0x01000300
#define cmdidWatchWindowShow2 0x02000300
#define cmdidWatchWindowShow3 0x03000300
#define cmdidWatchWindowShow4 0x04000300
// Breakpoint Window commands
#define cmdidBreakpointsWindowFirst 0x00001000
#define cmdidBreakpointsWindowLast 0x00001fff
#define cmdidBreakpointsWindowNewBreakpoint 0x00001001 // deprecated
#define cmdidBreakpointsWindowNewGroup 0x00001002
#define cmdidBreakpointsWindowDelete 0x00001003
#define cmdidBreakpointsWindowProperties 0x00001004 // deprecated
#define cmdidBreakpointsWindowDefaultGroup 0x00001005
#define cmdidBreakpointsWindowGoToSource 0x00001006
#define cmdidBreakpointsWindowGoToDisassembly 0x00001007
#define cmdidBreakpointsWindowGoToBreakpoint 0x00001008
#define cmdidBreakpointsWindowColumnName 0x00001100
#define cmdidBreakpointsWindowColumnCondition 0x00001101
#define cmdidBreakpointsWindowColumnHitCount 0x00001102
#define cmdidBreakpointsWindowColumnLanguage 0x00001103
#define cmdidBreakpointsWindowColumnFunction 0x00001104
#define cmdidBreakpointsWindowColumnFile 0x00001105
#define cmdidBreakpointsWindowColumnAddress 0x00001106
#define cmdidBreakpointsWindowColumnData 0x00001107
#define cmdidBreakpointsWindowColumnProcess 0x00001108
#define cmdidBreakpointsWindowColumnConstraints 0x00001109
#define cmdidBreakpointsWindowColumnAction 0x0000110A
// Disassembly Window commands
#define cmdidDisasmWindowFirst 0x00002000
#define cmdidDisasmWindowLast 0x00002fff
#define cmdidGoToSource 0x00002001
#define cmdidShowDisasmAddress 0x00002002
#define cmdidShowDisasmSource 0x00002003
#define cmdidShowDisasmCodeBytes 0x00002004
#define cmdidShowDisasmSymbolNames 0x00002005
#define cmdidShowDisasmLineNumbers 0x00002006
#define cmdidShowDisasmToolbar 0x00002007
#define cmdidDisasmExpression 0x00002008
#define cmdidToggleDisassembly 0x00002009
// Memory Window commands
#define cmdidMemoryWindowFirst 0x00003000
#define cmdidMemoryWindowLast 0x00003fff
// The following are specific to each instance of the memory window. The high-end
// byte is critical for proper operation of these commands. The high-byte indicates
// the particular toolwindow that this cmdid applies to. You can change the
// lowest 3 bytes to be whatever you want.
// The first constant in each group marks a cmdid representing the entire group.
// We use this constant inside our switch statements so as to not have to list
// out each separate instance of cmdid.
#define cmdidMemoryExpression 0x00003001
#define cmdidMemoryExpression1 0x01003001
#define cmdidMemoryExpression2 0x02003001
#define cmdidMemoryExpression3 0x03003001
#define cmdidMemoryExpression4 0x04003001
#define cmdidAutoReevaluate 0x00003002
#define cmdidAutoReevaluate1 0x01003002
#define cmdidAutoReevaluate2 0x02003002
#define cmdidAutoReevaluate3 0x03003002
#define cmdidAutoReevaluate4 0x04003002
#define cmdidMemoryColumns 0x00003003
#define cmdidMemoryColumns1 0x01003003
#define cmdidMemoryColumns2 0x02003003
#define cmdidMemoryColumns3 0x03003003
#define cmdidMemoryColumns4 0x04003003
#define cmdidColCountList 0x00003004
#define cmdidColCountList1 0x01003004
#define cmdidColCountList2 0x02003004
#define cmdidColCountList3 0x03003004
#define cmdidColCountList4 0x04003004
// The following apply to all instances of the memory windows. If any of these
// are added to the toolbar, they must be made per-instance!
#define cmdidShowNoData 0x00003011
#define cmdidOneByteInt 0x00003012
#define cmdidTwoByteInt 0x00003013
#define cmdidFourByteInt 0x00003014
#define cmdidEightByteInt 0x00003015
#define cmdidFloat 0x00003020
#define cmdidDouble 0x00003021
#define cmdidFormatHex 0x00003030
#define cmdidFormatSigned 0x00003031
#define cmdidFormatUnsigned 0x00003032
#define cmdidFormatBigEndian 0x00003033
#define cmdidShowNoText 0x00003040
#define cmdidShowAnsiText 0x00003041
#define cmdidShowUnicodeText 0x00003042
#define cmdidEditValue 0x00003050
#define cmdidShowToolbar 0x00003062
// MemoryView-specific commands. These are used internally by the MemoryView implementation.
#define cmdidStopInPlaceEdit 0x00003100
// Registers Window commands
#define cmdidRegisterWindowFirst 0x00004000
#define cmdidRegWinGroupFirst 0x00004001
#define cmdidRegWinGroupLast 0x00004100
#define cmdidRegisterWindowLast 0x00004fff
// QuickWatch commands
#define cmdidQuickWatchFirst 0x00005000
#define cmdidQuickWatchLast 0x00005fff
// Debug Context toolbar commands
//#define cmdidDebugContextFirst 0x00006000
//#define cmdidDebugContextLast 0x00006fff
// Modules Window commands
#define cmdidModulesWindowFirst 0x00007000
#define cmdidModulesWindowLast 0x00007100
#define cmdidReloadSymbols 0x00007001 // deprecated
#define cmdidShowAllModules 0x00007002
#define cmdidToggleUserCode 0x00007003
// step into specific
#define cmdidStepIntoSpecificFirst 0x00007200
#define cmdidStepIntoSpecificLast 0x00007FFF
// Call Stack commands
#define cmdidCallStackWindowFirst 0x00008000
#define cmdidCallStackWindowLast 0x00008fff
#define cmdidSetCurrentFrame 0x00008001
#define cmdidCallStackValues 0x00008002
#define cmdidCallStackTypes 0x00008003
#define cmdidCallStackNames 0x00008004
#define cmdidCallStackModules 0x00008005
#define cmdidCallStackLineOffset 0x00008006
#define cmdidCallStackByteOffset 0x00008007
#define cmdidCrossThreadCallStack 0x00008008
#define cmdidShowExternalCode 0x00008009
#define cmdidUnwindFromException 0x0000800a
// Datatip commands
#define cmdidDatatipFirst 0x00009000
#define cmdidDatatipLast 0x00009fff
#define cmdidDatatipNoTransparency 0x00009010
#define cmdidDatatipLowTransparency 0x00009011
#define cmdidDatatipMedTransparency 0x00009012
#define cmdidDatatipHighTransparency 0x00009013
// Attached Processes Window commands
#define cmdidAttachedProcsWindowFirst 0x0000a000
#define cmdidAttachedProcsWindowLast 0x0000a100
#define cmdidAttachedProcsStartProcess 0x0000a001
#define cmdidAttachedProcsPauseProcess 0x0000a002
#define cmdidAttachedProcsStepIntoProcess 0x0000a003
#define cmdidAttachedProcsStepOverProcess 0x0000a004
#define cmdidAttachedProcsStepOutProcess 0x0000a005
#define cmdidAttachedProcsDetachProcess 0x0000a006
#define cmdidAttachedProcsTerminateProcess 0x0000a007
#define cmdidAttachedProcsDetachOnStop 0x0000a008
#define cmdidAttachedProcsColumnName 0x0000a010
#define cmdidAttachedProcsColumnID 0x0000a011
#define cmdidAttachedProcsColumnPath 0x0000a012
#define cmdidAttachedProcsColumnTitle 0x0000a013
#define cmdidAttachedProcsColumnMachine 0x0000a014
#define cmdidAttachedProcsColumnState 0x0000a015
#define cmdidAttachedProcsColumnTransport 0x0000a016
#define cmdidAttachedProcsColumnTransportQualifier 0x0000a017
#define cmdidThreadIpMarkerSwitchContext 0x0000a018
#define cmdidThreadIpMarkerFlagUnflag 0x0000a019
#define cmdidThreadIpMarkersSwitchContext 0x0000b000
#define cmdidThreadIpMarkersSwitchContextFirst 0x0000b001
#define cmdidThreadIpMarkersSwitchContextLast 0x0000bfff
#define cmdidThreadIpMarkersFlag 0x0000c000
#define cmdidThreadIpMarkersFlagFirst 0x0000c001
#define cmdidThreadIpMarkersFlagLast 0x0000cfff
#define cmdidThreadIpMarkersUnflag 0x0000d000
#define cmdidThreadIpMarkersUnflagFirst 0x0000d001
#define cmdidThreadIpMarkersUnflagLast 0x0000dfff
// Command Window commands
// while all commands are available in the command window,
// these are not on any menus by default
//
#define cmdidCommandWindowFirst 0x0000f000
#define cmdidCommandWindowLast 0x0000ffff
#define cmdidListMemory 0x0000f001
#define cmdidListCallStack 0x0000f002
#define cmdidListDisassembly 0x0000f003
#define cmdidListRegisters 0x0000f004
// unused 0x0000f005
#define cmdidListThreads 0x0000f006
#define cmdidSetRadix 0x0000f007
// unused 0x0000f008
#define cmdidSetCurrentThread 0x0000f009
#define cmdidSetCurrentStackFrame 0x0000f00a
#define cmdidListSource 0x0000f00b
#define cmdidSymbolPath 0x0000f00c
#define cmdidListModules 0x0000f00d
#define cmdidListProcesses 0x0000f00e
#define cmdidSetCurrentProcess 0x0000f00f
#endif // _VSDBGCMD_H_INCLUDED
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/VxcEvents.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __VXCEVENTS_H__
#define __VXCEVENTS_H__
#include "Vxc.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Begin Vivox events */
//DEPRECATED
typedef struct vx_evt_login_state_change {
vx_evt_base base;
vx_login_state_change_state state;
VX_HANDLE account_handle;
int status_code;
char* status_string;
} vx_evt_login_state_change_t;
VIVOXSDK_DLLEXPORT void vx_evt_login_state_change_free(vx_evt_login_state_change_t * evt);
typedef struct vx_evt_account_login_state_change {
vx_evt_base base;
vx_login_state_change_state state;
VX_HANDLE account_handle;
int status_code;
char* status_string;
} vx_evt_account_login_state_change_t;
VIVOXSDK_DLLEXPORT void vx_evt_account_login_state_change_free(vx_evt_account_login_state_change_t * evt);
//DEPRECATED
typedef struct vx_evt_session_new {
vx_evt_base base;
vx_session_new_state state;
VX_HANDLE account_handle;
VX_HANDLE session_handle;
char* uri;
char* name;
int is_channel; /* 1 true, <= 0 false */
char* audio_media; /* FIXME */
int has_text;
int has_audio;
int has_video;
} vx_evt_session_new_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_new_free(vx_evt_session_new_t * evt);
//DEPRECATED
typedef struct vx_evt_session_state_change {
vx_evt_base base;
vx_session_state_change_state state;
VX_HANDLE session_handle;
int status_code;
char* status_string;
char* uri;
int is_channel;
char* channel_name;
} vx_evt_session_state_change_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_state_change_free(vx_evt_session_state_change_t * evt);
//DEPRECATED
typedef struct vx_evt_participant_state_change {
vx_evt_base base;
vx_participant_state_change_state state;
VX_HANDLE session_handle;
int status_code;
char* status_string;
char* participant_uri;
char* account_name;
int participant_type;
} vx_evt_participant_state_change_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_state_change_free(vx_evt_participant_state_change_t * evt);
//DEPRECATED
typedef struct vx_evt_participant_properties {
vx_evt_base base;
vx_participant_properties_state state;
VX_HANDLE session_handle;
char* participant_uri;
int is_moderator_muted;
int is_locally_muted;
int is_speaking;
int volume;
double energy;
} vx_evt_participant_properties_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_properties_free(vx_evt_participant_properties_t * evt);
typedef struct vx_evt_buddy_presence {
vx_evt_base base;
vx_buddy_presence_state state;
VX_HANDLE account_handle;
char* buddy_uri;
vx_buddy_presence_state presence;
char* custom_message;
} vx_evt_buddy_presence_t;
VIVOXSDK_DLLEXPORT void vx_evt_buddy_presence_free(vx_evt_buddy_presence_t * evt);
typedef struct vx_evt_subscription {
vx_evt_base base;
vx_subscription_state state;
VX_HANDLE account_handle;
char* buddy_uri;
char* subscription_handle;
vx_subscription_type subscription_type;
} vx_evt_subscription_t;
VIVOXSDK_DLLEXPORT void vx_evt_subscription_free(vx_evt_subscription_t * evt);
typedef struct vx_evt_session_notification {
vx_evt_base base;
vx_session_notification_state state;
VX_HANDLE session_handle;
char* participant_uri;
vx_notification_type notification_type;
} vx_evt_session_notification_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_notification_free(vx_evt_session_notification_t * evt);
typedef struct vx_evt_message {
vx_evt_base base;
vx_message_state state;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
char* participant_uri;
char* message_header;
char* message_body;
} vx_evt_message_t;
VIVOXSDK_DLLEXPORT void vx_evt_message_free(vx_evt_message_t * evt);
typedef struct vx_evt_aux_audio_properties {
vx_evt_base base;
vx_aux_audio_properties_state state;
int mic_is_active;
int mic_volume;
double mic_energy;
int speaker_volume;
} vx_evt_aux_audio_properties_t;
VIVOXSDK_DLLEXPORT void vx_evt_aux_audio_properties_free(vx_evt_aux_audio_properties_t * evt);
//DEPRECATED
typedef struct vx_evt_participant_list {
vx_evt_base base;
vx_participant_list_state state;
VX_HANDLE session_handle;
int participants_size;
vx_participant_t** participants;
} vx_evt_participant_list_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_list_free(vx_evt_participant_list_t * evt);
typedef struct vx_evt_session_participant_list {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
int participants_size;
vx_participant_t** participants;
} vx_evt_session_participant_list_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_participant_list_free(vx_evt_session_participant_list_t * evt);
//DEPRECATED
typedef struct vx_evt_session_media {
vx_evt_base base;
vx_session_media_state state;
VX_HANDLE session_handle;
int has_text;
int has_audio;
int has_video;
bool terminated;
} vx_evt_session_media_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_media_free(vx_evt_session_media_t * evt);
typedef enum {
change_type_set = 1,
change_type_delete = 2,
} vx_change_type_t;
typedef struct vx_evt_buddy_changed {
vx_evt_base base;
VX_HANDLE account_handle;
vx_change_type_t change_type;
char *buddy_uri;
char *display_name;
char *buddy_data;
int group_id;
} vx_evt_buddy_changed_t;
VIVOXSDK_DLLEXPORT void vx_evt_buddy_changed_free(vx_evt_buddy_changed * evt);
typedef struct vx_evt_buddy_group_changed {
vx_evt_base base;
VX_HANDLE account_handle;
vx_change_type_t change_type;
int group_id;
char *group_name;
char *group_data;
} vx_evt_buddy_group_changed_t;
VIVOXSDK_DLLEXPORT void vx_evt_buddy_group_changed_free(vx_evt_buddy_group_changed * evt);
typedef struct {
vx_evt_base base;
VX_HANDLE account_handle;
int buddy_count;
vx_buddy_t **buddies;
int group_count;
vx_group_t **groups;
} vx_evt_buddy_and_group_list_changed_t;
VIVOXSDK_DLLEXPORT void vx_evt_buddy_and_group_list_changed_free(vx_evt_buddy_and_group_list_changed_t * evt);
typedef struct vx_evt_keyboard_mouse {
vx_evt_base base;
char *name;
int is_down;
} vx_evt_keyboard_mouse_t;
VIVOXSDK_DLLEXPORT void vx_evt_keyboard_mouse_free(vx_evt_keyboard_mouse_t * evt);
typedef struct vx_evt_idle_state_changed {
vx_evt_base base;
int is_idle;
} vx_evt_idle_state_changed_t;
VIVOXSDK_DLLEXPORT void vx_evt_idle_state_changed_free(vx_evt_idle_state_changed_t * evt);
typedef struct vx_evt_media_stream_updated {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
int status_code;
char* status_string;
vx_session_media_state state;
int incoming;
} vx_evt_media_stream_updated_t;
VIVOXSDK_DLLEXPORT void vx_evt_media_stream_updated_free(vx_evt_media_stream_updated_t * evt);
typedef struct vx_evt_text_stream_updated {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
int enabled;
vx_session_text_state state;
int incoming;
} vx_evt_text_stream_updated_t;
VIVOXSDK_DLLEXPORT void vx_evt_text_stream_updated_free(vx_evt_text_stream_updated_t * evt);
typedef struct vx_evt_sessiongroup_added {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
} vx_evt_sessiongroup_added_t;
VIVOXSDK_DLLEXPORT void vx_evt_sessiongroup_added_free(vx_evt_sessiongroup_added_t * evt);
typedef struct vx_evt_sessiongroup_removed {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
} vx_evt_sessiongroup_removed_t;
VIVOXSDK_DLLEXPORT void vx_evt_sessiongroup_removed_free(vx_evt_sessiongroup_removed_t * evt);
typedef struct vx_evt_session_added {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
char* uri;
int is_channel;
int incoming;
char* channel_name;
} vx_evt_session_added_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_added_free(vx_evt_session_added_t * evt);
typedef struct vx_evt_session_removed {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
} vx_evt_session_removed_t;
VIVOXSDK_DLLEXPORT void vx_evt_session_removed_free(vx_evt_session_removed_t * evt);
typedef struct vx_evt_participant_added {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
char* participant_uri;
char* account_name;
char* display_name;
int participant_type;
} vx_evt_participant_added_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_added_free(vx_evt_participant_added_t * evt);
typedef struct vx_evt_participant_removed {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
char* participant_uri;
char* account_name;
} vx_evt_participant_removed_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_removed_free(vx_evt_participant_removed_t * evt);
typedef struct vx_evt_participant_updated {
vx_evt_base base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
char* participant_uri;
int is_moderator_muted;
int is_speaking;
int volume;
double energy;
} vx_evt_participant_updated_t;
VIVOXSDK_DLLEXPORT void vx_evt_participant_updated_free(vx_evt_participant_updated_t * evt);
/* End Vivox events */
void VIVOXSDK_DLLEXPORT destroy_evt(vx_evt_base_t *pCmd);
#ifdef __cplusplus
}
#endif
#endif /* ndef __VXCEVENTS_H__ */
|
AustralianDisabilityLimited/MultiversePlatform
|
server/src/native/fadvise.c
|
#include <errno.h> /* errno */
#include <fcntl.h> /* fcntl, open */
#include <stdio.h> /* perror, fprintf, stderr, printf */
#include <stdlib.h> /* exit, calloc, free */
#include <string.h> /* strerror */
#include <sys/stat.h> /* stat, fstat */
#include <sys/types.h> /* size_t */
#include <unistd.h> /* sysconf, close */
main(int argc, char* argv[])
{
int fd, rc, ii, arg;
int advise = POSIX_FADV_DONTNEED;
for (arg = 1; arg < argc; arg++) {
if (argv[arg][0] != '-')
break;
if (strcmp(argv[arg], "--sequential") == 0)
advise = POSIX_FADV_SEQUENTIAL;
else if (strcmp(argv[arg], "--random") == 0)
advise = POSIX_FADV_RANDOM;
else if (strcmp(argv[arg], "--willneed") == 0)
advise = POSIX_FADV_WILLNEED;
else if (strcmp(argv[arg], "--dontneed") == 0)
advise = POSIX_FADV_DONTNEED;
else if (strcmp(argv[arg], "--normal") == 0)
advise = POSIX_FADV_NORMAL;
else
fprintf(stderr, "Unknown option '%s'\n", argv[arg]);
}
for (ii = arg; ii < argc; ii++) {
fd = open(argv[ii], O_RDONLY);
if (fd == -1) {
perror(argv[ii]);
continue;
}
fsync(fd);
rc = posix_fadvise(fd, 0, 0, advise);
if (rc != 0)
perror("posix_fadvise");
close(fd);
}
return 0;
}
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/maya2ogre/include/OgreMayaScene.h
|
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_SCENE_H_
#define _OGREMAYA_SCENE_H_
#include "OgreMayaCommon.h"
#include <maya/MString.h>
#include <string>
namespace OgreMaya {
// using namespace std;
// ===========================================================================
/** \class SceneMgr
\author <NAME>, Fifty1 Software Inc.
\version 1.0
\date June 2003
Loads and unloads a Maya scene for non-plugin exporters. Initializes the
Maya library if required on the first load, and cleans up the Maya library
in the destructor.
*/
// ===========================================================================
class SceneMgr {
public:
/// Constructor.
SceneMgr();
/// Destructor.
virtual ~SceneMgr();
/// Load the Maya scene file defined in the options (initializes Maya library first if required)
bool load();
protected:
bool mbInitialized;
};
}
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/BridgeInterface/MessageException.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform<filename>lib/BridgeInterface/BridgeInterface/MessageException.h<gh_stars>10-100
#pragma once
class __declspec(dllexport) MessageException {
private:
std::string msg;
public:
MessageException(const char *message) {
msg = message;
}
MessageException(const MessageException &other) {
if (&other != this)
msg = other.msg;
}
const std::string Message() const {
return msg;
}
};
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/exporter/include/MayaGetFolder.h
|
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _MAYAGETFOLDER_H_
#define _MAYAGETFOLDER_H_
#include <maya/MPxCommand.h>
#include <maya/MStatus.h>
#include <maya/MArgList.h>
class CMayaGetFolder : public MPxCommand
{
protected:
public:
CMayaGetFolder(void) {};
virtual ~CMayaGetFolder(void) {};
// Maya API functions.
static void *creator( void );
virtual MStatus doIt( const MArgList &args );
};
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/vq/vqgen.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: train a VQ codebook
last mod: $Id: vqgen.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
/* This code is *not* part of libvorbis. It is used to generate
trained codebooks offline and then spit the results into a
pregenerated codebook that is compiled into libvorbis. It is an
expensive (but good) algorithm. Run it on big iron. */
/* There are so many optimizations to explore in *both* stages that
considering the undertaking is almost withering. For now, we brute
force it all */
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include "vqgen.h"
#include "bookutil.h"
/* Codebook generation happens in two steps:
1) Train the codebook with data collected from the encoder: We use
one of a few error metrics (which represent the distance between a
given data point and a candidate point in the training set) to
divide the training set up into cells representing roughly equal
probability of occurring.
2) Generate the codebook and auxiliary data from the trained data set
*/
/* Codebook training ****************************************************
*
* The basic idea here is that a VQ codebook is like an m-dimensional
* foam with n bubbles. The bubbles compete for space/volume and are
* 'pressurized' [biased] according to some metric. The basic alg
* iterates through allowing the bubbles to compete for space until
* they converge (if the damping is dome properly) on a steady-state
* solution. Individual input points, collected from libvorbis, are
* used to train the algorithm monte-carlo style. */
/* internal helpers *****************************************************/
#define vN(data,i) (data+v->elements*i)
/* default metric; squared 'distance' from desired value. */
float _dist(vqgen *v,float *a, float *b){
int i;
int el=v->elements;
float acc=0.f;
for(i=0;i<el;i++){
float val=(a[i]-b[i]);
acc+=val*val;
}
return sqrt(acc);
}
float *_weight_null(vqgen *v,float *a){
return a;
}
/* *must* be beefed up. */
void _vqgen_seed(vqgen *v){
long i;
for(i=0;i<v->entries;i++)
memcpy(_now(v,i),_point(v,i),sizeof(float)*v->elements);
v->seeded=1;
}
int directdsort(const void *a, const void *b){
float av=*((float *)a);
float bv=*((float *)b);
return (av<bv)-(av>bv);
}
void vqgen_cellmetric(vqgen *v){
int j,k;
float min=-1.f,max=-1.f,mean=0.f,acc=0.f;
long dup=0,unused=0;
#ifdef NOISY
int i;
char buff[80];
float spacings[v->entries];
int count=0;
FILE *cells;
sprintf(buff,"cellspace%d.m",v->it);
cells=fopen(buff,"w");
#endif
/* minimum, maximum, cell spacing */
for(j=0;j<v->entries;j++){
float localmin=-1.;
for(k=0;k<v->entries;k++){
if(j!=k){
float this=_dist(v,_now(v,j),_now(v,k));
if(this>0){
if(v->assigned[k] && (localmin==-1 || this<localmin))
localmin=this;
}else{
if(k<j){
dup++;
break;
}
}
}
}
if(k<v->entries)continue;
if(v->assigned[j]==0){
unused++;
continue;
}
localmin=v->max[j]+localmin/2; /* this gives us rough diameter */
if(min==-1 || localmin<min)min=localmin;
if(max==-1 || localmin>max)max=localmin;
mean+=localmin;
acc++;
#ifdef NOISY
spacings[count++]=localmin;
#endif
}
fprintf(stderr,"cell diameter: %.03g::%.03g::%.03g (%ld unused/%ld dup)\n",
min,mean/acc,max,unused,dup);
#ifdef NOISY
qsort(spacings,count,sizeof(float),directdsort);
for(i=0;i<count;i++)
fprintf(cells,"%g\n",spacings[i]);
fclose(cells);
#endif
}
/* External calls *******************************************************/
/* We have two forms of quantization; in the first, each vector
element in the codebook entry is orthogonal. Residues would use this
quantization for example.
In the second, we have a sequence of monotonically increasing
values that we wish to quantize as deltas (to save space). We
still need to quantize so that absolute values are accurate. For
example, LSP quantizes all absolute values, but the book encodes
distance between values because each successive value is larger
than the preceeding value. Thus the desired quantibits apply to
the encoded (delta) values, not abs positions. This requires minor
additional encode-side trickery. */
void vqgen_quantize(vqgen *v,quant_meta *q){
float maxdel;
float mindel;
float delta;
float maxquant=((1<<q->quant)-1);
int j,k;
mindel=maxdel=_now(v,0)[0];
for(j=0;j<v->entries;j++){
float last=0.f;
for(k=0;k<v->elements;k++){
if(mindel>_now(v,j)[k]-last)mindel=_now(v,j)[k]-last;
if(maxdel<_now(v,j)[k]-last)maxdel=_now(v,j)[k]-last;
if(q->sequencep)last=_now(v,j)[k];
}
}
/* first find the basic delta amount from the maximum span to be
encoded. Loosen the delta slightly to allow for additional error
during sequence quantization */
delta=(maxdel-mindel)/((1<<q->quant)-1.5f);
q->min=_float32_pack(mindel);
q->delta=_float32_pack(delta);
mindel=_float32_unpack(q->min);
delta=_float32_unpack(q->delta);
for(j=0;j<v->entries;j++){
float last=0;
for(k=0;k<v->elements;k++){
float val=_now(v,j)[k];
float now=rint((val-last-mindel)/delta);
_now(v,j)[k]=now;
if(now<0){
/* be paranoid; this should be impossible */
fprintf(stderr,"fault; quantized value<0\n");
exit(1);
}
if(now>maxquant){
/* be paranoid; this should be impossible */
fprintf(stderr,"fault; quantized value>max\n");
exit(1);
}
if(q->sequencep)last=(now*delta)+mindel+last;
}
}
}
/* much easier :-). Unlike in the codebook, we don't un-log log
scales; we just make sure they're properly offset. */
void vqgen_unquantize(vqgen *v,quant_meta *q){
long j,k;
float mindel=_float32_unpack(q->min);
float delta=_float32_unpack(q->delta);
for(j=0;j<v->entries;j++){
float last=0.f;
for(k=0;k<v->elements;k++){
float now=_now(v,j)[k];
now=fabs(now)*delta+last+mindel;
if(q->sequencep)last=now;
_now(v,j)[k]=now;
}
}
}
void vqgen_init(vqgen *v,int elements,int aux,int entries,float mindist,
float (*metric)(vqgen *,float *, float *),
float *(*weight)(vqgen *,float *),int centroid){
memset(v,0,sizeof(vqgen));
v->centroid=centroid;
v->elements=elements;
v->aux=aux;
v->mindist=mindist;
v->allocated=32768;
v->pointlist=_ogg_malloc(v->allocated*(v->elements+v->aux)*sizeof(float));
v->entries=entries;
v->entrylist=_ogg_malloc(v->entries*v->elements*sizeof(float));
v->assigned=_ogg_malloc(v->entries*sizeof(long));
v->bias=_ogg_calloc(v->entries,sizeof(float));
v->max=_ogg_calloc(v->entries,sizeof(float));
if(metric)
v->metric_func=metric;
else
v->metric_func=_dist;
if(weight)
v->weight_func=weight;
else
v->weight_func=_weight_null;
v->asciipoints=tmpfile();
}
void vqgen_addpoint(vqgen *v, float *p,float *a){
int k;
for(k=0;k<v->elements;k++)
fprintf(v->asciipoints,"%.12g\n",p[k]);
for(k=0;k<v->aux;k++)
fprintf(v->asciipoints,"%.12g\n",a[k]);
if(v->points>=v->allocated){
v->allocated*=2;
v->pointlist=_ogg_realloc(v->pointlist,v->allocated*(v->elements+v->aux)*
sizeof(float));
}
memcpy(_point(v,v->points),p,sizeof(float)*v->elements);
if(v->aux)memcpy(_point(v,v->points)+v->elements,a,sizeof(float)*v->aux);
/* quantize to the density mesh if it's selected */
if(v->mindist>0.f){
/* quantize to the mesh */
for(k=0;k<v->elements+v->aux;k++)
_point(v,v->points)[k]=
rint(_point(v,v->points)[k]/v->mindist)*v->mindist;
}
v->points++;
if(!(v->points&0xff))spinnit("loading... ",v->points);
}
/* yes, not threadsafe. These utils aren't */
static int sortit=0;
static int sortsize=0;
static int meshcomp(const void *a,const void *b){
if(((sortit++)&0xfff)==0)spinnit("sorting mesh...",sortit);
return(memcmp(a,b,sortsize));
}
void vqgen_sortmesh(vqgen *v){
sortit=0;
if(v->mindist>0.f){
long i,march=1;
/* sort to make uniqueness detection trivial */
sortsize=(v->elements+v->aux)*sizeof(float);
qsort(v->pointlist,v->points,sortsize,meshcomp);
/* now march through and eliminate dupes */
for(i=1;i<v->points;i++){
if(memcmp(_point(v,i),_point(v,i-1),sortsize)){
/* a new, unique entry. march it down */
if(i>march)memcpy(_point(v,march),_point(v,i),sortsize);
march++;
}
spinnit("eliminating density... ",v->points-i);
}
/* we're done */
fprintf(stderr,"\r%ld training points remining out of %ld"
" after density mesh (%ld%%)\n",march,v->points,march*100/v->points);
v->points=march;
}
v->sorted=1;
}
float vqgen_iterate(vqgen *v,int biasp){
long i,j,k;
float fdesired;
long desired;
long desired2;
float asserror=0.f;
float meterror=0.f;
float *new;
float *new2;
long *nearcount;
float *nearbias;
#ifdef NOISY
char buff[80];
FILE *assig;
FILE *bias;
FILE *cells;
sprintf(buff,"cells%d.m",v->it);
cells=fopen(buff,"w");
sprintf(buff,"assig%d.m",v->it);
assig=fopen(buff,"w");
sprintf(buff,"bias%d.m",v->it);
bias=fopen(buff,"w");
#endif
if(v->entries<2){
fprintf(stderr,"generation requires at least two entries\n");
exit(1);
}
if(!v->sorted)vqgen_sortmesh(v);
if(!v->seeded)_vqgen_seed(v);
fdesired=(float)v->points/v->entries;
desired=fdesired;
desired2=desired*2;
new=_ogg_malloc(sizeof(float)*v->entries*v->elements);
new2=_ogg_malloc(sizeof(float)*v->entries*v->elements);
nearcount=_ogg_malloc(v->entries*sizeof(long));
nearbias=_ogg_malloc(v->entries*desired2*sizeof(float));
/* fill in nearest points for entry biasing */
/*memset(v->bias,0,sizeof(float)*v->entries);*/
memset(nearcount,0,sizeof(long)*v->entries);
memset(v->assigned,0,sizeof(long)*v->entries);
if(biasp){
for(i=0;i<v->points;i++){
float *ppt=v->weight_func(v,_point(v,i));
float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
float secondmetric=v->metric_func(v,_now(v,1),ppt)+v->bias[1];
long firstentry=0;
long secondentry=1;
if(!(i&0xff))spinnit("biasing... ",v->points+v->points+v->entries-i);
if(firstmetric>secondmetric){
float temp=firstmetric;
firstmetric=secondmetric;
secondmetric=temp;
firstentry=1;
secondentry=0;
}
for(j=2;j<v->entries;j++){
float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
if(thismetric<secondmetric){
if(thismetric<firstmetric){
secondmetric=firstmetric;
secondentry=firstentry;
firstmetric=thismetric;
firstentry=j;
}else{
secondmetric=thismetric;
secondentry=j;
}
}
}
j=firstentry;
for(j=0;j<v->entries;j++){
float thismetric,localmetric;
float *nearbiasptr=nearbias+desired2*j;
long k=nearcount[j];
localmetric=v->metric_func(v,_now(v,j),ppt);
/* 'thismetric' is to be the bias value necessary in the current
arrangement for entry j to capture point i */
if(firstentry==j){
/* use the secondary entry as the threshhold */
thismetric=secondmetric-localmetric;
}else{
/* use the primary entry as the threshhold */
thismetric=firstmetric-localmetric;
}
/* support the idea of 'minimum distance'... if we want the
cells in a codebook to be roughly some minimum size (as with
the low resolution residue books) */
/* a cute two-stage delayed sorting hack */
if(k<desired){
nearbiasptr[k]=thismetric;
k++;
if(k==desired){
spinnit("biasing... ",v->points+v->points+v->entries-i);
qsort(nearbiasptr,desired,sizeof(float),directdsort);
}
}else if(thismetric>nearbiasptr[desired-1]){
nearbiasptr[k]=thismetric;
k++;
if(k==desired2){
spinnit("biasing... ",v->points+v->points+v->entries-i);
qsort(nearbiasptr,desired2,sizeof(float),directdsort);
k=desired;
}
}
nearcount[j]=k;
}
}
/* inflate/deflate */
for(i=0;i<v->entries;i++){
float *nearbiasptr=nearbias+desired2*i;
spinnit("biasing... ",v->points+v->entries-i);
/* due to the delayed sorting, we likely need to finish it off....*/
if(nearcount[i]>desired)
qsort(nearbiasptr,nearcount[i],sizeof(float),directdsort);
v->bias[i]=nearbiasptr[desired-1];
}
}else{
memset(v->bias,0,v->entries*sizeof(float));
}
/* Now assign with new bias and find new midpoints */
for(i=0;i<v->points;i++){
float *ppt=v->weight_func(v,_point(v,i));
float firstmetric=v->metric_func(v,_now(v,0),ppt)+v->bias[0];
long firstentry=0;
if(!(i&0xff))spinnit("centering... ",v->points-i);
for(j=0;j<v->entries;j++){
float thismetric=v->metric_func(v,_now(v,j),ppt)+v->bias[j];
if(thismetric<firstmetric){
firstmetric=thismetric;
firstentry=j;
}
}
j=firstentry;
#ifdef NOISY
fprintf(cells,"%g %g\n%g %g\n\n",
_now(v,j)[0],_now(v,j)[1],
ppt[0],ppt[1]);
#endif
firstmetric-=v->bias[j];
meterror+=firstmetric;
if(v->centroid==0){
/* set up midpoints for next iter */
if(v->assigned[j]++){
for(k=0;k<v->elements;k++)
vN(new,j)[k]+=ppt[k];
if(firstmetric>v->max[j])v->max[j]=firstmetric;
}else{
for(k=0;k<v->elements;k++)
vN(new,j)[k]=ppt[k];
v->max[j]=firstmetric;
}
}else{
/* centroid */
if(v->assigned[j]++){
for(k=0;k<v->elements;k++){
if(vN(new,j)[k]>ppt[k])vN(new,j)[k]=ppt[k];
if(vN(new2,j)[k]<ppt[k])vN(new2,j)[k]=ppt[k];
}
if(firstmetric>v->max[firstentry])v->max[j]=firstmetric;
}else{
for(k=0;k<v->elements;k++){
vN(new,j)[k]=ppt[k];
vN(new2,j)[k]=ppt[k];
}
v->max[firstentry]=firstmetric;
}
}
}
/* assign midpoints */
for(j=0;j<v->entries;j++){
#ifdef NOISY
fprintf(assig,"%ld\n",v->assigned[j]);
fprintf(bias,"%g\n",v->bias[j]);
#endif
asserror+=fabs(v->assigned[j]-fdesired);
if(v->assigned[j]){
if(v->centroid==0){
for(k=0;k<v->elements;k++)
_now(v,j)[k]=vN(new,j)[k]/v->assigned[j];
}else{
for(k=0;k<v->elements;k++)
_now(v,j)[k]=(vN(new,j)[k]+vN(new2,j)[k])/2.f;
}
}
}
asserror/=(v->entries*fdesired);
fprintf(stderr,"Pass #%d... ",v->it);
fprintf(stderr,": dist %g(%g) metric error=%g \n",
asserror,fdesired,meterror/v->points);
v->it++;
free(new);
free(nearcount);
free(nearbias);
#ifdef NOISY
fclose(assig);
fclose(bias);
fclose(cells);
#endif
return(asserror);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/StateManager.h
|
<gh_stars>10-100
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __STATEMANAGER_H
#define __STATEMANAGER_H
#ifdef _WIN32
#include <windows.h>
#endif
#include <sstream>
#include "SessionState.h"
#include "SessionGroupState.h"
#include "Vxc.h"
#include "VxcResponses.h"
#include "VxcEvents.h"
#include "math.h"
#define PI 3.1415926535897932384626433832795
class StateManager
{
int guid;
bool isConnectorInitialized;
bool isAccountLoggedIn;
std::string connectorHandle;
std::string accountHandle;
std::map<std::string,VxSessionGroup*> sessionGroups; //stores session handles and corresponding states
std::map<std::string,std::string> requests; //stores requestIDs and corresponding types
//positional info
double listenerHeadingDegrees; // Listener's heading in degrees (North (Negative Z axis) is 0 deg, East (Positive X axis) is +90 deg etc)
double listenerPosition[3];
double listenerOrientation[6];
//version info
std::string version;
public:
StateManager();
std::string GenerateID();
static std::string GetTime();
//Application state methods
bool SetConnectorInitialized(std::string, std::string);
void SetConnectorUninitialized();
bool SetStateAccountLoggedIn(std::string account_handle);
void SetStateAccountLoggedOut();
bool AddSessionGroup(std::string session_group_handle);
void RemoveSessionGroup(std::string session_group_handle);
VxSessionGroup* GetSessionGroup(std::string session_group_handle);
void ClearSessionGroups();
std::set<std::string> GetSessionGroupHandles();
bool AddSession(std::string session_group_handle, std::string session_handle, std::string uri, int incoming);
void RemoveSession(std::string session_group_handle, std::string session_handle);
void UpdateMediaStreamState(std::string session_group_handle, std::string session_handle, int state);
void UpdateTextStreamState(std::string session_group_handle, std::string session_handle, int state);
//State info
bool GetIsConnectorInitialized();
bool GetIsAccountLoggedIn();
std::string GetConnectorHandle();
std::string GetAccountHandle();
bool GetSessionGroupExists(std::string);
std::set<std::string> GetAllSessionGroupHandles();
std::set<std::string> GetAllSessionHandles();
int GetMediaSessionState(std::string);
int GetTextSessionState(std::string);
//State info dump
void DumpStateToFile(std::ostream*);
//request map methods
void InsertCommandReqID(std::string, std::string);
void DeleteCommandReqID(std::string);
//positional info methods
void GetListenerPosition(double *);
void GetListenerOrientation(double *);
void SetListenerPosition(double *);
void SetListenerOrientation(double *);
void GetListenerHeadingDegrees(double *);
void SetListenerHeadingDegrees(double);
};
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/modes/setup_22.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform<filename>lib/vorbis/lib/modes/setup_22.h
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: 22kHz settings
last mod: $Id: setup_22.h 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
static double rate_mapping_22[4]={
15000.,20000.,44000.,86000.
};
static double rate_mapping_22_uncoupled[4]={
16000.,28000.,50000.,90000.
};
static double _psy_lowpass_22[4]={9.5,11.,30.,99.};
ve_setup_data_template ve_setup_22_stereo={
3,
rate_mapping_22,
quality_mapping_16,
2,
19000,
26000,
blocksize_16_short,
blocksize_16_long,
_psy_tone_masteratt_16,
_psy_tone_0dB,
_psy_tone_suppress,
_vp_tonemask_adj_16,
_vp_tonemask_adj_16,
_vp_tonemask_adj_16,
_psy_noiseguards_8,
_psy_noisebias_16_impulse,
_psy_noisebias_16_short,
_psy_noisebias_16_short,
_psy_noisebias_16,
_psy_noise_suppress,
_psy_compand_8,
_psy_compand_8_mapping,
_psy_compand_8_mapping,
{_noise_start_16,_noise_start_16},
{ _noise_part_16, _noise_part_16},
_noise_thresh_16,
_psy_ath_floater_16,
_psy_ath_abs_16,
_psy_lowpass_22,
_psy_global_44,
_global_mapping_16,
_psy_stereo_modes_16,
_floor_books,
_floor,
_floor_mapping_16_short,
_floor_mapping_16,
_mapres_template_16_stereo
};
ve_setup_data_template ve_setup_22_uncoupled={
3,
rate_mapping_22_uncoupled,
quality_mapping_16,
-1,
19000,
26000,
blocksize_16_short,
blocksize_16_long,
_psy_tone_masteratt_16,
_psy_tone_0dB,
_psy_tone_suppress,
_vp_tonemask_adj_16,
_vp_tonemask_adj_16,
_vp_tonemask_adj_16,
_psy_noiseguards_8,
_psy_noisebias_16_impulse,
_psy_noisebias_16_short,
_psy_noisebias_16_short,
_psy_noisebias_16,
_psy_noise_suppress,
_psy_compand_8,
_psy_compand_8_mapping,
_psy_compand_8_mapping,
{_noise_start_16,_noise_start_16},
{ _noise_part_16, _noise_part_16},
_noise_thresh_16,
_psy_ath_floater_16,
_psy_ath_abs_16,
_psy_lowpass_22,
_psy_global_44,
_global_mapping_16,
_psy_stereo_modes_16,
_floor_books,
_floor,
_floor_mapping_16_short,
_floor_mapping_16,
_mapres_template_16_uncoupled
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/OggVorbisWrapper/OggVorbisWrapper.h
|
// OggVorbisWrapper.h
#pragma once
using namespace System;
public value struct OggVorbisSoundData {
public:
int format;
int size;
int frequency;
int error_code;
};
public ref class OggVorbisWrapper {
public:
// Read the ogg data from the ogg file, and write the PCM data to the pcmStream
static OggVorbisSoundData loadOGGFile(String ^fileName, System::IO::Stream ^pcmStream);
// Read the ogg data from the oggStream, and write the PCM data to the pcmStream
static OggVorbisSoundData loadOGGMemory(System::IO::Stream ^oggStream, System::IO::Stream ^pcmStream);
};
class OggVorbisHelper {
private:
OggVorbis_File oggFile;
private:
OggVorbisSoundData decodeOggData(System::IO::Stream ^pcmStream);
public:
OggVorbisSoundData loadOggFile(String ^fileName, System::IO::Stream ^pcmStream);
OggVorbisSoundData loadOggMemory(System::IO::Stream ^oggStream, System::IO::Stream ^pcmStream);
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/SpeedWind/PIDController.h
|
<filename>lib/SpeedWind/PIDController.h
///////////////////////////////////////////////////////////////////////
// PIDContoller.h
//
// (c) 2002 IDV, Inc.
//
// This file contains a simple discrete PID contoller class.
//
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may
// not be copied or disclosed except in accordance with the terms of
// that agreement.
//
// Copyright (c) 2001-2002 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
/////////////////////////////////////////////////////////////////////////////
// Preprocessor
#pragma once
#include <float.h>
#include <math.h>
/////////////////////////////////////////////////////////////////////////////
// Constants
const double c_dMaxAllowableDeltaTime = 0.03; // if more time (in seconds) than this has passed, no PID adjustments will be made
/////////////////////////////////////////////////////////////////////////////
// CPIDController
class CPIDController
{
public:
CPIDController( ) :
m_dValue(0.0),
m_dWantedValue(0.0),
m_dPConst(1.0),
m_dIConst(0.0),
m_dDConst(0.0),
m_dRunningError(0.0),
m_dLastDelta(0.0),
m_dLastError(0.0),
m_bValidError(false),
m_dMaxAcceleration(0.0),
m_dLastDeltaTime(0.0)
{
}
void SetValue(double dValue);
void SetWantedValue(double dWantedValue);
void SetConstants(double dPConst, double dIConst, double dDConst, double dMaxAcceleration = 0.0);
double GetValue( ) const;
double GetWantedValue( ) const;
double GetLastError( ) const;
double GetLastDelta( ) const;
double GetValue(double dDeltaTime);
void ResetError(void);
void SetMaxAcceleration(double dValue) { m_dMaxAcceleration = dValue; }
private:
double m_dValue; // current value of the controller
double m_dWantedValue; // the value the controller is trying to achieve
double m_dPConst; // proportional constant (Kp)
double m_dIConst; // integral constant (Ki)
double m_dDConst; // derivative constant (Kd)
double m_dMaxAcceleration; // limits how fast the control can accelerate the value
double m_dLastError; // previous error
double m_dLastDelta; // amout of change during last adjustment
double m_dRunningError; // summed errors (using as the integral value)
bool m_bValidError; // prevents numerical problems on the first adjustment
double m_dLastDeltaTime;
};
/////////////////////////////////////////////////////////////////////////////
// CPIDController::SetValue
inline void CPIDController::SetValue(double dValue)
{
m_dValue = dValue;
m_dLastError = 0.0;
m_dLastDelta = 0.0;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::SetWantedValue
inline void CPIDController::SetWantedValue(double dWantedValue)
{
m_dWantedValue = dWantedValue;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::SetConstants
inline void CPIDController::SetConstants(double dPConst, double dIConst, double dDConst, double dAcceleration)
{
m_dPConst = dPConst;
m_dIConst = dIConst;
m_dDConst = dDConst;
m_dMaxAcceleration = dAcceleration;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::GetValue
inline double CPIDController::GetValue( ) const
{
return m_dValue;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::GetLastError
inline double CPIDController::GetLastError( ) const
{
return m_dLastError;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::GetWantedValue
inline double CPIDController::GetWantedValue( ) const
{
return m_dWantedValue;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::GetLastDelta
inline double CPIDController::GetLastDelta( ) const
{
return m_dLastDelta;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::GetValue
inline double CPIDController::GetValue(double dDeltaTime)
{
// if too much time has passed, do nothing
if (dDeltaTime == 0.0f)
return m_dValue;
else if (dDeltaTime > c_dMaxAllowableDeltaTime)
dDeltaTime = c_dMaxAllowableDeltaTime;
// compute the error and sum of the errors for the integral
double dError = (m_dWantedValue - m_dValue) * dDeltaTime;
m_dRunningError += dError;
// proportional
double dP = m_dPConst * dError;
// integral
double dI = m_dIConst * m_dRunningError * dDeltaTime;
// derivative
double dD(0.0f);
if (m_bValidError)
dD = m_dDConst * (m_dLastError - dError) * dDeltaTime;
else
m_bValidError = true;
// remember the error for derivative
m_dLastError = dError;
// compute the adjustment
double dThisDelta = dP + dI + dD;
// clamp the acceleration
if (m_dMaxAcceleration != 0.0f || false)
{
double dTimeRatio(1.0);
if (m_dLastDeltaTime != 0.0)
dTimeRatio = dDeltaTime / m_dLastDeltaTime;
m_dLastDeltaTime = dDeltaTime;
m_dLastDelta *= dTimeRatio;
double dDifference = (dThisDelta - m_dLastDelta);
double dAccel = m_dMaxAcceleration * dDeltaTime * dDeltaTime;
if (dDifference < -dAccel)
dThisDelta = m_dLastDelta - dAccel;
else if (dDifference > dAccel)
dThisDelta = m_dLastDelta + dAccel;
}
// modify the value
m_dValue += dThisDelta;
m_dLastDelta = dThisDelta;
return m_dValue;
}
/////////////////////////////////////////////////////////////////////////////
// CPIDController::ResetError
inline void CPIDController::ResetError(void)
{
m_dRunningError = 0.0f;
m_bValidError = false;
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/vivox-config.h
|
/*
This file is generated by CMake, changes made to this file will be lost.
If you wish to modify this file, edit "config.h.in" instead.
*/
#ifndef __VIVOX_CONFIG_H__
#define __VIVOX_CONFIG_H__
#define SUBVERSION_CHANGE 2341
#define SUBVERSION_DATE "2007-09-19 16:41:55 -0400 (Wed, 19 Sep 2007)"
#define SDK_VERSION "2.1.2990.2341"
#define SDK_BRANCH "/repos/v2-sdk/branches/releases/2990"
#define VERSION_MAJOR 2
#define VERSION_MINOR 1
#define VERSION_MICRO 2990
#define VERSION_BUILD 2341
#define BUILD_DATE "Wed Sep 19 16:59:09 2007"
#define BUILD_HOST "BUILDBOX"
#define BUILD_PERSON "build"
#define VIVOX_BUILD_TYPE "Developer"
#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#endif
#endif // __VERSIONINFO_H__
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/BridgeInterface/Session.h
|
#pragma once
#include "Socket.h"
#include "Message.h"
#include "Thread.h"
enum MessageCode {
SUBSCRIBE = 0,
UNSUBSCRIBE = 1,
SUBSCRIBE_RESPONSE = 2,
SERVER_MESSAGE = 3
};
enum MessageFilterType {
TOPIC = 0,
OID = 1,
RESPONSE = 2
};
class __declspec(dllexport) MessageFilter {
public:
// Write our message to the buffer
virtual void Write(MessageBuffer &buf) const;
// Check to see if the message matches our filter
virtual bool Matches(const BaseMessage &message) const;
};
class __declspec(dllexport) TopicFilter : public MessageFilter {
public:
std::string topic;
virtual void Write(MessageBuffer &buf) const;
virtual bool Matches(const BaseMessage &message) const;
};
class __declspec(dllexport) OidFilter : public TopicFilter {
public:
long long oid;
virtual void Write(MessageBuffer &buf) const;
virtual bool Matches(const BaseMessage &message) const;
};
class __declspec(dllexport) ResponseFilter : public TopicFilter {
public:
virtual void Write(MessageBuffer &buf) const;
virtual bool Matches(const BaseMessage &message) const;
};
class __declspec(dllexport) MessageCallback {
public:
virtual void HandleMessage(BaseMessage &msg) const = 0;
};
class Session;
class __declspec(dllexport) MessageReadThread : public Thread {
private:
Session *session;
public:
MessageReadThread(Session *s);
virtual void Run();
};
class __declspec(dllexport) Subscription {
public:
Subscription(MessageFilter *filter, MessageCallback *callback);
virtual ~Subscription();
int sub_id;
MessageFilter *filter;
MessageCallback *callback;
};
class __declspec(dllexport) Session {
friend class ResponseMessageCallback;
friend class MessageReadThread;
public:
Monitor subscription_monitor;
Monitor response_monitor;
std::map<int, Subscription *> pending_subscribes;
std::map<int, Subscription *> subscriptions;
std::set<int> pending_unsubscribes;
private:
Monitor read_monitor;
Monitor write_monitor;
Monitor request_monitor;
Monitor message_queue_monitor;
std::string request_topic;
// Queue of unprocessed messages. Messages that are destined for
// standard processing will be read from the socket, and put into
// this queue. The consumer of the queue will free them.
std::list<MessageBuffer *> message_queue;
// This is the subscription we will use to handle response messages
Subscription *response_subscription;
// Temporary storage for the response message. This plays a similar role
// to the message queue, but for response messages.
BaseMessage *response_message;
MessageReadThread *msgReader;
int next_sub_id;
Socket *sock;
bool shutting_down;
int WriteData(const unsigned char *data, int offset, int len);
int ReadData(unsigned char *data, int offset, int len);
void WriteMessage(const MessageBuffer *msg);
MessageBuffer *ReadMessage();
void Cleanup();
public:
Session();
~Session();
void Connect(const char *hostname, unsigned short port);
// This subscribes to response messages
void Startup();
// This unsubscribes to response messages
void Shutdown();
// This just gets a flag to indicate whether we are shutting down
bool ShuttingDown();
// This is the method that should be called by the user thread to
// get the next queued user message.
// The caller is responsible for freeing the returned message.
MessageBuffer *GetNextMessageBuffer();
// Blocking version of the subscribe call.
// The subscription, filter and callback end up in the subscriptions map.
Subscription *CreateSubscription(MessageFilter *filter, MessageCallback *callback);
// This does a blocking close on the subscription object, and frees it.
void CloseSubscription(Subscription *sub);
// Send a message
void WriteMessage(const BaseMessage *msg);
// Blocking version of Request. This sends a request message, and blocks
// while it waits for the response. The caller is responsible for freeing
// the returned message.
BaseMessage *Request(const BaseMessage *request_msg);
// Take the internal form of a message, convert it to on-the-wire
// form, and enqueue it for the user thread as if it were re
// received from the client.
void QueueMessageForUserThread(const BaseMessage *msg);
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/highlevel.h
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: highlevel encoder setup struct seperated out for vorbisenc clarity
last mod: $Id: highlevel.h 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
typedef struct highlevel_byblocktype {
double tone_mask_setting;
double tone_peaklimit_setting;
double noise_bias_setting;
double noise_compand_setting;
} highlevel_byblocktype;
typedef struct highlevel_encode_setup {
void *setup;
int set_in_stone;
double base_setting;
double long_setting;
double short_setting;
double impulse_noisetune;
int managed;
long bitrate_min;
long bitrate_av;
double bitrate_av_damp;
long bitrate_max;
long bitrate_reservoir;
double bitrate_reservoir_bias;
int impulse_block_p;
int noise_normalize_p;
double stereo_point_setting;
double lowpass_kHz;
double ath_floating_dB;
double ath_absolute_dB;
double amplitude_track_dBpersec;
double trigger_setting;
highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
} highlevel_encode_setup;
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/VxcResponses.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __VXCRESPONSES_H__
#define __VXCRESPONSES_H__
#include "Vxc.h"
#include "VxcRequests.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Begin Vivox responses */
typedef struct vx_resp_connector_create {
vx_resp_base_t base;
VX_HANDLE connector_handle;
char* version_id;
} vx_resp_connector_create_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_create_free(vx_resp_connector_create_t * resp);
typedef struct vx_resp_connector_initiate_shutdown {
vx_resp_base_t base;
char* client_name;
} vx_resp_connector_initiate_shutdown_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_initiate_shutdown_free(vx_resp_connector_initiate_shutdown_t * resp);
typedef struct vx_resp_account_login {
vx_resp_base_t base;
VX_HANDLE account_handle;
} vx_resp_account_login_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_login_free(vx_resp_account_login_t * resp);
typedef struct vx_resp_account_logout {
vx_resp_base_t base;
} vx_resp_account_logout_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_logout_free(vx_resp_account_logout_t * resp);
typedef struct vx_resp_account_set_login_properties {
vx_resp_base_t base;
} vx_resp_account_set_login_properties_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_set_login_properties_free(vx_resp_account_set_login_properties_t * resp);
typedef struct vx_resp_sessiongroup_create {
vx_resp_base_t base;
VX_HANDLE sessiongroup_handle;
} vx_resp_sessiongroup_create_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_create_free(vx_resp_sessiongroup_create_t * resp);
typedef struct vx_resp_sessiongroup_terminate {
vx_resp_base_t base;
} vx_resp_sessiongroup_terminate_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_terminate_free(vx_resp_sessiongroup_terminate_t * resp);
typedef struct vx_resp_sessiongroup_add_session {
vx_resp_base_t base;
VX_HANDLE session_handle;
} vx_resp_sessiongroup_add_session_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_add_session_free(vx_resp_sessiongroup_add_session_t * resp);
typedef struct vx_resp_sessiongroup_remove_session {
vx_resp_base_t base;
} vx_resp_sessiongroup_remove_session_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_remove_session_free(vx_resp_sessiongroup_remove_session_t * resp);
typedef struct vx_resp_sessiongroup_set_focus {
vx_resp_base_t base;
} vx_resp_sessiongroup_set_focus_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_set_focus_free(vx_resp_sessiongroup_set_focus_t * resp);
typedef struct vx_resp_sessiongroup_unset_focus {
vx_resp_base_t base;
} vx_resp_sessiongroup_unset_focus_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_unset_focus_free(vx_resp_sessiongroup_unset_focus_t * resp);
typedef struct vx_resp_sessiongroup_reset_focus {
vx_resp_base_t base;
} vx_resp_sessiongroup_reset_focus_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_reset_focus_free(vx_resp_sessiongroup_reset_focus_t * resp);
typedef struct vx_resp_sessiongroup_set_tx_session {
vx_resp_base_t base;
} vx_resp_sessiongroup_set_tx_session_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_set_tx_session_free(vx_resp_sessiongroup_set_tx_session_t * resp);
typedef struct vx_resp_sessiongroup_set_tx_all_sessions {
vx_resp_base_t base;
} vx_resp_sessiongroup_set_tx_all_sessions_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_set_tx_all_sessions_free(vx_resp_sessiongroup_set_tx_all_sessions_t * resp);
typedef struct vx_resp_sessiongroup_set_tx_no_session {
vx_resp_base_t base;
} vx_resp_sessiongroup_set_tx_no_session_t;
VIVOXSDK_DLLEXPORT void vx_resp_sessiongroup_set_tx_no_session_free(vx_resp_sessiongroup_set_tx_no_session_t * resp);
typedef struct vx_resp_session_create {
vx_resp_base_t base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
} vx_resp_session_create_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_create_free(vx_resp_session_create_t * resp);
typedef struct vx_resp_session_connect {
vx_resp_base_t base;
} vx_resp_session_connect_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_connect_free(vx_resp_session_connect_t * resp);
typedef struct vx_resp_session_media_connect {
vx_resp_base_t base;
} vx_resp_session_media_connect_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_media_connect_free(vx_resp_session_media_connect_t * resp);
typedef struct vx_resp_session_media_disconnect {
vx_resp_base_t base;
} vx_resp_session_media_disconnect_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_media_disconnect_free(vx_resp_session_media_disconnect_t * resp);
typedef struct vx_resp_session_terminate {
vx_resp_base_t base;
} vx_resp_session_terminate_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_terminate_free(vx_resp_session_terminate_t * resp);
typedef struct vx_resp_session_mute_local_speaker {
vx_resp_base_t base;
} vx_resp_session_mute_local_speaker_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_mute_local_speaker_free(vx_resp_session_mute_local_speaker_t * resp);
typedef struct vx_resp_session_set_local_speaker_volume {
vx_resp_base_t base;
} vx_resp_session_set_local_speaker_volume_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_set_local_speaker_volume_free(vx_resp_session_set_local_speaker_volume_t * resp);
typedef struct vx_resp_session_get_local_audio_info {
vx_resp_base_t base;
int speaker_volume;
int is_speaker_muted;
int mic_volume;
int is_mic_muted;
} vx_resp_session_get_local_audio_info_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_get_local_audio_info_free(vx_resp_session_get_local_audio_info_t * resp);
typedef struct vx_resp_session_channel_invite_user {
vx_resp_base_t base;
} vx_resp_session_channel_invite_user_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_channel_invite_user_free(vx_resp_session_channel_invite_user_t * resp);
typedef struct vx_resp_session_set_participant_volume_for_me {
vx_resp_base_t base;
} vx_resp_session_set_participant_volume_for_me_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_set_participant_volume_for_me_free(vx_resp_session_set_participant_volume_for_me_t * resp);
typedef struct vx_resp_session_set_participant_mute_for_me {
vx_resp_base_t base;
} vx_resp_session_set_participant_mute_for_me_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_set_participant_mute_for_me_free(vx_resp_session_set_participant_mute_for_me_t * resp);
typedef struct vx_resp_session_set_3d_position {
vx_resp_base_t base;
} vx_resp_session_set_3d_position_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_set_3d_position_free(vx_resp_session_set_3d_position_t * resp);
typedef struct vx_resp_session_render_audio_start {
vx_resp_base_t base;
} vx_resp_session_render_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_render_audio_start_free(vx_resp_session_render_audio_start_t * resp);
typedef struct vx_resp_session_render_audio_stop {
vx_resp_base_t base;
} vx_resp_session_render_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_render_audio_stop_free(vx_resp_session_render_audio_stop_t * resp);
typedef struct vx_resp_session_channel_get_participants {
vx_resp_base_t base;
int participants_size;
vx_participant_t** participants;
} vx_resp_session_channel_get_participants_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_channel_get_participants_free(vx_resp_session_channel_get_participants_t * resp);
typedef struct vx_resp_account_channel_get_list {
vx_resp_base_t base;
int channels_size;
vx_channel_t** channels;
} vx_resp_account_channel_get_list_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_get_list_free(vx_resp_account_channel_get_list_t * resp);
typedef struct vx_resp_account_channel_create {
vx_resp_base_t base;
char* channel_uri;
} vx_resp_account_channel_create_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_create_free(vx_resp_account_channel_create_t * resp);
typedef struct vx_resp_account_channel_update {
vx_resp_base_t base;
} vx_resp_account_channel_update_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_update_free(vx_resp_account_channel_update_t * resp);
typedef struct vx_resp_account_channel_delete {
vx_resp_base_t base;
} vx_resp_account_channel_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_delete_free(vx_resp_account_channel_delete_t * resp);
typedef struct vx_resp_account_channel_create_and_invite {
vx_resp_base_t base;
char* channel_uri;
} vx_resp_account_channel_create_and_invite_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_create_and_invite_free(vx_resp_account_channel_create_and_invite_t * resp);
typedef struct vx_resp_account_channel_folder_create {
vx_resp_base_t base;
int folder_id;
} vx_resp_account_channel_folder_create_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_folder_create_free(vx_resp_account_channel_folder_create_t * resp);
typedef struct vx_resp_account_channel_folder_update {
vx_resp_base_t base;
} vx_resp_account_channel_folder_update_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_folder_update_free(vx_resp_account_channel_folder_update_t * resp);
typedef struct vx_resp_account_channel_folder_delete {
vx_resp_base_t base;
} vx_resp_account_channel_folder_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_folder_delete_free(vx_resp_account_channel_folder_delete_t * resp);
typedef struct vx_resp_account_channel_folder_get_info {
vx_resp_base_t base;
vx_channel_t* folder;
} vx_resp_account_channel_folder_get_info_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_folder_get_info_free(vx_resp_account_channel_folder_get_info_t * resp);
typedef struct vx_resp_account_channel_favorites_get_list {
vx_resp_base_t base;
int group_count;
int favorite_count;
vx_channel_favorite_group_t** groups;
vx_channel_favorite_t** favorites;
} vx_resp_account_channel_favorites_get_list_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_favorites_get_list_free(vx_resp_account_channel_favorites_get_list_t * resp);
typedef struct vx_resp_account_channel_favorite_set {
vx_resp_base_t base;
int channel_favorite_id;
} vx_resp_account_channel_favorite_set_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_favorite_set_free(vx_resp_account_channel_favorite_set_t * resp);
typedef struct vx_resp_account_channel_favorite_delete {
vx_resp_base_t base;
} vx_resp_account_channel_favorite_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_favorite_delete_free(vx_resp_account_channel_favorite_delete_t * resp);
typedef struct vx_resp_account_channel_favorite_group_set {
vx_resp_base_t base;
int group_id;
} vx_resp_account_channel_favorite_group_set_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_favorite_group_set_free(vx_resp_account_channel_favorite_group_set_t * resp);
typedef struct vx_resp_account_channel_favorite_group_delete {
vx_resp_base_t base;
} vx_resp_account_channel_favorite_group_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_favorite_group_delete_free(vx_resp_account_channel_favorite_group_delete_t * resp);
typedef struct vx_resp_account_channel_get_info {
vx_resp_base_t base;
vx_channel_t* channel;
} vx_resp_account_channel_get_info_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_get_info_free(vx_resp_account_channel_get_info_t * resp);
typedef struct vx_resp_account_channel_search {
vx_resp_base_t base;
int page;
int from;
int to;
int channel_count;
vx_channel_t** channels;
} vx_resp_account_channel_search_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_search_free(vx_resp_account_channel_search_t * resp);
typedef struct vx_resp_account_buddy_search {
vx_resp_base_t base;
int page;
int from;
int to;
int buddy_count;
vx_buddy_t** buddies;
} vx_resp_account_buddy_search_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_buddy_search_free(vx_resp_account_buddy_search_t * resp);
typedef struct vx_resp_account_channel_add_moderator {
vx_resp_base_t base;
} vx_resp_account_channel_add_moderator_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_add_moderator_free(vx_resp_account_channel_add_moderator_t * resp);
typedef struct vx_resp_account_channel_remove_moderator {
vx_resp_base_t base;
} vx_resp_account_channel_remove_moderator_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_remove_moderator_free(vx_resp_account_channel_remove_moderator_t * resp);
typedef struct vx_resp_account_channel_get_moderators {
vx_resp_base_t base;
int participants_size;
vx_participant_t** participants;
} vx_resp_account_channel_get_moderators_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_get_moderators_free(vx_resp_account_channel_get_moderators_t * resp);
typedef struct vx_resp_account_channel_add_acl {
vx_resp_base_t base;
} vx_resp_account_channel_add_acl_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_add_acl_free(vx_resp_account_channel_add_acl_t * resp);
typedef struct vx_resp_account_channel_remove_acl {
vx_resp_base_t base;
} vx_resp_account_channel_remove_acl_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_remove_acl_free(vx_resp_account_channel_remove_acl_t * resp);
typedef struct vx_resp_account_channel_get_acl {
vx_resp_base_t base;
int participants_size;
vx_participant_t** participants;
} vx_resp_account_channel_get_acl_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_channel_get_acl_free(vx_resp_account_channel_get_acl_t * resp);
typedef struct vx_resp_channel_mute_user {
vx_resp_base_t base;
} vx_resp_channel_mute_user_t;
VIVOXSDK_DLLEXPORT void vx_resp_channel_mute_user_free(vx_resp_channel_mute_user_t * resp);
typedef struct vx_resp_channel_ban_user {
vx_resp_base_t base;
} vx_resp_channel_ban_user_t;
VIVOXSDK_DLLEXPORT void vx_resp_channel_ban_user_free(vx_resp_channel_ban_user_t * resp);
typedef struct vx_resp_channel_get_banned_users {
vx_resp_base_t base;
int banned_users_count;
vx_participant_t** banned_users;
} vx_resp_channel_get_banned_users_t;
VIVOXSDK_DLLEXPORT void vx_resp_channel_get_banned_users_free(vx_resp_channel_get_banned_users_t * resp);
typedef struct vx_resp_channel_kick_user {
vx_resp_base_t base;
} vx_resp_channel_kick_user_t;
VIVOXSDK_DLLEXPORT void vx_resp_channel_kick_user_free(vx_resp_channel_kick_user_t * resp);
typedef struct vx_resp_channel_mute_all_users {
vx_resp_base_t base;
} vx_resp_channel_mute_all_users_t;
VIVOXSDK_DLLEXPORT void vx_resp_channel_mute_all_users_free(vx_resp_channel_mute_all_users_t * resp);
typedef struct vx_resp_connector_mute_local_mic {
vx_resp_base_t base;
} vx_resp_connector_mute_local_mic_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_mute_local_mic_free(vx_resp_connector_mute_local_mic_t * resp);
typedef struct vx_resp_connector_mute_local_speaker {
vx_resp_base_t base;
} vx_resp_connector_mute_local_speaker_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_mute_local_speaker_free(vx_resp_connector_mute_local_speaker_t * resp);
typedef struct vx_resp_connector_set_local_mic_volume {
vx_resp_base_t base;
} vx_resp_connector_set_local_mic_volume_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_set_local_mic_volume_free(vx_resp_connector_set_local_mic_volume_t * resp);
typedef struct vx_resp_connector_set_local_speaker_volume {
vx_resp_base_t base;
} vx_resp_connector_set_local_speaker_volume_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_set_local_speaker_volume_free(vx_resp_connector_set_local_speaker_volume_t * resp);
typedef struct vx_resp_connector_get_local_audio_info {
vx_resp_base_t base;
int speaker_volume;
int is_speaker_muted;
int mic_volume;
int is_mic_muted;
} vx_resp_connector_get_local_audio_info_t;
VIVOXSDK_DLLEXPORT void vx_resp_connector_get_local_audio_info_free(vx_resp_connector_get_local_audio_info_t * resp);
typedef struct vx_resp_account_buddy_set {
vx_resp_base_t base;
} vx_resp_account_buddy_set_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_buddy_set_free(vx_resp_account_buddy_set_t * resp);
typedef struct vx_resp_account_buddy_delete {
vx_resp_base_t base;
} vx_resp_account_buddy_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_buddy_delete_free(vx_resp_account_buddy_delete_t * resp);
typedef struct vx_resp_account_buddygroup_set {
vx_resp_base_t base;
int group_id;
} vx_resp_account_buddygroup_set_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_buddygroup_set_free(vx_resp_account_buddygroup_set_t * resp);
typedef struct vx_resp_account_buddygroup_delete {
vx_resp_base_t base;
} vx_resp_account_buddygroup_delete_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_buddygroup_delete_free(vx_resp_account_buddygroup_delete_t * resp);
typedef struct vx_resp_account_list_buddies_and_groups {
vx_resp_base_t base;
int buddy_count;
int group_count;
vx_buddy_t** buddies;
vx_group_t** groups;
} vx_resp_account_list_buddies_and_groups_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_list_buddies_and_groups_free(vx_resp_account_list_buddies_and_groups_t * resp);
typedef struct vx_resp_session_send_message {
vx_resp_base_t base;
} vx_resp_session_send_message_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_send_message_free(vx_resp_session_send_message_t * resp);
typedef struct vx_resp_account_set_presence {
vx_resp_base_t base;
} vx_resp_account_set_presence_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_set_presence_free(vx_resp_account_set_presence_t * resp);
typedef struct vx_resp_account_send_subscription_reply {
vx_resp_base_t base;
} vx_resp_account_send_subscription_reply_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_send_subscription_reply_free(vx_resp_account_send_subscription_reply_t * resp);
typedef struct vx_resp_session_send_notification {
vx_resp_base_t base;
} vx_resp_session_send_notification_t;
VIVOXSDK_DLLEXPORT void vx_resp_session_send_notification_free(vx_resp_session_send_notification_t * resp);
typedef struct vx_resp_account_create_block_rule {
vx_resp_base_t base;
} vx_resp_account_create_block_rule_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_create_block_rule_free(vx_resp_account_create_block_rule_t * resp);
typedef struct vx_resp_account_delete_block_rule {
vx_resp_base_t base;
} vx_resp_account_delete_block_rule_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_delete_block_rule_free(vx_resp_account_delete_block_rule_t * resp);
typedef struct vx_resp_account_list_block_rules {
vx_resp_base_t base;
int rule_count;
vx_block_rule_t** block_rules;
} vx_resp_account_list_block_rules_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_list_block_rules_free(vx_resp_account_list_block_rules_t * resp);
typedef struct vx_resp_account_create_auto_accept_rule {
vx_resp_base_t base;
} vx_resp_account_create_auto_accept_rule_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_create_auto_accept_rule_free(vx_resp_account_create_auto_accept_rule_t * resp);
typedef struct vx_resp_account_delete_auto_accept_rule {
vx_resp_base_t base;
} vx_resp_account_delete_auto_accept_rule_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_delete_auto_accept_rule_free(vx_resp_account_delete_auto_accept_rule_t * resp);
typedef struct vx_resp_account_list_auto_accept_rules {
vx_resp_base_t base;
int rule_count;
vx_auto_accept_rule_t** auto_accept_rules;
} vx_resp_account_list_auto_accept_rules_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_list_auto_accept_rules_free(vx_resp_account_list_auto_accept_rules_t * resp);
typedef struct vx_resp_account_update_account {
vx_resp_base_t base;
} vx_resp_account_update_account_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_update_account_free(vx_resp_account_update_account_t * resp);
typedef struct vx_resp_account_get_account {
vx_resp_base_t base;
vx_account_t* account;
} vx_resp_account_get_account_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_get_account_free(vx_resp_account_get_account_t * resp);
typedef struct vx_resp_account_send_sms {
vx_resp_base_t base;
} vx_resp_account_send_sms_t;
VIVOXSDK_DLLEXPORT void vx_resp_account_send_sms_free(vx_resp_account_send_sms_t * resp);
typedef struct vx_resp_aux_connectivity_info {
vx_resp_base_t base;
int count;
vx_connectivity_test_result_t** test_results;
char* well_known_ip;
char* stun_server;
char* echo_server;
int echo_port;
int timeout;
} vx_resp_aux_connectivity_info_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_connectivity_info_free(vx_resp_aux_connectivity_info_t * resp);
typedef struct vx_resp_aux_get_render_devices {
vx_resp_base_t base;
int count;
vx_device_t** render_devices;
vx_device_t* current_render_device;
} vx_resp_aux_get_render_devices_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_get_render_devices_free(vx_resp_aux_get_render_devices_t * resp);
typedef struct vx_resp_aux_get_capture_devices {
vx_resp_base_t base;
int count;
vx_device_t** capture_devices;
vx_device_t* current_capture_device;
} vx_resp_aux_get_capture_devices_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_get_capture_devices_free(vx_resp_aux_get_capture_devices_t * resp);
typedef struct vx_resp_aux_set_render_device {
vx_resp_base_t base;
} vx_resp_aux_set_render_device_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_set_render_device_free(vx_resp_aux_set_render_device_t * resp);
typedef struct vx_resp_aux_set_capture_device {
vx_resp_base_t base;
} vx_resp_aux_set_capture_device_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_set_capture_device_free(vx_resp_aux_set_capture_device_t * resp);
typedef struct vx_resp_aux_get_mic_level {
vx_resp_base_t base;
int level;
} vx_resp_aux_get_mic_level_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_get_mic_level_free(vx_resp_aux_get_mic_level_t * resp);
typedef struct vx_resp_aux_get_speaker_level {
vx_resp_base_t base;
int level;
} vx_resp_aux_get_speaker_level_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_get_speaker_level_free(vx_resp_aux_get_speaker_level_t * resp);
typedef struct vx_resp_aux_set_mic_level {
vx_resp_base_t base;
} vx_resp_aux_set_mic_level_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_set_mic_level_free(vx_resp_aux_set_mic_level_t * resp);
typedef struct vx_resp_aux_set_speaker_level {
vx_resp_base_t base;
} vx_resp_aux_set_speaker_level_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_set_speaker_level_free(vx_resp_aux_set_speaker_level_t * resp);
typedef struct vx_resp_aux_render_audio_start {
vx_resp_base_t base;
} vx_resp_aux_render_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_render_audio_start_free(vx_resp_aux_render_audio_start_t * resp);
typedef struct vx_resp_aux_render_audio_stop {
vx_resp_base_t base;
} vx_resp_aux_render_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_render_audio_stop_free(vx_resp_aux_render_audio_stop_t * resp);
typedef struct vx_resp_aux_capture_audio_start {
vx_resp_base_t base;
} vx_resp_aux_capture_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_capture_audio_start_free(vx_resp_aux_capture_audio_start_t * resp);
typedef struct vx_resp_aux_capture_audio_stop {
vx_resp_base_t base;
} vx_resp_aux_capture_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_capture_audio_stop_free(vx_resp_aux_capture_audio_stop_t * resp);
typedef struct {
vx_resp_base_t base;
} vx_resp_aux_global_monitor_keyboard_mouse_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_global_monitor_keyboard_mouse_free(vx_resp_aux_global_monitor_keyboard_mouse_t * resp);
typedef struct {
vx_resp_base_t base;
} vx_resp_aux_set_idle_timeout_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_set_idle_timeout_free(vx_resp_aux_set_idle_timeout_t * resp);
typedef struct {
vx_resp_base_t base;
} vx_resp_aux_create_account_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_create_account_free(vx_resp_aux_create_account_t * resp);
typedef struct {
vx_resp_base_t base;
} vx_resp_aux_reactivate_account_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_reactivate_account_free(vx_resp_aux_reactivate_account_t * resp);
typedef struct {
vx_resp_base_t base;
} vx_resp_aux_deactivate_account_t;
VIVOXSDK_DLLEXPORT void vx_resp_aux_deactivate_account_free(vx_resp_aux_deactivate_account_t * resp);
/* End Vivox responses */
extern void VIVOXSDK_DLLEXPORT destroy_resp(vx_resp_base_t *pCmd);
#ifdef __cplusplus
}
#endif
#endif /* ndef __VXCRESPONSES_H__ */
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/vq/latticebuild.c
|
<filename>lib/vorbis/vq/latticebuild.c
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: utility main for building codebooks from lattice descriptions
last mod: $Id: latticebuild.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include "bookutil.h"
/* The purpose of this util is just to finish packaging the
description into a static codebook. It used to count hits for a
histogram, but I've divorced that out to add some flexibility (it
currently generates an equal probability codebook)
command line:
latticebuild description.vql
the lattice description file contains two lines:
<n> <dim> <multiplicitavep> <sequentialp>
<value_0> <value_1> <value_2> ... <value_n-1>
a threshmap (or pigeonmap) struct is generated by latticehint;
there are fun tricks one can do with the threshmap and cascades,
but the utils don't know them...
entropy encoding is done by feeding an entry list collected from a
training set and feeding it to latticetune along with the book.
latticebuild produces a codebook on stdout */
static int ilog(unsigned int v){
int ret=0;
while(v){
ret++;
v>>=1;
}
return(ret);
}
int main(int argc,char *argv[]){
codebook b;
static_codebook c;
double *quantlist;
long *hits;
int entries=-1,dim=-1,quantvals=-1,addmul=-1,sequencep=0;
FILE *in=NULL;
char *line,*name;
long i,j;
memset(&b,0,sizeof(b));
memset(&c,0,sizeof(c));
if(argv[1]==NULL){
fprintf(stderr,"Need a lattice description file on the command line.\n");
exit(1);
}
{
char *ptr;
char *filename=_ogg_calloc(strlen(argv[1])+4,1);
strcpy(filename,argv[1]);
in=fopen(filename,"r");
if(!in){
fprintf(stderr,"Could not open input file %s\n",filename);
exit(1);
}
ptr=strrchr(filename,'.');
if(ptr){
*ptr='\0';
name=strdup(filename);
}else{
name=strdup(filename);
}
}
/* read the description */
line=get_line(in);
if(sscanf(line,"%d %d %d %d",&quantvals,&dim,&addmul,&sequencep)!=4){
if(sscanf(line,"%d %d %d",&quantvals,&dim,&addmul)!=3){
fprintf(stderr,"Syntax error reading description file (line 1)\n");
exit(1);
}
}
entries=pow(quantvals,dim);
c.dim=dim;
c.entries=entries;
c.lengthlist=_ogg_malloc(entries*sizeof(long));
c.maptype=1;
c.q_sequencep=sequencep;
c.quantlist=_ogg_calloc(quantvals,sizeof(long));
quantlist=_ogg_malloc(sizeof(double)*c.dim*c.entries);
hits=_ogg_malloc(c.entries*sizeof(long));
for(j=0;j<entries;j++)hits[j]=1;
for(j=0;j<entries;j++)c.lengthlist[j]=1;
reset_next_value();
line=setup_line(in);
for(j=0;j<quantvals;j++){
char *temp;
if(!line || sscanf(line,"%lf",quantlist+j)!=1){
fprintf(stderr,"Ran out of data on line 2 of description file\n");
exit(1);
}
temp=strchr(line,',');
if(!temp)temp=strchr(line,' ');
if(temp)temp++;
line=temp;
}
/* gen a real quant list from the more easily human-grokked input */
{
double min=quantlist[0];
double mindel=-1;
int fac=1;
for(j=1;j<quantvals;j++)if(quantlist[j]<min)min=quantlist[j];
for(j=0;j<quantvals;j++)
for(i=j+1;i<quantvals;i++)
if(mindel==-1 || fabs(quantlist[j]-quantlist[i])<mindel)
mindel=fabs(quantlist[j]-quantlist[i]);
j=0;
while(j<quantvals){
for(j=0;j<quantvals;j++){
double test=fac*(quantlist[j]-min)/mindel;
if( fabs(rint(test)-test)>.00001f) break;
}
if(fac>100)break;
if(j<quantvals)fac++;
}
mindel/=fac;
fprintf(stderr,"min=%g mindel=%g\n",min,mindel);
c.q_min=_float32_pack(min);
c.q_delta=_float32_pack(mindel);
c.q_quant=0;
min=_float32_unpack(c.q_min);
mindel=_float32_unpack(c.q_delta);
for(j=0;j<quantvals;j++){
c.quantlist[j]=rint((quantlist[j]-min)/mindel);
if(ilog(c.quantlist[j])>c.q_quant)c.q_quant=ilog(c.quantlist[j]);
}
}
/* build the [default] codeword lengths */
memset(c.lengthlist,0,sizeof(long)*entries);
for(i=0;i<entries;i++)hits[i]=1;
build_tree_from_lengths(entries,hits,c.lengthlist);
/* save the book in C header form */
write_codebook(stdout,name,&c);
fprintf(stderr,"\r "
"\nDone.\n");
exit(0);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/SpeedTreeWrapper/SpeedTreeWrapper.h
|
// SpeedTreeWrapper.h
#pragma once
#using <mscorlib.dll>
using namespace System;
using System::Runtime::InteropServices::Marshal;
#include "SpeedTreeRT.h"
#include "SpeedWind.h"
namespace Multiverse {
public __value enum WindMethod
{
WindGPU, WindCPU, WindNone
};
enum LodMethod
{
LODPop, LODSmooth, LODNone = 3
};
enum LightingMethod
{
LightDynamic, LightStatic
};
enum StaticLightingType
{
SLSBasic, SLSUseLightSources, SLSSimulateShadows
};
public enum CollisionObjectType
{
ColSphere, ColCylinder, ColBox
};
public __gc struct TreeTextures
{
// branches
String __gc *BranchTextureFilename;
// leaves
String __gc *LeafTextureFilenames[];
// fronds
String __gc *FrondTextureFilenames[];
// composite
String __gc *CompositeFilename;
// self-shadow
String __gc *SelfShadowFilename;
};
public __value struct Color
{
float r;
float g;
float b;
Color() : r(0), g(0), b(0) {}
Color(float r, float g, float b) : r(r), g(g), b(b) {}
};
public __value struct V3
{
float x;
float y;
float z;
V3() : x(0), y(0), z(0) {}
V3(float x, float y, float z) : x(x), y(y), z(z) {}
};
public __value struct V4
{
float x;
float y;
float z;
float w;
V4() : x(0), y(0), z(0), w(0) {}
V4(float x, float y, float z, float w) : x(x), y(y), z(z), w(w) {}
};
public __gc struct TreeMaterial
{
Color Diffuse;
Color Ambient;
Color Specular;
Color Emmisive;
float shininess;
};
public __gc struct TreeLight
{
V3 position;
Color Diffuse;
Color Ambient;
Color Specular;
bool directional;
float attenuationConst;
float attenuationLinear;
float attenuationQuad;
};
public __gc struct TreeCamera
{
V3 position;
V3 direction;
};
public __gc struct TreeBox
{
V3 min;
V3 max;
TreeBox(V3 min, V3 max) : min(min), max(max) {}
};
public __gc class TreeGeometry
{
public:
__gc class Indexed
{
public:
Indexed(CSpeedTreeRT::SGeometry::SIndexed __nogc *init);
// these values change depending on the active discrete LOD level
__property int get_DiscreteLodLevel();
__property unsigned short get_NumStrips();
__property const unsigned short __nogc * get_StripLengths();
__property const unsigned short __nogc * __nogc * get_Strips();
// these values are shared across all discrete LOD levels
__property unsigned short get_VertexCount();
__property const unsigned long* get_Colors();
__property const float* get_Normals();
__property const float* get_Binormals();
__property const float* get_Tangents();
__property const float* get_Coords();
__property const float* get_TexCoords0();
__property const float* get_TexCoords1();
__property const float* get_WindWeights();
__property const unsigned char* get_WindMatrixIndices();
private:
CSpeedTreeRT::SGeometry::SIndexed __nogc *indexed;
};
__gc class Leaf
{
public:
Leaf(CSpeedTreeRT::SGeometry::SLeaf __nogc *init);
// active LOD level data
__property bool get_IsActive();
__property float get_AlphaTestValue();
__property int get_DiscreteLodLevel();
__property unsigned short get_LeafCount();
// tables for referencing the leaf cluster table
__property const unsigned char* get_LeafMapIndices();
__property const unsigned char* get_LeafClusterIndices();
__property const float* get_CenterCoords();
__property const float** get_LeafMapTexCoords();
__property const float** get_LeafMapCoords();
// remaining vertex attributes
__property const unsigned long* get_Colors();
__property const float* get_Normals();
__property const float* get_Binormals();
__property const float* get_Tangents();
__property const float* get_WindWeights();
__property const unsigned char* get_WindMatrixIndices();
private:
CSpeedTreeRT::SGeometry::SLeaf __nogc *leaf;
};
__gc class Billboard
{
public:
Billboard(CSpeedTreeRT::SGeometry::SBillboard __nogc *init);
__property bool get_IsActive();
__property const float* get_TexCoords();
__property const float* get_Coords();
__property float get_AlphaTestValue();
private:
CSpeedTreeRT::SGeometry::SBillboard __nogc *billboard;
};
TreeGeometry();
~TreeGeometry();
__property CSpeedTreeRT::SGeometry __nogc *get_UnmanagedGeometry();
__property Indexed *get_Branches();
__property Indexed *get_Fronds();
__property float get_BranchAlphaTestValue();
__property float get_FrondAlphaTestValue();
__property Leaf *get_Leaves0();
__property Leaf *get_Leaves1();
__property Billboard *get_Billboard0();
__property Billboard *get_Billboard1();
__property Billboard *get_HorizontalBillboard();
private:
CSpeedTreeRT::SGeometry __nogc *geometry;
};
public __gc struct TreeCollisionObject
{
public:
CollisionObjectType type;
V3 position;
V3 dimensions;
TreeCollisionObject(CollisionObjectType type, V3 position, V3 dimensions) :
type(type), position(position), dimensions(dimensions) {};
};
public __gc class SpeedTreeWrapper
{
public:
__value enum GeometryFlags
{
BranchGeometry = 1,
FrondGeometry = 2,
LeafGeometry = 4,
BillboardGeometry = 8,
SimpleBillboardOverride = 16,
Nearest360Override = 32,
AllGeometry = 15
};
SpeedTreeWrapper();
~SpeedTreeWrapper() {}
SpeedTreeWrapper * MakeInstance();
bool LoadTree(String *filename);
bool LoadTree(unsigned char buffer __gc [], unsigned int len);
bool Compute(float transform __gc [], unsigned int seed, bool compositeStrips);
SpeedTreeWrapper * Clone(V3 position, unsigned int seed);
void DeleteTransientData();
__property V3 get_TreePosition();
__property void set_TreePosition(V3 position);
void GetTreeSize(float __gc & size, float __gc &variance);
void SetTreeSize(float size, float variance);
__property unsigned int get_Seed();
__property SpeedTreeWrapper * get_InstanceOf() { return instanceOf; };
__property bool get_IsInstance() { return isInstance; };
__property void set_LeafTargetAlphaMask(unsigned char mask);
__property LightingMethod get_BranchLightingMethod();
__property void set_BranchLightingMethod(LightingMethod method);
__property LightingMethod get_FrondLightingMethod();
__property void set_FrondLightingMethod(LightingMethod method);
__property LightingMethod get_LeafLightingMethod();
__property void set_LeafLightingMethod(LightingMethod method);
__property TreeMaterial __gc *get_BranchMaterial();
__property void set_BranchMaterial(TreeMaterial __gc *mat);
__property TreeMaterial __gc *get_FrondMaterial();
__property void set_FrondMaterial(TreeMaterial __gc *mat);
__property TreeMaterial __gc *get_LeafMaterial();
__property void set_LeafMaterial(TreeMaterial __gc *mat);
__property float get_LeafLightingAdjustment();
__property void set_LeafLightingAdjustment(float adj);
__property TreeLight __gc *get_LightAttributes(unsigned int lightIndex);
__property void set_LightAttributes(unsigned int lightIndex, TreeLight __gc *light);
__property bool get_LightState(unsigned int lightIndex);
__property void set_LightState(unsigned int lightIndex, bool state);
__property StaticLightingType get_StaticLightingStyle();
__property void set_StaticLightingStyle(StaticLightingType style);
__property static TreeCamera __gc *get_Camera();
__property static void set_Camera(TreeCamera __gc *camera);
void GetGeometry(TreeGeometry __gc *treeGeometry, GeometryFlags flags,
short overrideBranchLodValue, short overrideFrondLodValue, short overrideLeafLodValue);
__property TreeTextures __gc *get_Textures();
__property bool get_TextureFlip();
__property void set_TextureFlip(bool flip);
__property TreeBox __gc *get_BoundingBox();
void GetLodLimits(float __gc & near, float __gc &far);
void SetLodLimits(float near, float far);
static void SetDropToBillboard(bool flag);
void ComputeLodLevel();
void SetWindStrengthAndLeafAngles(float newStrength, float rockAngles __gc [], float rustleAngles __gc []);
__property WindMethod get_BranchWindMethod();
__property void set_BranchWindMethod(WindMethod method);
__property WindMethod get_FrondWindMethod();
__property void set_FrondWindMethod(WindMethod method);
__property WindMethod get_LeafWindMethod();
__property void set_LeafWindMethod(WindMethod method);
__property void set_NumLeafRockingGroups(unsigned int n);
__property unsigned int get_NumBranchLodLevels();
__property unsigned int get_NumFrondLodLevels();
__property unsigned int get_NumLeafLodLevels();
__property V4 get_LeafBillboardTable() __gc[];
__property float get_LeafLodSizeAdjustments() __gc[];
__property static void set_Time(float t);
__property unsigned int get_CollisionObjectCount();
TreeCollisionObject __gc *CollisionObject(unsigned int index);
__property float get_OriginalSize();
__property void set_OriginalSize(float size);
private:
CSpeedTreeRT *speedTree;
bool isInstance;
SpeedTreeWrapper * instanceOf;
float originalSize;
SpeedTreeWrapper(bool isInstance, SpeedTreeWrapper *instanceOf, CSpeedTreeRT *speedTree);
char *GetUnManagedString(String * s);
TreeMaterial __gc *MaterialFromFloats(const float *m);
void MaterialToFloats(TreeMaterial __gc *mat, float *m);
};
public __gc class SpeedWindWrapper
{
public:
SpeedWindWrapper();
~SpeedWindWrapper() {}
void CreateWindMatrices();
void ResetMatrices();
float Advance(float time, float strength, V3 direction);
void UpdateSpeedTreeRT();
__property float get_ActualStrength();
__property int get_NumWindMatrices();
__property float get_WindMatrix(unsigned int index) __gc [];
__property int get_NumLeafAngles();
void BuildLeafAngleMatrices(V3 cameraDirection);
__property float get_LeafAngleMatrix(unsigned int index) __gc[];
bool Load(String __gc *filename);
private:
CSpeedWind *speedWind;
char *GetUnManagedString(String * s);
};
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/lsp.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: LSP (also called LSF) conversion routines
last mod: $Id: lsp.c 2892 2005-12-02 20:42:19Z mccollum $
The LSP generation code is taken (with minimal modification and a
few bugfixes) from "On the Computation of the LSP Frequencies" by
<NAME> (see http://www.rothweiler.us for contact info).
The paper is available at:
http://www.myown1.com/joe/lsf
********************************************************************/
/* Note that the lpc-lsp conversion finds the roots of polynomial with
an iterative root polisher (CACM algorithm 283). It *is* possible
to confuse this algorithm into not converging; that should only
happen with absurdly closely spaced roots (very sharp peaks in the
LPC f response) which in turn should be impossible in our use of
the code. If this *does* happen anyway, it's a bug in the floor
finder; find the cause of the confusion (probably a single bin
spike or accidental near-float-limit resolution problems) and
correct it. */
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include "lsp.h"
#include "os.h"
#include "misc.h"
#include "lookup.h"
#include "scales.h"
/* three possible LSP to f curve functions; the exact computation
(float), a lookup based float implementation, and an integer
implementation. The float lookup is likely the optimal choice on
any machine with an FPU. The integer implementation is *not* fixed
point (due to the need for a large dynamic range and thus a
seperately tracked exponent) and thus much more complex than the
relatively simple float implementations. It's mostly for future
work on a fully fixed point implementation for processors like the
ARM family. */
/* undefine both for the 'old' but more precise implementation */
#define FLOAT_LOOKUP
#undef INT_LOOKUP
#ifdef FLOAT_LOOKUP
#include "lookup.c" /* catch this in the build system; we #include for
compilers (like gcc) that can't inline across
modules */
/* side effect: changes *lsp to cosines of lsp */
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
float amp,float ampoffset){
int i;
float wdel=M_PI/ln;
vorbis_fpu_control fpu;
vorbis_fpu_setround(&fpu);
for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
i=0;
while(i<n){
int k=map[i];
int qexp;
float p=.7071067812f;
float q=.7071067812f;
float w=vorbis_coslook(wdel*k);
float *ftmp=lsp;
int c=m>>1;
do{
q*=ftmp[0]-w;
p*=ftmp[1]-w;
ftmp+=2;
}while(--c);
if(m&1){
/* odd order filter; slightly assymetric */
/* the last coefficient */
q*=ftmp[0]-w;
q*=q;
p*=p*(1.f-w*w);
}else{
/* even order filter; still symmetric */
q*=q*(1.f+w);
p*=p*(1.f-w);
}
q=frexp(p+q,&qexp);
q=vorbis_fromdBlook(amp*
vorbis_invsqlook(q)*
vorbis_invsq2explook(qexp+m)-
ampoffset);
do{
curve[i++]*=q;
}while(map[i]==k);
}
vorbis_fpu_restore(fpu);
}
#else
#ifdef INT_LOOKUP
#include "lookup.c" /* catch this in the build system; we #include for
compilers (like gcc) that can't inline across
modules */
static int MLOOP_1[64]={
0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
};
static int MLOOP_2[64]={
0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
};
static int MLOOP_3[8]={0,1,2,2,3,3,3,3};
/* side effect: changes *lsp to cosines of lsp */
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
float amp,float ampoffset){
/* 0 <= m < 256 */
/* set up for using all int later */
int i;
int ampoffseti=rint(ampoffset*4096.f);
int ampi=rint(amp*16.f);
long *ilsp=alloca(m*sizeof(*ilsp));
for(i=0;i<m;i++)ilsp[i]=vorbis_coslook_i(lsp[i]/M_PI*65536.f+.5f);
i=0;
while(i<n){
int j,k=map[i];
unsigned long pi=46341; /* 2**-.5 in 0.16 */
unsigned long qi=46341;
int qexp=0,shift;
long wi=vorbis_coslook_i(k*65536/ln);
qi*=labs(ilsp[0]-wi);
pi*=labs(ilsp[1]-wi);
for(j=3;j<m;j+=2){
if(!(shift=MLOOP_1[(pi|qi)>>25]))
if(!(shift=MLOOP_2[(pi|qi)>>19]))
shift=MLOOP_3[(pi|qi)>>16];
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
pi=(pi>>shift)*labs(ilsp[j]-wi);
qexp+=shift;
}
if(!(shift=MLOOP_1[(pi|qi)>>25]))
if(!(shift=MLOOP_2[(pi|qi)>>19]))
shift=MLOOP_3[(pi|qi)>>16];
/* pi,qi normalized collectively, both tracked using qexp */
if(m&1){
/* odd order filter; slightly assymetric */
/* the last coefficient */
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
pi=(pi>>shift)<<14;
qexp+=shift;
if(!(shift=MLOOP_1[(pi|qi)>>25]))
if(!(shift=MLOOP_2[(pi|qi)>>19]))
shift=MLOOP_3[(pi|qi)>>16];
pi>>=shift;
qi>>=shift;
qexp+=shift-14*((m+1)>>1);
pi=((pi*pi)>>16);
qi=((qi*qi)>>16);
qexp=qexp*2+m;
pi*=(1<<14)-((wi*wi)>>14);
qi+=pi>>14;
}else{
/* even order filter; still symmetric */
/* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
worth tracking step by step */
pi>>=shift;
qi>>=shift;
qexp+=shift-7*m;
pi=((pi*pi)>>16);
qi=((qi*qi)>>16);
qexp=qexp*2+m;
pi*=(1<<14)-wi;
qi*=(1<<14)+wi;
qi=(qi+pi)>>14;
}
/* we've let the normalization drift because it wasn't important;
however, for the lookup, things must be normalized again. We
need at most one right shift or a number of left shifts */
if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
qi>>=1; qexp++;
}else
while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
qi<<=1; qexp--;
}
amp=vorbis_fromdBlook_i(ampi* /* n.4 */
vorbis_invsqlook_i(qi,qexp)-
/* m.8, m+n<=8 */
ampoffseti); /* 8.12[0] */
curve[i]*=amp;
while(map[++i]==k)curve[i]*=amp;
}
}
#else
/* old, nonoptimized but simple version for any poor sap who needs to
figure out what the hell this code does, or wants the other
fraction of a dB precision */
/* side effect: changes *lsp to cosines of lsp */
void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
float amp,float ampoffset){
int i;
float wdel=M_PI/ln;
for(i=0;i<m;i++)lsp[i]=2.f*cos(lsp[i]);
i=0;
while(i<n){
int j,k=map[i];
float p=.5f;
float q=.5f;
float w=2.f*cos(wdel*k);
for(j=1;j<m;j+=2){
q *= w-lsp[j-1];
p *= w-lsp[j];
}
if(j==m){
/* odd order filter; slightly assymetric */
/* the last coefficient */
q*=w-lsp[j-1];
p*=p*(4.f-w*w);
q*=q;
}else{
/* even order filter; still symmetric */
p*=p*(2.f-w);
q*=q*(2.f+w);
}
q=fromdB(amp/sqrt(p+q)-ampoffset);
curve[i]*=q;
while(map[++i]==k)curve[i]*=q;
}
}
#endif
#endif
static void cheby(float *g, int ord) {
int i, j;
g[0] *= .5f;
for(i=2; i<= ord; i++) {
for(j=ord; j >= i; j--) {
g[j-2] -= g[j];
g[j] += g[j];
}
}
}
static int comp(const void *a,const void *b){
return (*(float *)a<*(float *)b)-(*(float *)a>*(float *)b);
}
/* Newton-Raphson-Maehly actually functioned as a decent root finder,
but there are root sets for which it gets into limit cycles
(exacerbated by zero suppression) and fails. We can't afford to
fail, even if the failure is 1 in 100,000,000, so we now use
Laguerre and later polish with Newton-Raphson (which can then
afford to fail) */
#define EPSILON 10e-7
static int Laguerre_With_Deflation(float *a,int ord,float *r){
int i,m;
double lastdelta=0.f;
double *defl=alloca(sizeof(*defl)*(ord+1));
for(i=0;i<=ord;i++)defl[i]=a[i];
for(m=ord;m>0;m--){
double new=0.f,delta;
/* iterate a root */
while(1){
double p=defl[m],pp=0.f,ppp=0.f,denom;
/* eval the polynomial and its first two derivatives */
for(i=m;i>0;i--){
ppp = new*ppp + pp;
pp = new*pp + p;
p = new*p + defl[i-1];
}
/* Laguerre's method */
denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
if(denom<0)
return(-1); /* complex root! The LPC generator handed us a bad filter */
if(pp>0){
denom = pp + sqrt(denom);
if(denom<EPSILON)denom=EPSILON;
}else{
denom = pp - sqrt(denom);
if(denom>-(EPSILON))denom=-(EPSILON);
}
delta = m*p/denom;
new -= delta;
if(delta<0.f)delta*=-1;
if(fabs(delta/new)<10e-12)break;
lastdelta=delta;
}
r[m-1]=new;
/* forward deflation */
for(i=m;i>0;i--)
defl[i-1]+=new*defl[i];
defl++;
}
return(0);
}
/* for spit-and-polish only */
static int Newton_Raphson(float *a,int ord,float *r){
int i, k, count=0;
double error=1.f;
double *root=alloca(ord*sizeof(*root));
for(i=0; i<ord;i++) root[i] = r[i];
while(error>1e-20){
error=0;
for(i=0; i<ord; i++) { /* Update each point. */
double pp=0.,delta;
double rooti=root[i];
double p=a[ord];
for(k=ord-1; k>= 0; k--) {
pp= pp* rooti + p;
p = p * rooti + a[k];
}
delta = p/pp;
root[i] -= delta;
error+= delta*delta;
}
if(count>40)return(-1);
count++;
}
/* Replaced the original bubble sort with a real sort. With your
help, we can eliminate the bubble sort in our lifetime. --Monty */
for(i=0; i<ord;i++) r[i] = root[i];
return(0);
}
/* Convert lpc coefficients to lsp coefficients */
int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
int order2=(m+1)>>1;
int g1_order,g2_order;
float *g1=alloca(sizeof(*g1)*(order2+1));
float *g2=alloca(sizeof(*g2)*(order2+1));
float *g1r=alloca(sizeof(*g1r)*(order2+1));
float *g2r=alloca(sizeof(*g2r)*(order2+1));
int i;
/* even and odd are slightly different base cases */
g1_order=(m+1)>>1;
g2_order=(m) >>1;
/* Compute the lengths of the x polynomials. */
/* Compute the first half of K & R F1 & F2 polynomials. */
/* Compute half of the symmetric and antisymmetric polynomials. */
/* Remove the roots at +1 and -1. */
g1[g1_order] = 1.f;
for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i];
g2[g2_order] = 1.f;
for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i];
if(g1_order>g2_order){
for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2];
}else{
for(i=1; i<=g1_order;i++) g1[g1_order-i] -= g1[g1_order-i+1];
for(i=1; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+1];
}
/* Convert into polynomials in cos(alpha) */
cheby(g1,g1_order);
cheby(g2,g2_order);
/* Find the roots of the 2 even polynomials.*/
if(Laguerre_With_Deflation(g1,g1_order,g1r) ||
Laguerre_With_Deflation(g2,g2_order,g2r))
return(-1);
Newton_Raphson(g1,g1_order,g1r); /* if it fails, it leaves g1r alone */
Newton_Raphson(g2,g2_order,g2r); /* if it fails, it leaves g2r alone */
qsort(g1r,g1_order,sizeof(*g1r),comp);
qsort(g2r,g2_order,sizeof(*g2r),comp);
for(i=0;i<g1_order;i++)
lsp[i*2] = acos(g1r[i]);
for(i=0;i<g2_order;i++)
lsp[i*2+1] = acos(g2r[i]);
return(0);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/FastDXT/FastDXT/FastDXT.h
|
<gh_stars>10-100
// The following ifdef block is the standard way of creating macros which make exporting
// from a DLL simpler. All files within this DLL are compiled with the FASTDXT_EXPORTS
// symbol defined on the command line. this symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see
// FASTDXT_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef FASTDXT_EXPORTS
#define FASTDXT_API __declspec(dllexport)
#else
#define FASTDXT_API __declspec(dllimport)
#endif
extern void initialize(void);
extern FASTDXT_API BOOL HasMMX;
extern FASTDXT_API BOOL HasSSE2;
extern "C" FASTDXT_API BOOL GetHasMMX(void);
extern "C" FASTDXT_API BOOL GetHasSSE2(void);
typedef unsigned char byte;
typedef unsigned short word;
typedef unsigned int dword;
extern "C" FASTDXT_API void CompressImageDXT1( const byte *inBuf, byte *outBuf, int width, int height );
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/ResponseManager.h
|
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
//#include "SDKSampleApp.h"
#include <fstream>
#include <iostream>
#ifdef WIN32
#include <direct.h>
#else
#include <sys/types.h>
#include <sys/stat.h>
#endif
#include <vector>
#include <ctime>
#include "StateManager.h"
class ResponseManager
{
StateManager * stateMgr;
void WriteToFile(const char*);
std::string CreateTimeStamp();
void CreateFolder(std::string);
int debuglevel;
bool stopOnShutdownResponse;
bool stopNow;
std::string FormatXml(std::string);
public:
ResponseManager(StateManager *);
~ResponseManager();
void WriteResponseToFile(vx_resp_base_t*);
void WriteEventToFile(vx_evt_base_t*);
void SetDebug(int);
// Response methods. These are called to handle the appropriate Response.
void resp_ConnectorCreate(vx_resp_connector_create_t*); //required for state mgmt
void resp_ConnectorShutdown(vx_resp_connector_initiate_shutdown_t*); //required for state mgmt
void resp_SGSetTXSession(vx_resp_sessiongroup_set_tx_session_t*);
void resp_SGSetTXAll(vx_resp_sessiongroup_set_tx_all_sessions_t*);
void resp_SGSetTXNone(vx_resp_sessiongroup_set_tx_no_session_t*);
void resp_ChannelCreate(vx_resp_account_channel_create_t*);
void resp_ChannelFolderCreate(vx_resp_account_channel_folder_create_t*);
void resp_ChannelFavSet(vx_resp_account_channel_favorite_set_t*);
void resp_ChannelFavGroupSet(vx_resp_account_channel_favorite_group_set_t*);
void resp_NetworkTest(vx_resp_aux_connectivity_info_t*);
void resp_ListRenderDevices(vx_resp_aux_get_render_devices_t* respObj);
void resp_ListCaptureDevices(vx_resp_aux_get_capture_devices_t* respObj);
// Events
void evt_Generic(vx_evt_base_t*);
void evt_AccountLoginStateChange(vx_evt_account_login_state_change_t*);
void evt_SessionGroupAdded(vx_evt_sessiongroup_added_t*);
void evt_SessionGroupRemoved(vx_evt_sessiongroup_removed_t*);
void evt_SessionAdded(vx_evt_session_added_t*);
void evt_SessionRemoved(vx_evt_session_removed_t*);
void evt_MediaStreamUpdated(vx_evt_media_stream_updated_t*);
void evt_TextStreamUpdated(vx_evt_text_stream_updated_t*);
void evt_Message(vx_evt_message_t*);
void evt_BuddyPresenceChange(vx_evt_buddy_presence_t* evtObj);
void evt_BuddyChanged(vx_evt_buddy_changed_t *evtObj);
void evt_BuddyGroupChanged(vx_evt_buddy_group_changed_t *evtObj);
void evt_AuxAudioProperties(vx_evt_aux_audio_properties_t* evtObj);
void Stop(bool waitForShutdown);
bool IsStopped() const;
};
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/shared/include/OgreMayaMaterial.h
|
<filename>tools/MayaExport/shared/include/OgreMayaMaterial.h
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_MAT_H_
#define _OGREMAYA_MAT_H_
#include "OgreMayaCommon.h"
#include <maya/MFnMesh.h>
#include <fstream>
#include <string>
#include <list>
#include <vector>
namespace OgreMaya {
// using namespace std;
using std::string;
using std::list;
using std::vector;
struct TextureUnitState {
TextureUnitState(string textureName, int uvSet):
textureName(textureName), uvSet(uvSet) {}
string textureName;
int uvSet;
};
typedef list<TextureUnitState> TextureLayerList;
struct Material {
string name;
string shadingMode;
ColourValue ambient;
ColourValue diffuse;
ColourValue selfIllumination;
ColourValue specular;
Real shininess;
TextureLayerList textureLayers;
};
// ===========================================================================
/** \class MatGenerator
\author <NAME>, Fifty1 Software Inc.
\version 1.0
\date June 2003
Generates an Ogre material file from a Maya scene.
*/
// ===========================================================================
class MatGenerator {
public:
/// Utility function for other classes
/// \return Name of the material attached to the given mesh
static MString getMaterialName(MFnMesh &fnMesh);
/// Standard constructor.
MatGenerator();
/// Destructor.
virtual ~MatGenerator();
/// Export the complete Maya scene (called by OgreMaya.mll or OgreMaya.exe).
bool exportAll();
/// Export selected parts of the Maya scene (called by OgreMaya.mll).
bool exportSelection();
protected:
vector<Material*> materials;
bool _extractMaterials();
void _makeMaterials(MObject &ShaderSet);
Material* _makePhongMaterial(MObject &ShaderNode);
Material* _makeBlinnMaterial(MObject &ShaderNode);
Material* _makeLambertMaterial(MObject &ShaderNode);
};
} // namespace OgreMaya
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/BridgeInterface/Socket.h
|
<filename>lib/BridgeInterface/BridgeInterface/Socket.h
#pragma once
#include <winsock.h>
class __declspec(dllexport) Socket {
private:
static int wsa_error;
public:
static int Startup();
static void Cleanup();
private:
SOCKET sd;
protected:
unsigned int ResolveHostname(const char *hostname);
public:
Socket();
~Socket();
int Dispose();
int Connect(const char *hostname, unsigned short port);
int Write(const unsigned char *data, int len);
int Write(const unsigned char *data, int offset, int len);
int Read(unsigned char *buf, int len);
int Read(unsigned char *buf, int offset, int len);
int Close();
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/BridgeInterface/Message.h
|
<filename>lib/BridgeInterface/BridgeInterface/Message.h
#pragma once
#include "MessageException.h"
class __declspec(dllexport) Vector {
public:
Vector() { x = 0; y = 0; z = 0; }
float x;
float y;
float z;
};
class __declspec(dllexport) IntVector {
public:
IntVector() { x = 0; y = 0; z = 0; }
int x;
int y;
int z;
};
class __declspec(dllexport) Quaternion {
public:
Quaternion() { x = 0; y = 0; z = 0; w = 1; }
static Quaternion FromAngleAxis(float angle, const Vector &axis);
static Quaternion RotateAroundYAxis(float angle);
float x;
float y;
float z;
float w;
};
// This class is the container for the data of the messages.
// The various message classes read and write to one of these
// buffer objects, which is then used to read or write to the
// network connection.
class __declspec(dllexport) MessageBuffer {
private:
std::vector<unsigned char> buf;
int read_offset;
int mark_offset;
public:
MessageBuffer();
int GetLength() const;
const unsigned char *GetData() const;
void SetData(const unsigned char *d, int l);
void Mark();
void Reset();
void WriteBool(bool data);
void WriteByte(unsigned char data);
void WriteInt32(int data);
void WriteSingle(float data);
void WriteInt64(long long data);
void WriteString(const std::string &msg);
void WriteVector(const Vector &vec);
void WriteIntVector(const IntVector &vec);
void WriteQuaternion(const Quaternion &quaternion);
bool ReadBool();
unsigned char ReadByte();
int ReadInt32();
float ReadSingle();
long long ReadInt64();
std::string ReadString();
void ReadString(std::string &msg);
void ReadVector(Vector &vec);
void ReadIntVector(IntVector &vec);
void ReadQuaternion(Quaternion &quaternion);
bool PeekBool();
unsigned char PeekByte();
int PeekInt32();
long long PeekInt64();
std::string PeekString();
private:
void WriteData(const unsigned char *data, int len);
void ReadData(unsigned char *data, int len);
};
// Base class from which all of the standard messages are derived
class __declspec(dllexport) BaseMessage {
protected:
// Parse the message buffer
virtual void ParseMessage(MessageBuffer &msg) = 0;
// Write our data to the message buffer
virtual void WriteMessage(MessageBuffer &msg) const = 0;
public:
virtual std::string GetTopic() const;
// Populate our data fields based on the contents of the message buffer
void ParseMessageBuffer(MessageBuffer &msg);
// Generate a message buffer for sending this message
// The caller is responsible for freeing the MessageBuffer
MessageBuffer *GetMessageBuffer() const;
};
class __declspec(dllexport) OidMessage : public BaseMessage {
private:
long long oid;
public:
//OidMessage();
//OidMessage(const OidMessage &other);
long long GetOid() const;
void SetOid(long long id);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) TimestampedOidMessage : public OidMessage {
private:
long long timestamp;
public:
//TimestampedOidMessage();
//TimestampedOidMessage(const TimestampedOidMessage &other);
long long GetTimestamp() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
// Represents a new object notification (for any perceiver)
class __declspec(dllexport) NewObjectMessage : public OidMessage {
private:
long long new_object_oid;
std::string object_type;
public:
//NewObjectMessage();
//NewObjectMessage(const NewObjectMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetObjectType() const;
long long GetObjectOid() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
// Represents a free object notification (for any perceiver)
class __declspec(dllexport) FreeObjectMessage : public OidMessage {
long long new_object_oid;
std::string object_type;
public:
//FreeObjectMessage();
//FreeObjectMessage(const FreeObjectMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetObjectType() const;
long long GetObjectOid() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) DirLocMessage : public TimestampedOidMessage {
Vector dir;
IntVector loc;
public:
//DirLocMessage();
//DirLocMessage(const DirLocMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
Vector GetDir() const;
void SetDir(const Vector &dir);
IntVector GetLoc() const;
void SetLoc(const IntVector &loc);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
// The various response messages should extend this abstract class
class __declspec(dllexport) ResponseMessage : public BaseMessage {
public:
//ResponseMessage();
//ResponseMessage(const ResponseMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
virtual void ParseMessage(MessageBuffer &msg) = 0;
virtual void WriteMessage(MessageBuffer &msg) const = 0;
};
class __declspec(dllexport) GetPropertyMessage : public OidMessage {
std::string property_name;
public:
//GetPropertyMessage();
//GetPropertyMessage(const GetPropertyMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetPropertyName() const;
void SetPropertyName(const std::string &name);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) SetPropertyMessage : public OidMessage {
std::string property_name;
std::string property_value;
bool request_response;
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetPropertyName();
void SetPropertyName(const std::string &name);
std::string GetPropertyValue();
void SetPropertyValue(const std::string &value);
bool GetRequestResponse();
void SetRequestResponse(const bool req);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
// This class does not exist on the server, since the server just uses the
// data object to contain the string that is the property value. Since
// we don't have java serialization, we need to actually have a class for this.
class __declspec(dllexport) PropertyRespMessage : public ResponseMessage {
std::string property_value;
public:
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetPropertyValue() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) ObjInfoReqMessage : public OidMessage {
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
};
class __declspec(dllexport) ObjInfoRespMessage : public ResponseMessage {
long long oid;
std::string name;
IntVector loc;
Quaternion orientation;
Vector scale;
int type;
int followTerrain;
public:
//ObjectInfoMessage();
//ObjectInfoMessage(const ObjectInfoMessage &other);
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
long long GetOid() const;
std::string GetName() const;
IntVector GetLoc() const;
Quaternion GetOrientation() const;
Vector GetScale() const;
int GetIntegerType() const;
int GetFollowTerrain() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) PropertyMessage : public OidMessage {
public:
std::map<std::string, std::string> properties;
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) CommandMessage : public OidMessage {
protected:
virtual std::string GetCommand() const = 0;
public:
std::map<std::string, std::string> properties;
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) StopCommandMessage : public CommandMessage {
protected:
virtual std::string GetCommand() const;
};
class __declspec(dllexport) GotoCommandMessage : public CommandMessage {
IntVector destination;
int speed;
protected:
virtual std::string GetCommand() const;
public:
IntVector GetDestination() const;
void SetDestination(const IntVector &dest);
int GetSpeed() const;
void SetSpeed(int speed);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) FollowCommandMessage : public CommandMessage {
long long target_oid;
int speed;
protected:
virtual std::string GetCommand() const;
public:
int GetSpeed() const;
void SetSpeed(int speed);
long long GetTargetOid() const;
void SetTargetOid(long long target_oid);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) UpdateWorldNodeReqMessage : public OidMessage {
bool location_set;
IntVector location;
bool direction_set;
Vector direction;
bool orientation_set;
Quaternion orientation;
public:
UpdateWorldNodeReqMessage();
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
IntVector GetLocation() const;
void SetLocation(const IntVector &dir);
Vector GetDirection() const;
void SetDirection(const Vector &dir);
Quaternion GetOrientation() const;
void SetOrientation(const Quaternion &orient);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) EventMessage : public OidMessage {
public:
std::map<std::string, std::string> properties;
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
std::string GetEventType() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) AutoAttackMessage : public OidMessage {
long long target_oid;
bool attack_status;
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
long long GetTargetOid() const;
void SetTargetOid(long long target);
bool GetAttackStatus() const;
void SetAttackStatus(bool status);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) ComReqMessage : public OidMessage {
int channel_id;
std::string text;
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
int GetChannel() const;
void SetChannel(int target);
std::string GetText() const;
void SetText(const std::string &msg);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) ComMessage : public OidMessage {
int channel_id;
std::string text;
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
int GetChannel() const;
void SetChannel(int target);
std::string GetText() const;
void SetText(const std::string &msg);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) AnimationCommandReqMessage : public OidMessage {
bool is_clear;
std::string anim_name;
bool is_looping;
public:
AnimationCommandReqMessage();
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
bool GetIsClear() const;
void SetIsClear(bool clear);
std::string GetAnimationName() const;
void SetAnimationName(const std::string &anim);
bool GetIsLooping() const;
void SetIsLooping(bool looping);
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
class __declspec(dllexport) SpawnedMessage : public OidMessage {
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
};
class __declspec(dllexport) DespawnedMessage : public OidMessage {
public:
// What message type is this message
static std::string GetMessageType();
virtual std::string GetTopic() const;
};
// not needed: class to generate objects
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/SpeedWind/SpeedWind.h
|
///////////////////////////////////////////////////////////////////////
// SpeedWind.h
//
// (c) 2004 IDV, Inc.
//
// This class computes wind matrices, leaf angles, and leaf angle matrices
// suitable for use with SpeedTreeRT.
//
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may
// not be copied or disclosed except in accordance with the terms of
// that agreement.
//
// Copyright (c) 2001-2004 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
/////////////////////////////////////////////////////////////////////////////
// Preprocessor
#pragma once
#include <vector>
#include "PIDController.h"
#include <math.h>
#include <string>
#define SET_FLOAT_ARRAY4(pArray, a, b, c, d) pArray[0] = a; pArray[1] = b; pArray[2] = c; pArray[3] = d;
#define SET_FLOAT_ARRAY2(pArray, a, b) pArray[0] = a; pArray[1] = b;
// define which vector is up
#define SPEEDWIND_UPVECTOR_MULTIVERSE
// SpeedTree defaults to using a positive Z up vector and all of the branch
// and leaf computations are done in this orientation. If you are using a
// SpeedTree build with a different up vector, make sure you define the same
// up vector here as the one used by SpeedTree in the file "UpVector.h"
//
// One and only one of the following seven symbols should be defined:
//
// SPEEDWIND_UPVECTOR_POS_Z
// SPEEDWIND_UPVECTOR_NEG_Z
// SPEEDWIND_UPVECTOR_POS_Y
// SPEEDWIND_UPVECTOR_DIRECTX_RIGHT_HANDED_COORDINATE_SYSTEM
/////////////////////////////////////////////////////////////////////////////
// Forward references
class CSpeedWindBlend;
/////////////////////////////////////////////////////////////////////////////
// CSpeedWindMatrix
class CSpeedWindMatrix
{
public:
float m_afData[4][4];
void RotateAxis(float fAngle, float fX, float fY, float fZ)
{
float fS, fC, fT;
fS = sinf(fAngle / 57.29578f);
fC = cosf(fAngle / 57.29578f);
fT = 1.0f - fC;
m_afData[0][0] = fT * fX * fX + fC;
m_afData[0][1] = fT * fX * fY + fS * fZ;
m_afData[0][2] = fT * fX * fZ - fS * fY;
m_afData[0][3] = 0.0;
m_afData[1][0] = fT * fX * fY - fS * fZ;
m_afData[1][1] = fT * fY * fY + fC;
m_afData[1][2] = fT * fY * fZ + fS * fX;
m_afData[1][3] = 0.0;
m_afData[2][0] = fT * fX * fZ + fS * fY;
m_afData[2][1] = fT * fY * fZ - fS * fX;
m_afData[2][2] = fT * fZ * fZ + fC;
m_afData[2][3] = 0.0f;
m_afData[3][0] = 0.0f;
m_afData[3][1] = 0.0f;
m_afData[3][2] = 0.0f;
m_afData[3][3] = 1.0f;
}
void Rotate(float fAngle, char chAxis)
{
CSpeedWindMatrix cRotMatrix;
float fCosine = cosf(fAngle / 57.29578f);
float fSine = sinf(fAngle / 57.29578f);
switch (chAxis)
{
case 'x': case 'X':
cRotMatrix.m_afData[0][0] = 1.0f;
cRotMatrix.m_afData[0][1] = 0.0f;
cRotMatrix.m_afData[0][2] = 0.0f;
cRotMatrix.m_afData[0][3] = 0.0f;
cRotMatrix.m_afData[1][0] = 0.0f;
cRotMatrix.m_afData[1][1] = fCosine;
cRotMatrix.m_afData[1][2] = fSine;
cRotMatrix.m_afData[1][3] = 0.0f;
cRotMatrix.m_afData[2][0] = 0.0f;
cRotMatrix.m_afData[2][1] = -fSine;
cRotMatrix.m_afData[2][2] = fCosine;
cRotMatrix.m_afData[2][3] = 0.0f;
cRotMatrix.m_afData[3][0] = 0.0f;
cRotMatrix.m_afData[3][1] = 0.0f;
cRotMatrix.m_afData[3][2] = 0.0f;
cRotMatrix.m_afData[3][3] = 1.0f;
break;
case 'y': case 'Y':
cRotMatrix.m_afData[0][0] = fCosine;
cRotMatrix.m_afData[0][1] = 0.0f;
cRotMatrix.m_afData[0][2] = -fSine;
cRotMatrix.m_afData[0][3] = 0.0f;
cRotMatrix.m_afData[1][0] = 0.0f;
cRotMatrix.m_afData[1][1] = 1.0f;
cRotMatrix.m_afData[1][2] = 0.0f;
cRotMatrix.m_afData[1][3] = 0.0f;
cRotMatrix.m_afData[2][0] = fSine;
cRotMatrix.m_afData[2][1] = 0.0f;
cRotMatrix.m_afData[2][2] = fCosine;
cRotMatrix.m_afData[2][3] = 0.0f;
cRotMatrix.m_afData[3][0] = 0.0f;
cRotMatrix.m_afData[3][1] = 0.0f;
cRotMatrix.m_afData[3][2] = 0.0f;
cRotMatrix.m_afData[3][3] = 1.0f;
break;
case 'z': case 'Z':
cRotMatrix.m_afData[0][0] = fCosine;
cRotMatrix.m_afData[0][1] = fSine;
cRotMatrix.m_afData[0][2] = 0.0f;
cRotMatrix.m_afData[0][3] = 0.0f;
cRotMatrix.m_afData[1][0] = -fSine;
cRotMatrix.m_afData[1][1] = fCosine;
cRotMatrix.m_afData[1][2] = 0.0f;
cRotMatrix.m_afData[1][3] = 0.0f;
cRotMatrix.m_afData[2][0] = 0.0f;
cRotMatrix.m_afData[2][1] = 0.0f;
cRotMatrix.m_afData[2][2] = 1.0f;
cRotMatrix.m_afData[2][3] = 0.0f;
cRotMatrix.m_afData[3][0] = 0.0f;
cRotMatrix.m_afData[3][1] = 0.0f;
cRotMatrix.m_afData[3][2] = 0.0f;
cRotMatrix.m_afData[3][3] = 1.0f;
break;
default:
return;
}
*this = cRotMatrix * *this;
}
void LoadIdentity(void)
{
m_afData[0][0] = 1.0f;
m_afData[0][1] = 0.0f;
m_afData[0][2] = 0.0f;
m_afData[0][3] = 0.0f;
m_afData[1][0] = 0.0f;
m_afData[1][1] = 1.0f;
m_afData[1][2] = 0.0f;
m_afData[1][3] = 0.0f;
m_afData[2][0] = 0.0f;
m_afData[2][1] = 0.0f;
m_afData[2][2] = 1.1f;
m_afData[2][3] = 0.0f;
m_afData[3][0] = 0.0f;
m_afData[3][1] = 0.0f;
m_afData[3][2] = 0.0f;
m_afData[3][3] = 1.0f;
}
CSpeedWindMatrix operator*(const CSpeedWindMatrix& cMatrix) const
{
CSpeedWindMatrix cTemp;
int i, j, k;
for (i = 0; i < 4; ++i)
for (j = 0; j < 4; ++j)
{
cTemp.m_afData[i][j] = 0.0;
for (k = 0; k < 4; ++k)
cTemp.m_afData[i][j] += m_afData[i][k] * cMatrix.m_afData[k][j];
}
return cTemp;
}
};
/////////////////////////////////////////////////////////////////////////////
// CSpeedWind
class CSpeedWind
{
friend class CSpeedWindBlend;
public:
// enumerations
enum ELeafAngles
{
ROCK, RUSTLE, NUM_LEAF_ANGLES
};
// SWindAttributes governs the overall behavior of the wind matrix group
struct SWindAttributes
{
enum EControlParameter
{
P, I, D, A
};
enum EIndices
{
MIN, MAX
};
// matrices
unsigned int m_uiNumMatrices;
float m_afBendLowWindControl[4];
float m_afBendHighWindControl[4];
float m_afVibrationLowWindControl[4];
float m_afVibrationHighWindControl[4];
float m_afVibrationFrequency[2];
float m_afVibrationAngles[2];
float m_fMaxBendAngle;
float m_fStrengthAdjustmentExponent;
// gusting
float m_afGustStrength[2];
float m_afGustDuration[2];
float m_fGustFrequency;
float m_afGustControl[4];
// leaves
float m_fLeafStrengthExponent;
unsigned int m_uiNumLeafAngles;
// leaf angles
float m_afLeafAngleLowWindControl[NUM_LEAF_ANGLES][4];
float m_afLeafAngleHighWindControl[NUM_LEAF_ANGLES][4];
float m_afLeafAngleFrequency[NUM_LEAF_ANGLES][2];
float m_afLeafAngleAngles[NUM_LEAF_ANGLES][2];
SWindAttributes( ) :
m_uiNumMatrices(4),
m_fMaxBendAngle(60.0f),
m_fStrengthAdjustmentExponent(3.0f),
m_fGustFrequency(15.0f),
m_uiNumLeafAngles(6),
m_fLeafStrengthExponent(5.0f)
{
SET_FLOAT_ARRAY4(m_afBendLowWindControl, 3.0f, 0.0f, 0.0f, 0.1f);
SET_FLOAT_ARRAY4(m_afBendHighWindControl, 3.0f, 0.0f, 0.0f, 0.1f);
SET_FLOAT_ARRAY4(m_afVibrationLowWindControl, 1.0f, 0.0f, 0.0f, 0.001f);
SET_FLOAT_ARRAY4(m_afVibrationHighWindControl, 10.0f, 0.0f, 0.0f, 0.1f);
SET_FLOAT_ARRAY2(m_afVibrationFrequency, 50.0f, 1000.0f);
SET_FLOAT_ARRAY2(m_afVibrationAngles, 4.0f, 3.0f);
SET_FLOAT_ARRAY2(m_afGustStrength, 0.05f, 0.45f);
SET_FLOAT_ARRAY2(m_afGustDuration, 0.5f, 5.0f);
SET_FLOAT_ARRAY4(m_afGustControl, 2.0f, 0.0f, 0.0f, 0.001f);
SET_FLOAT_ARRAY4(m_afLeafAngleLowWindControl[ROCK], 0.2f, 0.01f, 0.0f, 0.0f);
SET_FLOAT_ARRAY4(m_afLeafAngleHighWindControl[ROCK], 0.2f, 0.01f, 1.0f, 0.0f);
SET_FLOAT_ARRAY2(m_afLeafAngleFrequency[ROCK], 10.0f, 50.0f);
SET_FLOAT_ARRAY2(m_afLeafAngleAngles[ROCK], 4.0f, 2.0f);
SET_FLOAT_ARRAY4(m_afLeafAngleLowWindControl[RUSTLE], 0.5f, 0.05f, 0.0f, 0.0f);
SET_FLOAT_ARRAY4(m_afLeafAngleHighWindControl[RUSTLE], 3.0f, 6.0f, 1.0f, 0.0f);
SET_FLOAT_ARRAY2(m_afLeafAngleFrequency[RUSTLE], 50.0f, 500.0f);
SET_FLOAT_ARRAY2(m_afLeafAngleAngles[RUSTLE], 3.0f, 5.0f);
}
};
// construction/destruction
CSpeedWind(void);
CSpeedWind(const SWindAttributes& sAttributes);
CSpeedWind(const CSpeedWind& cWind);
virtual ~CSpeedWind(void);
CSpeedWind& operator=(const CSpeedWind& cRight);
// attribute access
void SetAttributes(const SWindAttributes& sAttributes);
SWindAttributes GetAttributes(void) const { return m_sAttributes; }
// creation/management
void CreateWindMatrices(void);
void ResetMatrices(void);
// updating
float Advance(float fTime, float fStrength, float fDirectionX, float fDirectionY, float fDirectionZ);
void UpdateSpeedTreeRT(void) const;
float GetActualStrength(void) const { return m_fStrength; }
// matrix access
unsigned int GetNumWindMatrices(void) const { return m_sAttributes.m_uiNumMatrices; }
const float* GetWindMatrix(unsigned int uiIndex) const { return reinterpret_cast<const float*>(m_vWindMatrices[uiIndex].m_cMatrix.m_afData); }
// leaf angle access
const float* GetLeafAngles(ELeafAngles eAngle) const { return m_pLeafAngles[eAngle]; }
unsigned int GetNumLeafAngles(void) const { return m_sAttributes.m_uiNumLeafAngles; }
void BuildLeafAngleMatrices(const float* pCameraDir);
const float* GetLeafAngleMatrix(unsigned int uiIndex) const { return reinterpret_cast<const float*>(m_pLeafAngleMatrices[uiIndex].m_afData); }
// file I/O
bool Load(std::string strFilename);
bool Load(std::istream& isData);
bool Save(std::string strFilename) const;
bool Save(std::ostream& osData) const;
std::string GetParserError(void) const { return m_strParserError; }
std::string GetWarnings(void) const { return m_strWarnings; }
// blending
void SetWindWeight(float fWeight) { m_fBlendWeight = fWeight; }
float GetWindWeight(void) const { return m_fBlendWeight; }
private:
// general
SWindAttributes m_sAttributes;
float m_fTime;
float m_fStrength;
float m_fAdjustedStrength;
float m_fLeafAdjustedStrength;
float m_fDeltaTime;
bool m_bResetDeltaTime;
float GetRandom(float fMin, float fMax) const;
// blending
float m_fBlendWeight;
// gusting
float m_fGustEndTime;
CPIDController m_cGust;
void UpdateStrength(float fStrength);
// file I/O
std::string m_strParserError;
std::string m_strWarnings;
void SavePID(std::ostream& osData, std::string strName, const float* pData) const;
void SaveLowHigh(std::ostream& osData, std::string strName, const float* pData) const;
void SaveMinMax(std::ostream& osData, std::string strName, const float* pData) const;
// branch/frond matrices
struct SWindMatrix
{
CSpeedWindMatrix m_cMatrix;
float m_fAxisFactor;
float m_fStrength;
float m_fFinalStrength;
float m_fFinalAngle;
CPIDController m_cBendAngle;
CPIDController m_cAxisAngle;
CPIDController m_cXVibration;
CPIDController m_cYVibration;
SWindMatrix( ) :
m_fAxisFactor(0.0f),
m_fStrength(0.0f),
m_fFinalStrength(0.0f),
m_fFinalAngle(0.0f)
{
}
};
std::vector<SWindMatrix> m_vWindMatrices;
void UpdateBend(float fDirectionX, float fDirectionY, float fDirectionZ);
void UpdateVibrations(void);
// leaf angles
struct SLeafAngle
{
float* m_pResult;
CPIDController m_cAngle;
SLeafAngle( ) :
m_pResult(NULL)
{
}
};
std::vector<SLeafAngle> m_avLeafAngles[NUM_LEAF_ANGLES];
float* m_pLeafAngles[NUM_LEAF_ANGLES];
CSpeedWindMatrix* m_pLeafAngleMatrices;
void UpdateLeafAngles(void);
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/BridgeInterface/SampleBridgeClient/OA_Messages.h
|
#pragma once
#include "MessageException.h"
#include "Message.h"
/** Add by JWT, should be the message that is called when hotloadbehaviors is called */
class HotLoadBehaviorMessage : public BaseMessage {
public:
static std::string GetMessageType();
virtual std::string GetTopic() const;
virtual void ParseMessage(MessageBuffer &msg);
virtual void WriteMessage(MessageBuffer &msg) const;
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/RequestManager.h
|
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#include <iostream>
#include "StateManager.h"
//#include "SDKSampleApp.h"
class RequestManager
{
StateManager * stateMgr;
int debuglevel;
public:
RequestManager(StateManager*);
void SetDebug(int);
// Requests
int req_ConnectorCreate(std::string, int, int);
int req_ConnectorShutdown(std::string);
int req_AccountLogin(std::string, std::string, std::string, int, int, int, int);
int req_AccountLogout(std::string);
int req_SetLoginProperties(std::string, int, int);
int req_SessionGroupCreate(std::string);
int req_SessionGroupTerminate(std::string);
int req_SessionGroupAddSession(std::string, std::string, int, std::string);
int req_SessionGroupRemoveSession(std::string, std::string);
int req_SessionGroupSetFocus(std::string, std::string);
int req_SessionGroupUnsetFocus(std::string, std::string);
int req_SessionGroupResetFocus(std::string);
int req_SessionGroupSetTx(std::string, std::string);
int req_SessionGroupSetTxAll(std::string);
int req_SessionGroupSetTxNone(std::string);
int req_SessionCreate(std::string, std::string, std::string, std::string, int, int);
int req_ConnectSession(std::string);
int req_MediaConnect(std::string);
int req_MediaDisconnect(std::string);
int req_SessionTerminate(std::string);
int req_SessionMuteLocalSpeaker(std::string, int);
int req_SessionSetLocalSpeakerVolume(std::string, int);
int req_SessionGetLocalAudioInfo(std::string);
int req_CreateChannelAndInvite(std::string, std::string, std::string, int, int, int, int, std::string, std::string);
int req_CreateChannel(std::string, std::string, std::string, vx_channel_type, int, int, int, int, int, int, double, double, int, std::string);
int req_UpdateChannel(std::string, std::string, std::string, std::string, int, int, int, int, int, int, double, double, int, std::string);
int req_DeleteChannel(std::string, std::string);
int req_CreateFolder(std::string, std::string, std::string, int);
int req_UpdateFolder(std::string, int, std::string, std::string);
int req_DeleteFolder(std::string, int);
int req_GetFolderInfo(std::string, int);
int req_GetFavs(std::string);
int req_SetFav(std::string, int, std::string, std::string, int, std::string);
int req_DeleteFav(std::string, int);
int req_SetFavGroup(std::string, int, std::string, std::string);
int req_DeleteFavGroup(std::string, int);
int req_GetChannelInfo(std::string, std::string);
int req_SearchChannels(std::string, int, int, std::string, std::string, int);
int req_SearchAccounts(std::string, int, int, std::string, std::string, std::string, std::string);
int req_ModeratorAdd(std::string, std::string, std::string);
int req_ModeratorRemove(std::string, std::string, std::string);
int req_ModeratorGet(std::string, std::string);
int req_ACLAdd(std::string, std::string, std::string);
int req_ACLRemove(std::string, std::string, std::string);
int req_ACLGet(std::string, std::string);
int req_MuteUser(std::string, int, std::string, std::string);
int req_MuteAllUsers(std::string, int, std::string);
int req_BanUser(std::string, int, std::string, std::string);
int req_GetBannedUsers(std::string, std::string);
int req_KickUser(std::string, std::string, std::string);
int req_InviteUser(std::string, std::string);
int req_LocalUserMute(std::string, int, std::string);
int req_LocalUserVolume(std::string, int, std::string);
int req_GetChannels(std::string);
int req_GetParts(std::string);
int req_AudioInfo(std::string);
int req_SpeakerVol(std::string, int);
int req_SpeakerMute(std::string, int);
int req_MicVol(std::string, int);
int req_MicMute(std::string, int);
int req_BuddySet(const std::string &, std::string, std::string, std::string, int);
int req_BuddyDelete(const std::string &, std::string);
int req_BuddyGroupSet(std::string, int, std::string, std::string);
int req_BuddyGroupDelete(std::string, int);
int req_ListBuddiesAndGroups(std::string);
int req_CreateBlockRule(std::string, std::string, int);
int req_DeleteBlockRule(std::string, std::string);
int req_ListBlockRules(std::string);
int req_CreateAutoAcceptRule(std::string, std::string, int);
int req_DeleteAutoAcceptRule(std::string, std::string);
int req_ListAutoAcceptRules(std::string);
int req_SendMessage(std::string, std::string);
int req_NetworkTest(std::string, std::string, std::string, int, int);
int req_NetworkTest(std::string);
int req_moveToOrigin(std::string);
int req_moveLeft(std::string, double);
int req_moveForward(std::string, double);
int req_moveBack(std::string, double);
int req_moveRight(std::string, double);
int req_turnLeft45(std::string);
int req_turnRight45(std::string);
int req_ListRenderDevices(void);
int req_SetRenderDevice(std::string);
int req_SetDefaultRenderDevice(void);
int req_ListCaptureDevices(void);
int req_SetCaptureDevice(std::string);
int req_SetDefaultCaptureDevice(void);
int req_RenderAudioStart(std::string, int);
int req_RenderAudioStop(void);
int req_MasterMicSetVol(int vol);
int req_MasterSpeakerSetVol(int vol);
int req_MasterMicGetVol(void);
int req_MasterSpeakerGetVol(void);
int req_CaptureAudioStart(void);
int req_CaptureAudioStop(void);
int req_SetPresence(const std::string &acct_handle, const std::string &state, const std::string &message);
int req_SendNotification(std::string sessionID, int state);
int req_UpdateAccount(std::string, std::string, std::string);
int req_GetAccount(std::string);
int req_SendSMS(std::string, std::string, std::string);
int req_SetIdleTimeout(int seconds);
int req_BindKey(const std::string &handle, const std::set<int> &codes);
int req_CreateAccount(const std::string &adminAcct, const std::string &adminPassword, const std::string &grantDocument,
const std::string &username, const std::string &password, const std::string &serverUrl);
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/VxcExports.h
|
#ifndef __VXCEXPORTS_H
#define __VXCEXPORTS_H
#ifdef _MSC_VER
// Note: this has been disabled so no-one tries to export C++ classes.
//#ifdef BUILDING_VIVOXSDK
// #define VIVOXSDK_DLLEXPORT __declspec(dllexport)
//#else
// #define VIVOXSDK_DLLEXPORT __declspec(dllimport)
//#endif
#define VIVOXSDK_DLLEXPORT
#else
#define VIVOXSDK_DLLEXPORT __attribute__ ((visibility("default")))
#endif
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/ClientInterfaceEditor/MultiverseInterfaceStudioUI/vsdebugguids.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
#define guidVSDebugPackage { 0xC9DD4A57, 0x47FB, 0x11D2, { 0x83, 0xE7, 0x00, 0xC0, 0x4F, 0x99, 0x02, 0xC1 } }
#define guidVSDebugGroup { 0xC9DD4A58, 0x47FB, 0x11D2, { 0x83, 0xE7, 0x00, 0xC0, 0x4F, 0x99, 0x02, 0xC1 } }
#define guidVSDebugCommand { 0xC9DD4A59, 0x47FB, 0x11D2, { 0x83, 0xE7, 0x00, 0xC0, 0x4F, 0x99, 0x02, 0xC1 } }
#define guidDbgOptGeneralPage { 0xfa9eb535, 0xc624, 0x13d0, { 0xae, 0x1f, 0x00, 0xa0, 0x19, 0x0f, 0xf4, 0xc3 } }
#define guidDbgOptFindSourcePage { 0x7a8a4060, 0xd909, 0x4485, { 0x98, 0x60, 0x74, 0x8b, 0xc8, 0x71, 0x3a, 0x74 } }
#define guidDbgOptFindSymbolPage { 0xc15095aa, 0x49c0, 0x40ac, { 0xae, 0x78, 0x61, 0x13, 0x18, 0xdd, 0x99, 0x25 } }
#define guidDbgOptENCPage { 0x6c3ecaa6, 0x3efb, 0x4b0d, { 0x96, 0x60, 0x2a, 0x3b, 0xa5, 0xb8, 0x44, 0x0e } }
#define guidDbgOptNativePage { 0x3e08d829, 0x6989, 0x45c3, { 0x97, 0xda, 0xf8, 0xbf, 0x3c, 0x49, 0xae, 0xab } }
#define guidDbgOptJITPage { 0xb9efcaf2, 0x9eae, 0x4022, { 0x9e, 0x39, 0xfa, 0x94, 0x76, 0x66, 0xad, 0xd9 } }
#define guidDebugOutputPane { 0xfc076020, 0x078a, 0x11d1, { 0xa7, 0xdf, 0x00, 0xa0, 0xc9, 0x11, 0x00, 0x51 } }
#define guidDisasmLangSvc { 0xc16fb7c4, 0x9f84, 0x11d2, { 0x84, 0x05, 0x00, 0xc0, 0x4f, 0x99, 0x02, 0xc1 } }
#define guidMemoryLangSvc { 0xdf38847e, 0xcc19, 0x11d2, { 0x8a, 0xda, 0x00, 0xc0, 0x4f, 0x79, 0xe4, 0x79 } }
#define guidFontColorDisassembly { 0x9e632e6e, 0xd786, 0x4f9a, { 0x8d, 0x3e, 0xb9, 0x39, 0x88, 0x36, 0xc7, 0x84 } }
#define guidFontColorMemory { 0xce2eced5, 0xc21c, 0x464c, { 0x9b, 0x45, 0x15, 0xe1, 0x0e, 0x9f, 0x9e, 0xf9 } }
#define guidFontColorRegisters { 0x40660f54, 0x80fa, 0x4375, { 0x89, 0xa3, 0x8d, 0x06, 0xaa, 0x95, 0x4e, 0xba } }
#define guidDebuggerFontColorSvc { 0x3b70a4ae, 0xbb91, 0x4abe, { 0xa0, 0x5c, 0xc4, 0xde, 0x7, 0xb9, 0x76, 0x3e } }
#define guidWatchFontColor { 0x358463d0, 0xd084, 0x400f, { 0x99, 0x7e, 0xa3, 0x4f, 0xc5, 0x70, 0xbc, 0x72 } }
#define guidAutosFontColor { 0xa7ee6bee, 0xd0aa, 0x4b2f, { 0xad, 0x9d, 0x74, 0x82, 0x76, 0xa7, 0x25, 0xf6 } }
#define guidLocalsFontColor { 0x8259aced, 0x490a, 0x41b3, { 0xa0, 0xfb, 0x64, 0xc8, 0x42, 0xcc, 0xdc, 0x80 } }
#define guidCallStackFontColor { 0xfd2219af, 0xebf8, 0x4116, { 0xa8, 0x1, 0x3b, 0x50, 0x3c, 0x48, 0xdf, 0xf0 } }
#define guidThreadsFontColor { 0xbb8fe807, 0xa186, 0x404a, { 0x81, 0xfa, 0xd2, 0xb, 0x90, 0x8c, 0xa9, 0x3b } }
#define guidDataTipsFontColor { 0xf7b7b222, 0xe186, 0x48df, { 0xa5, 0xee, 0x17, 0x4e, 0x81, 0x29, 0x89, 0x1b } }
#define guidVarWndsFontColor { 0x35b25e75, 0xab53, 0x4c5d, { 0x80, 0xea, 0x66, 0x82, 0xeb, 0xb2, 0xbb, 0xbd } };
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/VxcRequests.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform<filename>lib/Vivox/mvVoice/include/VxcRequests.h
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
#ifndef __VXCREQUESTS_H__
#define __VXCREQUESTS_H__
#include "Vxc.h"
#ifdef __cplusplus
extern "C" {
#endif
/* The Vivox request structs. These structs all contain a vx_request action in the beginning so they can be identified, and
have a cookie (VX_COOKIE). */
typedef struct vx_req_connector_create {
vx_req_base_t base;
char* client_name;
char* acct_mgmt_server;
int minimum_port;
int maximum_port;
vx_attempt_stun attempt_stun;
vx_connector_mode mode;
char* log_folder;
char* log_filename_prefix;
char* log_filename_suffix;
int log_level; // <= 0 to turn off
} vx_req_connector_create_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_create_create(vx_req_connector_create_t ** req);
typedef struct vx_req_connector_initiate_shutdown {
vx_req_base_t base;
VX_HANDLE connector_handle;
char* client_name;
} vx_req_connector_initiate_shutdown_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_initiate_shutdown_create(vx_req_connector_initiate_shutdown_t ** req);
typedef struct vx_req_account_login {
vx_req_base_t base;
VX_HANDLE connector_handle;
char* acct_name;
char* acct_password;
vx_session_answer_mode answer_mode;
vx_text_mode enable_text;
int participant_property_frequency;
int enable_buddies_and_presence;
// VxAudioEvtUpdFreq participant_property_frequency;
} vx_req_account_login_t;
VIVOXSDK_DLLEXPORT void vx_req_account_login_create(vx_req_account_login_t ** req);
typedef struct vx_req_account_logout {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_logout_t;
VIVOXSDK_DLLEXPORT void vx_req_account_logout_create(vx_req_account_logout_t ** req);
typedef struct vx_req_account_set_login_properties {
vx_req_base_t base;
VX_HANDLE account_handle;
vx_session_answer_mode answer_mode;
int participant_property_frequency;
} vx_req_account_set_login_properties_t;
VIVOXSDK_DLLEXPORT void vx_req_account_set_login_properties_create(vx_req_account_set_login_properties ** req);
typedef enum {
password_hash_algorithm_cleartext,
password_hash_algorithm_sha1_username_hash,
} vx_password_hash_algorithm_t;
typedef struct vx_req_sessiongroup_create {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_sessiongroup_create_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_create_create(vx_req_sessiongroup_create_t ** req);
typedef struct vx_req_sessiongroup_terminate {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_terminate_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_terminate_create(vx_req_sessiongroup_terminate_t ** req);
typedef struct vx_req_sessiongroup_add_session {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
char* uri;
char* name;
char* password;
int connect_audio;
vx_password_hash_algorithm_t password_hash_algorithm;
} vx_req_sessiongroup_add_session_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_add_session_create(vx_req_sessiongroup_add_session_t ** req);
typedef struct vx_req_sessiongroup_remove_session {
vx_req_base_t base;
VX_HANDLE session_handle;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_remove_session_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_remove_session_create(vx_req_sessiongroup_remove_session_t ** req);
typedef struct vx_req_sessiongroup_set_focus {
vx_req_base_t base;
VX_HANDLE session_handle;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_set_focus_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_set_focus_create(vx_req_sessiongroup_set_focus_t ** req);
typedef struct vx_req_sessiongroup_unset_focus {
vx_req_base_t base;
VX_HANDLE session_handle;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_unset_focus_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_unset_focus_create(vx_req_sessiongroup_unset_focus_t ** req);
typedef struct vx_req_sessiongroup_reset_focus {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_reset_focus_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_reset_focus_create(vx_req_sessiongroup_reset_focus_t ** req);
typedef struct vx_req_sessiongroup_set_tx_session {
vx_req_base_t base;
VX_HANDLE session_handle;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_set_tx_session_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_set_tx_session_create(vx_req_sessiongroup_set_tx_session_t ** req);
typedef struct vx_req_sessiongroup_set_tx_all_sessions {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_set_tx_all_sessions_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_set_tx_all_sessions_create(vx_req_sessiongroup_set_tx_all_sessions_t ** req);
typedef struct vx_req_sessiongroup_set_tx_no_session {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
} vx_req_sessiongroup_set_tx_no_session_t;
VIVOXSDK_DLLEXPORT void vx_req_sessiongroup_set_tx_no_session_create(vx_req_sessiongroup_set_tx_no_session ** req);
typedef struct vx_req_session_create {
vx_req_base_t base;
VX_HANDLE account_handle;
char* name;
char* uri;
char* password;
int connect_audio;
int join_audio; // DEPRECATED 1 true, <= 0 false
int join_text; // DEPRECATED 1 true, <= 0 false
vx_password_hash_algorithm_t password_hash_algorithm;
} vx_req_session_create_t;
VIVOXSDK_DLLEXPORT void vx_req_session_create_create(vx_req_session_create_t ** req);
typedef struct vx_req_session_connect { //DEPRECATED
vx_req_base_t base;
VX_HANDLE session_handle;
char* audio_media;
} vx_req_session_connect_t;
VIVOXSDK_DLLEXPORT void vx_req_session_connect_create(vx_req_session_connect_t ** req);
typedef struct vx_req_session_media_connect {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
vx_media_type media; //DEPRECATED
} vx_req_session_media_connect_t;
VIVOXSDK_DLLEXPORT void vx_req_session_media_connect_create(vx_req_session_media_connect_t ** req);
typedef struct vx_req_session_media_disconnect {
vx_req_base_t base;
VX_HANDLE sessiongroup_handle;
VX_HANDLE session_handle;
vx_media_type media; //DEPRECATED
} vx_req_session_media_disconnect_t;
VIVOXSDK_DLLEXPORT void vx_req_session_media_disconnect_create(vx_req_session_media_disconnect_t ** req);
typedef struct vx_req_session_terminate {
vx_req_base_t base;
VX_HANDLE session_handle;
} vx_req_session_terminate_t;
VIVOXSDK_DLLEXPORT void vx_req_session_terminate_create(vx_req_session_terminate_t ** req);
typedef struct vx_req_session_mute_local_speaker {
vx_req_base_t base;
VX_HANDLE session_handle;
int mute_level;
} vx_req_session_mute_local_speaker_t;
VIVOXSDK_DLLEXPORT void vx_req_session_mute_local_speaker_create(vx_req_session_mute_local_speaker_t ** req);
typedef struct vx_req_session_set_local_speaker_volume {
vx_req_base_t base;
VX_HANDLE session_handle;
int volume;
} vx_req_session_set_local_speaker_volume_t;
VIVOXSDK_DLLEXPORT void vx_req_session_set_local_speaker_volume_create(vx_req_session_set_local_speaker_volume_t ** req);
typedef struct vx_req_session_get_local_audio_info {
vx_req_base_t base;
VX_HANDLE session_handle;
} vx_req_session_get_local_audio_info_t;
VIVOXSDK_DLLEXPORT void vx_req_session_get_local_audio_info_create(vx_req_session_get_local_audio_info_t ** req);
typedef struct vx_req_session_channel_invite_user {
vx_req_base_t base;
VX_HANDLE session_handle;
char* participant_uri;
} vx_req_session_channel_invite_user_t;
VIVOXSDK_DLLEXPORT void vx_req_session_channel_invite_user_create(vx_req_session_channel_invite_user_t ** req);
typedef struct vx_req_session_set_participant_volume_for_me {
vx_req_base_t base;
VX_HANDLE session_handle;
char* participant_uri;
int volume;
} vx_req_session_set_participant_volume_for_me_t;
VIVOXSDK_DLLEXPORT void vx_req_session_set_participant_volume_for_me_create(vx_req_session_set_participant_volume_for_me_t ** req);
typedef struct vx_req_session_set_participant_mute_for_me {
vx_req_base_t base;
VX_HANDLE session_handle;
char* participant_uri;
int mute;
} vx_req_session_set_participant_mute_for_me_t;
VIVOXSDK_DLLEXPORT void vx_req_session_set_participant_mute_for_me_create(vx_req_session_set_participant_mute_for_me_t ** req);
typedef enum {
req_disposition_reply_required,
req_disposition_no_reply_required
} req_disposition_type_t;
typedef struct vx_req_session_set_3d_position {
vx_req_base_t base;
VX_HANDLE session_handle;
double speaker_position[3]; // {x, y, z}
double speaker_velocity[3]; // {x, y, z}
double speaker_at_orientation[3]; // {x, y, z}
double speaker_up_orientation[3]; // {x, y, z}
double speaker_left_orientation[3]; // {x, y, z}
double listener_position[3]; // {x, y, z}
double listener_velocity[3]; // {x, y, z}
double listener_at_orientation[3]; // {x, y, z}
double listener_up_orientation[3]; // {x, y, z}
double listener_left_orientation[3]; // {x, y, z}
orientation_type type;
req_disposition_type_t req_disposition_type;
} vx_req_session_set_3d_position_t;
VIVOXSDK_DLLEXPORT void vx_req_session_set_3d_position_create(vx_req_session_set_3d_position_t ** req);
typedef struct vx_req_session_render_audio_start {
vx_req_base_t base;
VX_HANDLE session_handle;
char* sound_file_path;
int loop;
} vx_req_session_render_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_req_session_render_audio_start_create(vx_req_session_render_audio_start_t ** req);
typedef struct vx_req_session_render_audio_stop {
vx_req_base_t base;
VX_HANDLE session_handle;
char* sound_file_path;
} vx_req_session_render_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_req_session_render_audio_stop_create(vx_req_session_render_audio_stop_t ** req);
typedef struct vx_req_session_channel_get_participants {
vx_req_base_t base;
VX_HANDLE session_handle;
} vx_req_session_channel_get_participants_t;
VIVOXSDK_DLLEXPORT void vx_req_session_channel_get_participants_create(vx_req_session_channel_get_participants_t ** req);
typedef struct vx_req_account_channel_get_list {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_channel_get_list_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_get_list_create(vx_req_account_channel_get_list_t ** req);
typedef struct vx_req_account_channel_create {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_desc;
vx_channel_type channel_type;
int parent_id;
int set_persistent; // 1 true, <= 0 false
int set_protected; // 1 true, <= 0 false
char* protected_password;
int capacity;
int max_participants;
int max_range;
int clamping_dist;
double roll_off;
double max_gain;
int dist_model;
} vx_req_account_channel_create_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_create_create(vx_req_account_channel_create_t ** req);
typedef struct vx_req_account_channel_update {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
char* channel_name;
char* channel_desc;
int set_persistent;
int set_protected;
char* protected_password;
int capacity;
int max_participants;
int max_range;
int clamping_dist;
double roll_off;
double max_gain;
int dist_model;
} vx_req_account_channel_update_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_update_create(vx_req_account_channel_update_t ** req);
typedef struct vx_req_account_channel_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
} vx_req_account_channel_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_delete_create(vx_req_account_channel_delete_t ** req);
typedef struct vx_req_account_channel_create_and_invite {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_desc;
int parent_id;
int is_persistent; // 1 true, <= 0 false
int is_protected; // 1 true, <= 0 false
char* protected_password;
int capacity;
int max_participants;
char** participant_uris;
} vx_req_account_channel_create_and_invite_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_create_and_invite_create(vx_req_account_channel_create_and_invite_t ** req);
typedef struct vx_req_account_channel_folder_create {
vx_req_base_t base;
VX_HANDLE account_handle;
char* folder_name;
char* folder_desc;
int parent_id;
int set_persistent; // 1 true, <= 0 false
int set_protected; // 1 true, <= 0 false
char* protected_password;
} vx_req_account_channel_folder_create_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_folder_create_create(vx_req_account_channel_folder_create_t ** req);
typedef struct vx_req_account_channel_folder_update {
vx_req_base_t base;
VX_HANDLE account_handle;
int folder_id;
char* folder_name;
char* folder_desc;
int set_persistent; // 1 true, <= 0 false
int set_protected; // 1 true, <= 0 false
char* protected_password;
} vx_req_account_channel_folder_update_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_folder_update_create(vx_req_account_channel_folder_update_t ** req);
typedef struct vx_req_account_channel_folder_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
int folder_id;
} vx_req_account_channel_folder_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_folder_delete_create(vx_req_account_channel_folder_delete_t ** req);
typedef struct vx_req_account_channel_folder_get_info {
vx_req_base_t base;
VX_HANDLE account_handle;
int folder_id;
} vx_req_account_channel_folder_get_info_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_folder_get_info_create(vx_req_account_channel_folder_get_info_t ** req);
typedef struct vx_req_account_channel_favorites_get_list {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_channel_favorites_get_list_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_favorites_get_list_create(vx_req_account_channel_favorites_get_list_t ** req);
typedef struct vx_req_account_channel_favorite_set {
vx_req_base_t base;
VX_HANDLE account_handle;
int channel_favorite_id;
char* channel_favorite_label;
char* channel_favorite_uri;
char* channel_favorite_data;
int channel_favorite_group_id;
} vx_req_account_channel_favorite_set_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_favorite_set_create(vx_req_account_channel_favorite_set_t ** req);
typedef struct vx_req_account_channel_favorite_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
int channel_favorite_id;
} vx_req_account_channel_favorite_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_favorite_delete_create(vx_req_account_channel_favorite_delete_t ** req);
typedef struct vx_req_account_channel_favorite_group_set {
vx_req_base_t base;
VX_HANDLE account_handle;
int channel_favorite_group_id;
char* channel_favorite_group_name;
char* channel_favorite_group_data;
} vx_req_account_channel_favorite_group_set_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_favorite_group_set_create(vx_req_account_channel_favorite_group_set_t ** req);
typedef struct vx_req_account_channel_favorite_group_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
int channel_favorite_group_id;
} vx_req_account_channel_favorite_group_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_favorite_group_delete_create(vx_req_account_channel_favorite_group_delete_t ** req);
typedef struct vx_req_account_channel_get_info {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
} vx_req_account_channel_get_info_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_get_info_create(vx_req_account_channel_get_info_t ** req);
typedef struct vx_req_account_channel_search {
vx_req_base_t base;
VX_HANDLE account_handle;
int page_number;
int page_size;
char* channel_name;
char* channel_description;
int channel_active;
vx_channel_search_type channel_type;
} vx_req_account_channel_search_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_search_create(vx_req_account_channel_search_t ** req);
typedef struct vx_req_account_buddy_search {
vx_req_base_t base;
VX_HANDLE account_handle;
int page_number;
int page_size;
char* buddy_first_name;
char* buddy_last_name;
char* buddy_user_name;
char* buddy_email;
} vx_req_account_buddy_search_t;
VIVOXSDK_DLLEXPORT void vx_req_account_buddy_search_create(vx_req_account_buddy_search_t ** req);
typedef struct vx_req_account_channel_add_moderator {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
char* channel_name;
char* moderator_uri;
} vx_req_account_channel_add_moderator_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_add_moderator_create(vx_req_account_channel_add_moderator_t ** req);
typedef struct vx_req_account_channel_remove_moderator {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
char* channel_name;
char* moderator_uri;
} vx_req_account_channel_remove_moderator_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_remove_moderator_create(vx_req_account_channel_remove_moderator_t ** req);
typedef struct vx_req_account_channel_get_moderators {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
} vx_req_account_channel_get_moderators_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_get_moderators_create(vx_req_account_channel_get_moderators_t ** req);
typedef struct vx_req_account_channel_add_acl {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
char* acl_uri;
} vx_req_account_channel_add_acl_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_add_acl_create(vx_req_account_channel_add_acl_t ** req);
typedef struct vx_req_account_channel_remove_acl {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
char* acl_uri;
} vx_req_account_channel_remove_acl_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_remove_acl_create(vx_req_account_channel_remove_acl_t ** req);
typedef struct vx_req_account_channel_get_acl {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
} vx_req_account_channel_get_acl_t;
VIVOXSDK_DLLEXPORT void vx_req_account_channel_get_acl_create(vx_req_account_channel_get_acl_t ** req);
typedef struct vx_req_channel_mute_user {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_uri;
char* participant_uri;
int set_muted;
} vx_req_channel_mute_user_t;
VIVOXSDK_DLLEXPORT void vx_req_channel_mute_user_create(vx_req_channel_mute_user_t ** req);
typedef struct vx_req_channel_ban_user {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_uri;
char* participant_uri;
int set_banned;
} vx_req_channel_ban_user_t;
VIVOXSDK_DLLEXPORT void vx_req_channel_ban_user_create(vx_req_channel_ban_user_t ** req);
typedef struct vx_req_channel_get_banned_users {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_uri;
} vx_req_channel_get_banned_users_t;
VIVOXSDK_DLLEXPORT void vx_req_channel_get_banned_users_create(vx_req_channel_get_banned_users_t ** req);
typedef struct vx_req_channel_kick_user {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_uri;
char* participant_uri;
} vx_req_channel_kick_user_t;
VIVOXSDK_DLLEXPORT void vx_req_channel_kick_user_create(vx_req_channel_kick_user_t ** req);
typedef struct vx_req_channel_mute_all_users {
vx_req_base_t base;
VX_HANDLE account_handle;
char* channel_name;
char* channel_uri;
int set_muted;
} vx_req_channel_mute_all_users_t;
VIVOXSDK_DLLEXPORT void vx_req_channel_mute_all_users_create(vx_req_channel_mute_all_users_t ** req);
typedef struct vx_req_connector_mute_local_mic {
vx_req_base_t base;
VX_HANDLE connector_handle;
int mute_level;
} vx_req_connector_mute_local_mic_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_mute_local_mic_create(vx_req_connector_mute_local_mic_t ** req);
typedef struct vx_req_connector_mute_local_speaker {
vx_req_base_t base;
VX_HANDLE connector_handle;
int mute_level;
} vx_req_connector_mute_local_speaker_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_mute_local_speaker_create(vx_req_connector_mute_local_speaker_t ** req);
typedef struct vx_req_connector_set_local_mic_volume {
vx_req_base_t base;
VX_HANDLE connector_handle;
int volume; // a number between 0 and 100 where 50 represents "normal" speaking volume
} vx_req_connector_set_local_mic_volume_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_set_local_mic_volume_create(vx_req_connector_set_local_mic_volume_t ** req);
typedef struct vx_req_connector_set_local_speaker_volume {
vx_req_base_t base;
VX_HANDLE connector_handle;
int volume; // a number between 0 and 100 where 50 represents "normal" speaking volume
} vx_req_connector_set_local_speaker_volume_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_set_local_speaker_volume_create(vx_req_connector_set_local_speaker_volume_t ** req);
typedef struct vx_req_connector_get_local_audio_info {
vx_req_base_t base;
VX_HANDLE connector_handle;
} vx_req_connector_get_local_audio_info_t;
VIVOXSDK_DLLEXPORT void vx_req_connector_get_local_audio_info_create(vx_req_connector_get_local_audio_info_t ** req);
typedef struct vx_req_account_buddy_set {
vx_req_base_t base;
VX_HANDLE account_handle;
char* buddy_uri;
char* display_name;
char* buddy_data;
int group_id;
} vx_req_account_buddy_set_t;
VIVOXSDK_DLLEXPORT void vx_req_account_buddy_set_create(vx_req_account_buddy_set_t ** req);
typedef struct vx_req_account_buddy_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
char* buddy_uri;
} vx_req_account_buddy_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_buddy_delete_create(vx_req_account_buddy_delete_t ** req);
typedef struct vx_req_account_buddygroup_set {
vx_req_base_t base;
VX_HANDLE account_handle;
int group_id;
char* group_name;
char* group_data;
} vx_req_account_buddygroup_set_t;
VIVOXSDK_DLLEXPORT void vx_req_account_buddygroup_set_create(vx_req_account_buddygroup_set_t ** req);
typedef struct vx_req_account_buddygroup_delete {
vx_req_base_t base;
VX_HANDLE account_handle;
int group_id;
} vx_req_account_buddygroup_delete_t;
VIVOXSDK_DLLEXPORT void vx_req_account_buddygroup_delete_create(vx_req_account_buddygroup_delete_t ** req);
typedef struct vx_req_account_list_buddies_and_groups {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_list_buddies_and_groups_t;
VIVOXSDK_DLLEXPORT void vx_req_account_list_buddies_and_groups_create(vx_req_account_list_buddies_and_groups_t ** req);
typedef struct vx_req_session_send_message {
vx_req_base_t base;
VX_HANDLE session_handle;
char* message_header;
char* message_body;
} vx_req_session_send_message_t;
VIVOXSDK_DLLEXPORT void vx_req_session_send_message_create(vx_req_session_send_message_t ** req);
typedef struct vx_req_account_set_presence {
vx_req_base_t base;
VX_HANDLE account_handle;
vx_buddy_presence_state presence;
char* custom_message;
} vx_req_account_set_presence_t;
VIVOXSDK_DLLEXPORT void vx_req_account_set_presence_create(vx_req_account_set_presence_t ** req);
typedef struct vx_req_account_send_subscription_reply {
vx_req_base_t base;
VX_HANDLE account_handle;
vx_rule_type rule_type;
int auto_accept;
char* buddy_uri;
char* subscription_handle;
} vx_req_account_send_subscription_reply_t;
VIVOXSDK_DLLEXPORT void vx_req_account_send_subscription_reply_create(vx_req_account_send_subscription_reply_t ** req);
typedef struct vx_req_session_send_notification {
vx_req_base_t base;
VX_HANDLE session_handle;
vx_notification_type notification_type;
} vx_req_session_send_notification_t;
VIVOXSDK_DLLEXPORT void vx_req_session_send_notification_create(vx_req_session_send_notification_t ** req);
typedef struct vx_req_account_create_block_rule {
vx_req_base_t base;
VX_HANDLE account_handle;
char* block_mask;
int presence_only;
} vx_req_account_create_block_rule_t;
VIVOXSDK_DLLEXPORT void vx_req_account_create_block_rule_create(vx_req_account_create_block_rule_t ** req);
typedef struct vx_req_account_delete_block_rule {
vx_req_base_t base;
VX_HANDLE account_handle;
char* block_mask;
} vx_req_account_delete_block_rule_t;
VIVOXSDK_DLLEXPORT void vx_req_account_delete_block_rule_create(vx_req_account_delete_block_rule_t ** req);
typedef struct vx_req_account_list_block_rules {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_list_block_rules_t;
VIVOXSDK_DLLEXPORT void vx_req_account_list_block_rules_create(vx_req_account_list_block_rules_t ** req);
typedef struct vx_req_account_create_auto_accept_rule {
vx_req_base_t base;
VX_HANDLE account_handle;
char* auto_accept_mask;
int auto_add_as_buddy;
} vx_req_account_create_auto_accept_rule_t;
VIVOXSDK_DLLEXPORT void vx_req_account_create_auto_accept_rule_create(vx_req_account_create_auto_accept_rule_t ** req);
typedef struct vx_req_account_delete_auto_accept_rule {
vx_req_base_t base;
VX_HANDLE account_handle;
char* auto_accept_mask;
} vx_req_account_delete_auto_accept_rule_t;
VIVOXSDK_DLLEXPORT void vx_req_account_delete_auto_accept_rule_create(vx_req_account_delete_auto_accept_rule_t ** req);
typedef struct vx_req_account_list_auto_accept_rules {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_list_auto_accept_rules_t;
VIVOXSDK_DLLEXPORT void vx_req_account_list_auto_accept_rules_create(vx_req_account_list_auto_accept_rules_t ** req);
typedef struct vx_req_account_update_account {
vx_req_base_t base;
VX_HANDLE account_handle;
char* phone;
char* carrier;
} vx_req_account_update_account_t;
VIVOXSDK_DLLEXPORT void vx_req_account_update_account_create(vx_req_account_update_account_t ** req);
typedef struct vx_req_account_get_account {
vx_req_base_t base;
VX_HANDLE account_handle;
} vx_req_account_get_account_t;
VIVOXSDK_DLLEXPORT void vx_req_account_get_account_create(vx_req_account_get_account_t ** req);
typedef struct vx_req_account_send_sms {
vx_req_base_t base;
VX_HANDLE account_handle;
char* recipient_uri;
char* content;
} vx_req_account_send_sms_t;
VIVOXSDK_DLLEXPORT void vx_req_account_send_sms_create(vx_req_account_send_sms_t ** req);
typedef struct vx_req_aux_connectivity_info {
vx_req_base_t base;
char* well_known_ip;
char* stun_server;
char* echo_server;
int echo_port;
int timeout;
char* acct_mgmt_server;
} vx_req_aux_connectivity_info_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_connectivity_info_create(vx_req_aux_connectivity_info_t ** req);
typedef struct vx_req_aux_get_render_devices {
vx_req_base_t base;
} vx_req_aux_get_render_devices_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_get_render_devices_create(vx_req_aux_get_render_devices_t ** req);
typedef struct vx_req_aux_get_capture_devices {
vx_req_base_t base;
} vx_req_aux_get_capture_devices_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_get_capture_devices_create(vx_req_aux_get_capture_devices_t ** req);
typedef struct vx_req_aux_set_render_device {
vx_req_base_t base;
char* render_device_specifier;
} vx_req_aux_set_render_device_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_set_render_device_create(vx_req_aux_set_render_device_t ** req);
typedef struct vx_req_aux_set_capture_device {
vx_req_base_t base;
char* capture_device_specifier;
} vx_req_aux_set_capture_device_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_set_capture_device_create(vx_req_aux_set_capture_device_t ** req);
typedef struct vx_req_aux_get_mic_level {
vx_req_base_t base;
} vx_req_aux_get_mic_level_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_get_mic_level_create(vx_req_aux_get_mic_level_t ** req);
typedef struct vx_req_aux_get_speaker_level {
vx_req_base_t base;
} vx_req_aux_get_speaker_level_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_get_speaker_level_create(vx_req_aux_get_speaker_level_t ** req);
typedef struct vx_req_aux_set_mic_level {
vx_req_base_t base;
int level;
} vx_req_aux_set_mic_level_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_set_mic_level_create(vx_req_aux_set_mic_level_t ** req);
typedef struct vx_req_aux_set_speaker_level {
vx_req_base_t base;
int level;
} vx_req_aux_set_speaker_level_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_set_speaker_level_create(vx_req_aux_set_speaker_level_t ** req);
typedef struct vx_req_aux_render_audio_start {
vx_req_base_t base;
char* sound_file_path;
int loop;
} vx_req_aux_render_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_render_audio_start_create(vx_req_aux_render_audio_start_t ** req);
typedef struct vx_req_aux_render_audio_stop {
vx_req_base_t base;
} vx_req_aux_render_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_render_audio_stop_create(vx_req_aux_render_audio_stop_t ** req);
typedef struct vx_req_aux_capture_audio_start {
vx_req_base_t base;
int duration;
} vx_req_aux_capture_audio_start_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_capture_audio_start_create(vx_req_aux_capture_audio_start_t ** req);
typedef struct vx_req_aux_capture_audio_stop {
vx_req_base_t base;
} vx_req_aux_capture_audio_stop_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_capture_audio_stop_create(vx_req_aux_capture_audio_stop_t ** req);
typedef struct {
vx_req_base_t base;
char * name;
int code_count;
int codes[10];
} vx_req_aux_global_monitor_keyboard_mouse_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_global_monitor_keyboard_mouse_create(vx_req_aux_global_monitor_keyboard_mouse_t ** req);
typedef struct {
vx_req_base_t base;
int seconds;
} vx_req_aux_set_idle_timeout_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_set_idle_timeout_create(vx_req_aux_set_idle_timeout_t ** req);
typedef struct {
char *admin_username;
char *admin_password;
char *grant_document;
char *server_url;
} vx_generic_credentials;
typedef struct {
vx_req_base_t base;
vx_generic_credentials credentials;
char *user_name;
char *password;
char *email;
char *number;
char *displayname;
char *firstname;
char *lastname;
char *phone;
char *lang;
char *age;
char *gender;
char *timezone;
char *alias;
char *ext_profile;
char *ext_id;
} vx_req_aux_create_account_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_create_account_create(vx_req_aux_create_account_t ** req);
typedef struct {
vx_req_base_t base;
vx_generic_credentials credentials;
char *user_name;
} vx_req_aux_reactivate_account_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_reactivate_account_create(vx_req_aux_reactivate_account_t ** req);
typedef struct {
vx_req_base_t base;
vx_generic_credentials credentials;
char *user_name;
} vx_req_aux_deactivate_account_t;
VIVOXSDK_DLLEXPORT void vx_req_aux_deactivate_account_create(vx_req_aux_deactivate_account_t ** req);
VIVOXSDK_DLLEXPORT extern void destroy_req(vx_req_base_t *pCmd);
#ifdef __cplusplus
}
#endif
#endif /*ndef __VXCREQUESTS_H__*/
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCLR/mvVoiceCLR.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
// mvVoiceCLR.h
#pragma once
using namespace System;
namespace mvVoiceCLR {
public ref class VoiceCLR
{
public:
static System::String^ GetConnectorID();
static System::String^ GetAccountID();
static System::String^ GetSessionID();
static int Init(System::String^ ssServer);
static int Login(System::String^ ssConnectorID, System::String^ ssUsername, System::String^ ssPassword);
static int Call(System::String^ ssAccountID, System::String^ ssVoiceServer);
static int Hangup(System::String^ ssSessionID);
static int Logout(System::String^ ssAccountID);
static int Shutdown(System::String^ ssConnectorID);
static int MicMute(System::String^ ssConnectorID, bool mute);
};
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/VxcErrors.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform
#ifndef __VXCERRORS_H
#define __VXCERRORS_H
#include "VxcExports.h"
/* Copyright (c) 2007 by Vivox Inc.
*
* Permission to use, copy, modify or distribute this software in binary or source form
* for any purpose is allowed only under explicit prior consent in writing from Vivox Inc.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND VIVOX DISCLAIMS
* ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL VIVOX
* BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
* ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
// Error Code Definitions
#define VX_E_INVALID_XML 1000
#define VX_E_NO_EXIST 1001
#define VX_E_MAX_CONNECTOR_LIMIT_EXCEEDED 1002
#define VX_E_MAX_SESSION_LIMIT_EXCEEDED 1003
#define VX_E_FAILED 1004
#define VX_E_ALREADY_LOGGED_IN 1005
#define VX_E_ALREADY_LOGGED_OUT 1006 // This is really not returned
#define VX_E_NOT_LOGGED_IN 1007 // this is not returned
#define VX_E_INVALID_ARGUMENT 1008
#define VX_E_INVALID_USERNAME_OR_PASSWORD 1009
#define VX_E_INSUFFICIENT_PRIVILEGE 1010
#define VX_E_NO_SUCH_SESSION 1011
#define VX_E_NOT_INITIALIZED 1012
#define VX_E_REQUESTCONTEXT_NOT_FOUND 1013
#define VX_E_LOGIN_FAILED 1014
#define VX_E_SESSION_MAX 1015 // used if already on a call
#define VX_E_WRONG_CONNECTOR 1016
#define VX_E_NOT_IMPL 1017
#define VX_E_REQUEST_CANCELLED 1018
#define VX_E_INVALID_SESSION_STATE 1019
#define VX_E_SESSION_CREATE_PENDING 1020
#define VX_E_SESSION_TERMINATE_PENDING 1021
#define VX_E_SESSION_CHANNEL_TEXT_DENIED 1022 // We currently do not support multi-party text chat
#define VX_E_SESSION_TEXT_DENIED 1023 // This session does not support text messaging
#define VX_E_SESSION_MESSAGE_BUILD_FAILED 1024 // The call to am_message_build failed for an unknown reason
#define VX_E_SESSION_MSG_CONTENT_TYPE_FAILED 1025 // The call to osip_message_set_content_type failed for an unknown reason
#define VX_E_SESSION_MEDIA_CONNECT_FAILED 1026 // The media connect call failed
#define VX_E_SESSION_MEDIA_DISCONNECT_FAILED 1026 // The media disconnect call failed
#define VX_E_SESSION_DOES_NOT_HAVE_TEXT 1027 // The session does not have text
#define VX_E_SESSION_DOES_NOT_HAVE_AUDIO 1028 // The session does not have audio
#define VX_E_SESSION_MUST_HAVE_MEDIA 1029 // The session must have media specified (audio or text)
#define VX_E_SESSION_IS_NOT_3D 1030 // The session is not a SIREN14-3D codec call, therefore it can not be a 3D call
#define VX_E_SESSIONGROUP_NOT_FOUND 1031 // The sessiongroup can not be found
#define VX_E_REQUEST_TYPE_NOT_SUPPORTED 1032
#define VX_E_REQUEST_NOT_SUPPORTED 1033
#define VX_E_MULTI_CHANNEL_DENIED 1034
#define VX_E_MEDIA_DISCONNECT_NOT_ALLOWED 1035
#define VX_E_PRELOGIN_INFO_NOT_RETURNED 1036
#define VX_E_FAILED_TO_CONNECT_TO_SERVER 10007
#ifdef __cplusplus
extern "C" {
#endif
VIVOXSDK_DLLEXPORT char *vx_get_error_string(int errorCode);
#ifdef __cplusplus
}
#endif
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/vq/latticehint.c
|
<filename>lib/vorbis/vq/latticehint.c
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: utility main for building thresh/pigeonhole encode hints
last mod: $Id: latticehint.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include "../lib/scales.h"
#include "bookutil.h"
#include "vqgen.h"
#include "vqsplit.h"
/* The purpose of this util is to build encode hints for lattice
codebooks so that brute forcing each codebook entry isn't needed.
Threshhold hints are for books in which each scalar in the vector
is independant (eg, residue) and pigeonhole lookups provide a
minimum error fit for words where the scalars are interdependant
(each affecting the fit of the next in sequence) as in an LSP
sequential book (or can be used along with a sparse threshhold map,
like a splitting tree that need not be trained)
If the input book is non-sequential, a threshhold hint is built.
If the input book is sequential, a pigeonholing hist is built.
If the book is sparse, a pigeonholing hint is built, possibly in addition
to the threshhold hint
command line:
latticehint book.vqh [threshlist]
latticehint produces book.vqh on stdout */
static int longsort(const void *a, const void *b){
return(**((long **)a)-**((long **)b));
}
static int addtosearch(int entry,long **tempstack,long *tempcount,int add){
long *ptr=tempstack[entry];
long i=tempcount[entry];
if(ptr){
while(i--)
if(*ptr++==add)return(0);
tempstack[entry]=_ogg_realloc(tempstack[entry],
(tempcount[entry]+1)*sizeof(long));
}else{
tempstack[entry]=_ogg_malloc(sizeof(long));
}
tempstack[entry][tempcount[entry]++]=add;
return(1);
}
static void setvals(int dim,encode_aux_pigeonhole *p,
long *temptrack,float *tempmin,float *tempmax,
int seqp){
int i;
float last=0.f;
for(i=0;i<dim;i++){
tempmin[i]=(temptrack[i])*p->del+p->min+last;
tempmax[i]=tempmin[i]+p->del;
if(seqp)last=tempmin[i];
}
}
/* note that things are currently set up such that input fits that
quantize outside the pigeonmap are dropped and brute-forced. So we
can ignore the <0 and >=n boundary cases in min/max error */
static float minerror(int dim,float *a,encode_aux_pigeonhole *p,
long *temptrack,float *tempmin,float *tempmax){
int i;
float err=0.f;
for(i=0;i<dim;i++){
float eval=0.f;
if(a[i]<tempmin[i]){
eval=tempmin[i]-a[i];
}else if(a[i]>tempmax[i]){
eval=a[i]-tempmax[i];
}
err+=eval*eval;
}
return(err);
}
static float maxerror(int dim,float *a,encode_aux_pigeonhole *p,
long *temptrack,float *tempmin,float *tempmax){
int i;
float err=0.f,eval;
for(i=0;i<dim;i++){
if(a[i]<tempmin[i]){
eval=tempmax[i]-a[i];
}else if(a[i]>tempmax[i]){
eval=a[i]-tempmin[i];
}else{
float t1=a[i]-tempmin[i];
eval=tempmax[i]-a[i];
if(t1>eval)eval=t1;
}
err+=eval*eval;
}
return(err);
}
int main(int argc,char *argv[]){
codebook *b;
static_codebook *c;
int entries=-1,dim=-1;
float min,del;
char *name;
long i,j;
float *suggestions;
int suggcount=0;
if(argv[1]==NULL){
fprintf(stderr,"Need a lattice book on the command line.\n");
exit(1);
}
{
char *ptr;
char *filename=strdup(argv[1]);
b=codebook_load(filename);
c=(static_codebook *)(b->c);
ptr=strrchr(filename,'.');
if(ptr){
*ptr='\0';
name=strdup(filename);
}else{
name=strdup(filename);
}
}
if(c->maptype!=1){
fprintf(stderr,"Provided book is not a latticebook.\n");
exit(1);
}
entries=b->entries;
dim=b->dim;
min=_float32_unpack(c->q_min);
del=_float32_unpack(c->q_delta);
/* Do we want to gen a threshold hint? */
if(c->q_sequencep==0){
/* yes. Discard any preexisting threshhold hint */
long quantvals=_book_maptype1_quantvals(c);
long **quantsort=alloca(quantvals*sizeof(long *));
encode_aux_threshmatch *t=_ogg_calloc(1,sizeof(encode_aux_threshmatch));
c->thresh_tree=t;
fprintf(stderr,"Adding threshold hint to %s...\n",name);
/* partial/complete suggestions */
if(argv[2]){
char *ptr=strdup(argv[2]);
suggestions=alloca(sizeof(float)*quantvals);
for(suggcount=0;ptr && suggcount<quantvals;suggcount++){
char *ptr2=strchr(ptr,',');
if(ptr2)*ptr2++='\0';
suggestions[suggcount]=atof(ptr);
ptr=ptr2;
}
}
/* simplest possible threshold hint only */
t->quantthresh=_ogg_calloc(quantvals-1,sizeof(float));
t->quantmap=_ogg_calloc(quantvals,sizeof(int));
t->threshvals=quantvals;
t->quantvals=quantvals;
/* the quantvals may not be in order; sort em first */
for(i=0;i<quantvals;i++)quantsort[i]=c->quantlist+i;
qsort(quantsort,quantvals,sizeof(long *),longsort);
/* ok, gen the map and thresholds */
for(i=0;i<quantvals;i++)t->quantmap[i]=quantsort[i]-c->quantlist;
for(i=0;i<quantvals-1;i++){
float v1=*(quantsort[i])*del+min;
float v2=*(quantsort[i+1])*del+min;
for(j=0;j<suggcount;j++)
if(v1<suggestions[j] && suggestions[j]<v2){
t->quantthresh[i]=suggestions[j];
break;
}
if(j==suggcount){
t->quantthresh[i]=(v1+v2)*.5;
}
}
}
/* Do we want to gen a pigeonhole hint? */
#if 0
for(i=0;i<entries;i++)if(c->lengthlist[i]==0)break;
if(c->q_sequencep || i<entries){
long **tempstack;
long *tempcount;
long *temptrack;
float *tempmin;
float *tempmax;
long totalstack=0;
long pigeons;
long subpigeons;
long quantvals=_book_maptype1_quantvals(c);
int changep=1,factor;
encode_aux_pigeonhole *p=_ogg_calloc(1,sizeof(encode_aux_pigeonhole));
c->pigeon_tree=p;
fprintf(stderr,"Adding pigeonhole hint to %s...\n",name);
/* the idea is that we quantize uniformly, even in a nonuniform
lattice, so that quantization of one scalar has a predictable
result on the next sequential scalar in a greedy matching
algorithm. We generate a lookup based on the quantization of
the vector (pigeonmap groups quantized entries together) and
list the entries that could possible be the best fit for any
given member of that pigeonhole. The encode process then has a
much smaller list to brute force */
/* find our pigeonhole-specific quantization values, fill in the
quant value->pigeonhole map */
factor=3;
p->del=del;
p->min=min;
p->quantvals=quantvals;
{
int max=0;
for(i=0;i<quantvals;i++)if(max<c->quantlist[i])max=c->quantlist[i];
p->mapentries=max;
}
p->pigeonmap=_ogg_malloc(p->mapentries*sizeof(long));
p->quantvals=(quantvals+factor-1)/factor;
/* pigeonhole roughly on the boundaries of the quantvals; the
exact pigeonhole grouping is an optimization issue, not a
correctness issue */
for(i=0;i<p->mapentries;i++){
float thisval=del*i+min; /* middle of the quant zone */
int quant=0;
float err=fabs(c->quantlist[0]*del+min-thisval);
for(j=1;j<quantvals;j++){
float thiserr=fabs(c->quantlist[j]*del+min-thisval);
if(thiserr<err){
quant=j/factor;
err=thiserr;
}
}
p->pigeonmap[i]=quant;
}
/* pigeonmap complete. Now do the grungy business of finding the
entries that could possibly be the best fit for a value appearing
in the pigeonhole. The trick that allows the below to work is the
uniform quantization; even though the scalars may be 'sequential'
(each a delta from the last), the uniform quantization means that
the error variance is *not* dependant. Given a pigeonhole and an
entry, we can find the minimum and maximum possible errors
(relative to the entry) for any point that could appear in the
pigeonhole */
/* must iterate over both pigeonholes and entries */
/* temporarily (in order to avoid thinking hard), we grow each
pigeonhole seperately, the build a stack of 'em later */
pigeons=1;
subpigeons=1;
for(i=0;i<dim;i++)subpigeons*=p->mapentries;
for(i=0;i<dim;i++)pigeons*=p->quantvals;
temptrack=_ogg_calloc(dim,sizeof(long));
tempmin=_ogg_calloc(dim,sizeof(float));
tempmax=_ogg_calloc(dim,sizeof(float));
tempstack=_ogg_calloc(pigeons,sizeof(long *));
tempcount=_ogg_calloc(pigeons,sizeof(long));
while(1){
float errorpost=-1;
char buffer[80];
/* map our current pigeonhole to a 'big pigeonhole' so we know
what list we're after */
int entry=0;
for(i=dim-1;i>=0;i--)entry=entry*p->quantvals+p->pigeonmap[temptrack[i]];
setvals(dim,p,temptrack,tempmin,tempmax,c->q_sequencep);
sprintf(buffer,"Building pigeonhole search list [%ld]...",totalstack);
/* Search all entries to find the one with the minimum possible
maximum error. Record that error */
for(i=0;i<entries;i++){
if(c->lengthlist[i]>0){
float this=maxerror(dim,b->valuelist+i*dim,p,
temptrack,tempmin,tempmax);
if(errorpost==-1 || this<errorpost)errorpost=this;
spinnit(buffer,subpigeons);
}
}
/* Our search list will contain all entries with a minimum
possible error <= our errorpost */
for(i=0;i<entries;i++)
if(c->lengthlist[i]>0){
spinnit(buffer,subpigeons);
if(minerror(dim,b->valuelist+i*dim,p,
temptrack,tempmin,tempmax)<errorpost)
totalstack+=addtosearch(entry,tempstack,tempcount,i);
}
for(i=0;i<dim;i++){
temptrack[i]++;
if(temptrack[i]<p->mapentries)break;
temptrack[i]=0;
}
if(i==dim)break;
subpigeons--;
}
fprintf(stderr,"\r "
"\rTotal search list size (all entries): %ld\n",totalstack);
/* pare the index of lists for improbable quantizations (where
improbable is determined by c->lengthlist; we assume that
pigeonholing is in sync with the codeword cells, which it is */
/*for(i=0;i<entries;i++){
float probability= 1.f/(1<<c->lengthlist[i]);
if(c->lengthlist[i]==0 || probability*entries<cutoff){
totalstack-=tempcount[i];
tempcount[i]=0;
}
}*/
/* pare the list of shortlists; merge contained and similar lists
together */
p->fitmap=_ogg_malloc(pigeons*sizeof(long));
for(i=0;i<pigeons;i++)p->fitmap[i]=-1;
while(changep){
char buffer[80];
changep=0;
for(i=0;i<pigeons;i++){
if(p->fitmap[i]<0 && tempcount[i]){
for(j=i+1;j<pigeons;j++){
if(p->fitmap[j]<0 && tempcount[j]){
/* is one list a superset, or are they sufficiently similar? */
int amiss=0,bmiss=0,ii,jj;
for(ii=0;ii<tempcount[i];ii++){
for(jj=0;jj<tempcount[j];jj++)
if(tempstack[i][ii]==tempstack[j][jj])break;
if(jj==tempcount[j])amiss++;
}
for(jj=0;jj<tempcount[j];jj++){
for(ii=0;ii<tempcount[i];ii++)
if(tempstack[i][ii]==tempstack[j][jj])break;
if(ii==tempcount[i])bmiss++;
}
if(amiss==0 ||
bmiss==0 ||
(amiss*2<tempcount[i] && bmiss*2<tempcount[j] &&
tempcount[i]+bmiss<entries/30)){
/*superset/similar Add all of one to the other. */
for(jj=0;jj<tempcount[j];jj++)
totalstack+=addtosearch(i,tempstack,tempcount,
tempstack[j][jj]);
totalstack-=tempcount[j];
p->fitmap[j]=i;
changep=1;
}
}
}
sprintf(buffer,"Consolidating [%ld total, %s]... ",totalstack,
changep?"reit":"nochange");
spinnit(buffer,pigeons-i);
}
}
}
/* repack the temp stack in final form */
fprintf(stderr,"\r "
"\rFinal total list size: %ld\n",totalstack);
p->fittotal=totalstack;
p->fitlist=_ogg_malloc((totalstack+1)*sizeof(long));
p->fitlength=_ogg_malloc(pigeons*sizeof(long));
{
long usage=0;
for(i=0;i<pigeons;i++){
if(p->fitmap[i]==-1){
if(tempcount[i])
memcpy(p->fitlist+usage,tempstack[i],tempcount[i]*sizeof(long));
p->fitmap[i]=usage;
p->fitlength[i]=tempcount[i];
usage+=tempcount[i];
if(usage>totalstack){
fprintf(stderr,"Internal error; usage>totalstack\n");
exit(1);
}
}else{
p->fitlength[i]=p->fitlength[p->fitmap[i]];
p->fitmap[i]=p->fitmap[p->fitmap[i]];
}
}
}
}
#endif
write_codebook(stdout,name,c);
fprintf(stderr,"\r "
"\nDone.\n");
exit(0);
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/modes/setup_44.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform<filename>lib/vorbis/lib/modes/setup_44.h
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: toplevel settings for 44.1/48kHz
last mod: $Id: setup_44.h 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include "modes/floor_all.h"
#include "modes/residue_44.h"
#include "modes/psych_44.h"
static double rate_mapping_44_stereo[12]={
22500.,32000.,40000.,48000.,56000.,64000.,
80000.,96000.,112000.,128000.,160000.,250001.
};
static double quality_mapping_44[12]={
-.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
};
static int blocksize_short_44[11]={
512,256,256,256,256,256,256,256,256,256,256
};
static int blocksize_long_44[11]={
4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
};
static double _psy_compand_short_mapping[12]={
0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
};
static double _psy_compand_long_mapping[12]={
3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
};
static double _global_mapping_44[12]={
/* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
};
static int _floor_short_mapping_44[11]={
1,0,0,2,2,4,5,5,5,5,5
};
static int _floor_long_mapping_44[11]={
8,7,7,7,7,7,7,7,7,7,7
};
ve_setup_data_template ve_setup_44_stereo={
11,
rate_mapping_44_stereo,
quality_mapping_44,
2,
40000,
50000,
blocksize_short_44,
blocksize_long_44,
_psy_tone_masteratt_44,
_psy_tone_0dB,
_psy_tone_suppress,
_vp_tonemask_adj_otherblock,
_vp_tonemask_adj_longblock,
_vp_tonemask_adj_otherblock,
_psy_noiseguards_44,
_psy_noisebias_impulse,
_psy_noisebias_padding,
_psy_noisebias_trans,
_psy_noisebias_long,
_psy_noise_suppress,
_psy_compand_44,
_psy_compand_short_mapping,
_psy_compand_long_mapping,
{_noise_start_short_44,_noise_start_long_44},
{_noise_part_short_44,_noise_part_long_44},
_noise_thresh_44,
_psy_ath_floater,
_psy_ath_abs,
_psy_lowpass_44,
_psy_global_44,
_global_mapping_44,
_psy_stereo_modes_44,
_floor_books,
_floor,
_floor_short_mapping_44,
_floor_long_mapping_44,
_mapres_template_44_stereo
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/lib/smallft.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: *unnormalized* fft transform
last mod: $Id: smallft.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
/* FFT implementation from OggSquish, minus cosine transforms,
* minus all but radix 2/4 case. In Vorbis we only need this
* cut-down version.
*
* To do more than just power-of-two sized vectors, see the full
* version I wrote for NetLib.
*
* Note that the packing is a little strange; rather than the FFT r/i
* packing following R_0, I_n, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1,
* it follows R_0, R_1, I_1, R_2, I_2 ... R_n-1, I_n-1, I_n like the
* FORTRAN version
*/
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "smallft.h"
#include "os.h"
#include "misc.h"
static void drfti1(int n, float *wa, int *ifac){
static int ntryh[4] = { 4,2,3,5 };
static float tpi = 6.28318530717958648f;
float arg,argh,argld,fi;
int ntry=0,i,j=-1;
int k1, l1, l2, ib;
int ld, ii, ip, is, nq, nr;
int ido, ipm, nfm1;
int nl=n;
int nf=0;
L101:
j++;
if (j < 4)
ntry=ntryh[j];
else
ntry+=2;
L104:
nq=nl/ntry;
nr=nl-ntry*nq;
if (nr!=0) goto L101;
nf++;
ifac[nf+1]=ntry;
nl=nq;
if(ntry!=2)goto L107;
if(nf==1)goto L107;
for (i=1;i<nf;i++){
ib=nf-i+1;
ifac[ib+1]=ifac[ib];
}
ifac[2] = 2;
L107:
if(nl!=1)goto L104;
ifac[0]=n;
ifac[1]=nf;
argh=tpi/n;
is=0;
nfm1=nf-1;
l1=1;
if(nfm1==0)return;
for (k1=0;k1<nfm1;k1++){
ip=ifac[k1+2];
ld=0;
l2=l1*ip;
ido=n/l2;
ipm=ip-1;
for (j=0;j<ipm;j++){
ld+=l1;
i=is;
argld=(float)ld*argh;
fi=0.f;
for (ii=2;ii<ido;ii+=2){
fi+=1.f;
arg=fi*argld;
wa[i++]=cos(arg);
wa[i++]=sin(arg);
}
is+=ido;
}
l1=l2;
}
}
static void fdrffti(int n, float *wsave, int *ifac){
if (n == 1) return;
drfti1(n, wsave+n, ifac);
}
static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
int i,k;
float ti2,tr2;
int t0,t1,t2,t3,t4,t5,t6;
t1=0;
t0=(t2=l1*ido);
t3=ido<<1;
for(k=0;k<l1;k++){
ch[t1<<1]=cc[t1]+cc[t2];
ch[(t1<<1)+t3-1]=cc[t1]-cc[t2];
t1+=ido;
t2+=ido;
}
if(ido<2)return;
if(ido==2)goto L105;
t1=0;
t2=t0;
for(k=0;k<l1;k++){
t3=t2;
t4=(t1<<1)+(ido<<1);
t5=t1;
t6=t1+t1;
for(i=2;i<ido;i+=2){
t3+=2;
t4-=2;
t5+=2;
t6+=2;
tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
ch[t6]=cc[t5]+ti2;
ch[t4]=ti2-cc[t5];
ch[t6-1]=cc[t5-1]+tr2;
ch[t4-1]=cc[t5-1]-tr2;
}
t1+=ido;
t2+=ido;
}
if(ido%2==1)return;
L105:
t3=(t2=(t1=ido)-1);
t2+=t0;
for(k=0;k<l1;k++){
ch[t1]=-cc[t2];
ch[t1-1]=cc[t3];
t1+=ido<<1;
t2+=ido;
t3+=ido;
}
}
static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
float *wa2,float *wa3){
static float hsqt2 = .70710678118654752f;
int i,k,t0,t1,t2,t3,t4,t5,t6;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
t1=t0;
t4=t1<<1;
t2=t1+(t1<<1);
t3=0;
for(k=0;k<l1;k++){
tr1=cc[t1]+cc[t2];
tr2=cc[t3]+cc[t4];
ch[t5=t3<<2]=tr1+tr2;
ch[(ido<<2)+t5-1]=tr2-tr1;
ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4];
ch[t5]=cc[t2]-cc[t1];
t1+=ido;
t2+=ido;
t3+=ido;
t4+=ido;
}
if(ido<2)return;
if(ido==2)goto L105;
t1=0;
for(k=0;k<l1;k++){
t2=t1;
t4=t1<<2;
t5=(t6=ido<<1)+t4;
for(i=2;i<ido;i+=2){
t3=(t2+=2);
t4+=2;
t5-=2;
t3+=t0;
cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3];
ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1];
t3+=t0;
cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3];
ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1];
t3+=t0;
cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3];
ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1];
tr1=cr2+cr4;
tr4=cr4-cr2;
ti1=ci2+ci4;
ti4=ci2-ci4;
ti2=cc[t2]+ci3;
ti3=cc[t2]-ci3;
tr2=cc[t2-1]+cr3;
tr3=cc[t2-1]-cr3;
ch[t4-1]=tr1+tr2;
ch[t4]=ti1+ti2;
ch[t5-1]=tr3-ti4;
ch[t5]=tr4-ti3;
ch[t4+t6-1]=ti4+tr3;
ch[t4+t6]=tr4+ti3;
ch[t5+t6-1]=tr2-tr1;
ch[t5+t6]=ti1-ti2;
}
t1+=ido;
}
if(ido&1)return;
L105:
t2=(t1=t0+ido-1)+(t0<<1);
t3=ido<<2;
t4=ido;
t5=ido<<1;
t6=ido;
for(k=0;k<l1;k++){
ti1=-hsqt2*(cc[t1]+cc[t2]);
tr1=hsqt2*(cc[t1]-cc[t2]);
ch[t4-1]=tr1+cc[t6-1];
ch[t4+t5-1]=cc[t6-1]-tr1;
ch[t4]=ti1-cc[t1+t0];
ch[t4+t5]=ti1+cc[t1+t0];
t1+=ido;
t2+=ido;
t4+=t3;
t6+=ido;
}
}
static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
float *c2,float *ch,float *ch2,float *wa){
static float tpi=6.283185307179586f;
int idij,ipph,i,j,k,l,ic,ik,is;
int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
float dc2,ai1,ai2,ar1,ar2,ds2;
int nbd;
float dcp,arg,dsp,ar1h,ar2h;
int idp2,ipp2;
arg=tpi/(float)ip;
dcp=cos(arg);
dsp=sin(arg);
ipph=(ip+1)>>1;
ipp2=ip;
idp2=ido;
nbd=(ido-1)>>1;
t0=l1*ido;
t10=ip*ido;
if(ido==1)goto L119;
for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik];
t1=0;
for(j=1;j<ip;j++){
t1+=t0;
t2=t1;
for(k=0;k<l1;k++){
ch[t2]=c1[t2];
t2+=ido;
}
}
is=-ido;
t1=0;
if(nbd>l1){
for(j=1;j<ip;j++){
t1+=t0;
is+=ido;
t2= -ido+t1;
for(k=0;k<l1;k++){
idij=is-1;
t2+=ido;
t3=t2;
for(i=2;i<ido;i+=2){
idij+=2;
t3+=2;
ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
}
}
}
}else{
for(j=1;j<ip;j++){
is+=ido;
idij=is-1;
t1+=t0;
t2=t1;
for(i=2;i<ido;i+=2){
idij+=2;
t2+=2;
t3=t2;
for(k=0;k<l1;k++){
ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3];
ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1];
t3+=ido;
}
}
}
}
t1=0;
t2=ipp2*t0;
if(nbd<l1){
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
for(i=2;i<ido;i+=2){
t3+=2;
t4+=2;
t5=t3-ido;
t6=t4-ido;
for(k=0;k<l1;k++){
t5+=ido;
t6+=ido;
c1[t5-1]=ch[t5-1]+ch[t6-1];
c1[t6-1]=ch[t5]-ch[t6];
c1[t5]=ch[t5]+ch[t6];
c1[t6]=ch[t6-1]-ch[t5-1];
}
}
}
}else{
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
for(k=0;k<l1;k++){
t5=t3;
t6=t4;
for(i=2;i<ido;i+=2){
t5+=2;
t6+=2;
c1[t5-1]=ch[t5-1]+ch[t6-1];
c1[t6-1]=ch[t5]-ch[t6];
c1[t5]=ch[t5]+ch[t6];
c1[t6]=ch[t6-1]-ch[t5-1];
}
t3+=ido;
t4+=ido;
}
}
}
L119:
for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
t1=0;
t2=ipp2*idl1;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1-ido;
t4=t2-ido;
for(k=0;k<l1;k++){
t3+=ido;
t4+=ido;
c1[t3]=ch[t3]+ch[t4];
c1[t4]=ch[t4]-ch[t3];
}
}
ar1=1.f;
ai1=0.f;
t1=0;
t2=ipp2*idl1;
t3=(ip-1)*idl1;
for(l=1;l<ipph;l++){
t1+=idl1;
t2-=idl1;
ar1h=dcp*ar1-dsp*ai1;
ai1=dcp*ai1+dsp*ar1;
ar1=ar1h;
t4=t1;
t5=t2;
t6=t3;
t7=idl1;
for(ik=0;ik<idl1;ik++){
ch2[t4++]=c2[ik]+ar1*c2[t7++];
ch2[t5++]=ai1*c2[t6++];
}
dc2=ar1;
ds2=ai1;
ar2=ar1;
ai2=ai1;
t4=idl1;
t5=(ipp2-1)*idl1;
for(j=2;j<ipph;j++){
t4+=idl1;
t5-=idl1;
ar2h=dc2*ar2-ds2*ai2;
ai2=dc2*ai2+ds2*ar2;
ar2=ar2h;
t6=t1;
t7=t2;
t8=t4;
t9=t5;
for(ik=0;ik<idl1;ik++){
ch2[t6++]+=ar2*c2[t8++];
ch2[t7++]+=ai2*c2[t9++];
}
}
}
t1=0;
for(j=1;j<ipph;j++){
t1+=idl1;
t2=t1;
for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++];
}
if(ido<l1)goto L132;
t1=0;
t2=0;
for(k=0;k<l1;k++){
t3=t1;
t4=t2;
for(i=0;i<ido;i++)cc[t4++]=ch[t3++];
t1+=ido;
t2+=t10;
}
goto L135;
L132:
for(i=0;i<ido;i++){
t1=i;
t2=i;
for(k=0;k<l1;k++){
cc[t2]=ch[t1];
t1+=ido;
t2+=t10;
}
}
L135:
t1=0;
t2=ido<<1;
t3=0;
t4=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t2;
t3+=t0;
t4-=t0;
t5=t1;
t6=t3;
t7=t4;
for(k=0;k<l1;k++){
cc[t5-1]=ch[t6];
cc[t5]=ch[t7];
t5+=t10;
t6+=ido;
t7+=ido;
}
}
if(ido==1)return;
if(nbd<l1)goto L141;
t1=-ido;
t3=0;
t4=0;
t5=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t2;
t3+=t2;
t4+=t0;
t5-=t0;
t6=t1;
t7=t3;
t8=t4;
t9=t5;
for(k=0;k<l1;k++){
for(i=2;i<ido;i+=2){
ic=idp2-i;
cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1];
cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1];
cc[i+t7]=ch[i+t8]+ch[i+t9];
cc[ic+t6]=ch[i+t9]-ch[i+t8];
}
t6+=t10;
t7+=t10;
t8+=ido;
t9+=ido;
}
}
return;
L141:
t1=-ido;
t3=0;
t4=0;
t5=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t2;
t3+=t2;
t4+=t0;
t5-=t0;
for(i=2;i<ido;i+=2){
t6=idp2+t1-i;
t7=i+t3;
t8=i+t4;
t9=i+t5;
for(k=0;k<l1;k++){
cc[t7-1]=ch[t8-1]+ch[t9-1];
cc[t6-1]=ch[t8-1]-ch[t9-1];
cc[t7]=ch[t8]+ch[t9];
cc[t6]=ch[t9]-ch[t8];
t6+=t10;
t7+=t10;
t8+=ido;
t9+=ido;
}
}
}
}
static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){
int i,k1,l1,l2;
int na,kh,nf;
int ip,iw,ido,idl1,ix2,ix3;
nf=ifac[1];
na=1;
l2=n;
iw=n;
for(k1=0;k1<nf;k1++){
kh=nf-k1;
ip=ifac[kh+1];
l1=l2/ip;
ido=n/l2;
idl1=ido*l1;
iw-=(ip-1)*ido;
na=1-na;
if(ip!=4)goto L102;
ix2=iw+ido;
ix3=ix2+ido;
if(na!=0)
dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
else
dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
goto L110;
L102:
if(ip!=2)goto L104;
if(na!=0)goto L103;
dradf2(ido,l1,c,ch,wa+iw-1);
goto L110;
L103:
dradf2(ido,l1,ch,c,wa+iw-1);
goto L110;
L104:
if(ido==1)na=1-na;
if(na!=0)goto L109;
dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
na=1;
goto L110;
L109:
dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
na=0;
L110:
l2=l1;
}
if(na==1)return;
for(i=0;i<n;i++)c[i]=ch[i];
}
static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
int i,k,t0,t1,t2,t3,t4,t5,t6;
float ti2,tr2;
t0=l1*ido;
t1=0;
t2=0;
t3=(ido<<1)-1;
for(k=0;k<l1;k++){
ch[t1]=cc[t2]+cc[t3+t2];
ch[t1+t0]=cc[t2]-cc[t3+t2];
t2=(t1+=ido)<<1;
}
if(ido<2)return;
if(ido==2)goto L105;
t1=0;
t2=0;
for(k=0;k<l1;k++){
t3=t1;
t5=(t4=t2)+(ido<<1);
t6=t0+t1;
for(i=2;i<ido;i+=2){
t3+=2;
t4+=2;
t5-=2;
t6+=2;
ch[t3-1]=cc[t4-1]+cc[t5-1];
tr2=cc[t4-1]-cc[t5-1];
ch[t3]=cc[t4]-cc[t5];
ti2=cc[t4]+cc[t5];
ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2;
ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2;
}
t2=(t1+=ido)<<1;
}
if(ido%2==1)return;
L105:
t1=ido-1;
t2=ido-1;
for(k=0;k<l1;k++){
ch[t1]=cc[t2]+cc[t2];
ch[t1+t0]=-(cc[t2+1]+cc[t2+1]);
t1+=ido;
t2+=ido<<1;
}
}
static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
float *wa2){
static float taur = -.5f;
static float taui = .8660254037844386f;
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10;
float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2;
t0=l1*ido;
t1=0;
t2=t0<<1;
t3=ido<<1;
t4=ido+(ido<<1);
t5=0;
for(k=0;k<l1;k++){
tr2=cc[t3-1]+cc[t3-1];
cr2=cc[t5]+(taur*tr2);
ch[t1]=cc[t5]+tr2;
ci3=taui*(cc[t3]+cc[t3]);
ch[t1+t0]=cr2-ci3;
ch[t1+t2]=cr2+ci3;
t1+=ido;
t3+=t4;
t5+=t4;
}
if(ido==1)return;
t1=0;
t3=ido<<1;
for(k=0;k<l1;k++){
t7=t1+(t1<<1);
t6=(t5=t7+t3);
t8=t1;
t10=(t9=t1+t0)+t0;
for(i=2;i<ido;i+=2){
t5+=2;
t6-=2;
t7+=2;
t8+=2;
t9+=2;
t10+=2;
tr2=cc[t5-1]+cc[t6-1];
cr2=cc[t7-1]+(taur*tr2);
ch[t8-1]=cc[t7-1]+tr2;
ti2=cc[t5]-cc[t6];
ci2=cc[t7]+(taur*ti2);
ch[t8]=cc[t7]+ti2;
cr3=taui*(cc[t5-1]-cc[t6-1]);
ci3=taui*(cc[t5]+cc[t6]);
dr2=cr2-ci3;
dr3=cr2+ci3;
di2=ci2+cr3;
di3=ci2-cr3;
ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2;
ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2;
ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3;
ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3;
}
t1+=ido;
}
}
static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
float *wa2,float *wa3){
static float sqrt2=1.414213562373095f;
int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
t0=l1*ido;
t1=0;
t2=ido<<2;
t3=0;
t6=ido<<1;
for(k=0;k<l1;k++){
t4=t3+t6;
t5=t1;
tr3=cc[t4-1]+cc[t4-1];
tr4=cc[t4]+cc[t4];
tr1=cc[t3]-cc[(t4+=t6)-1];
tr2=cc[t3]+cc[t4-1];
ch[t5]=tr2+tr3;
ch[t5+=t0]=tr1-tr4;
ch[t5+=t0]=tr2-tr3;
ch[t5+=t0]=tr1+tr4;
t1+=ido;
t3+=t2;
}
if(ido<2)return;
if(ido==2)goto L105;
t1=0;
for(k=0;k<l1;k++){
t5=(t4=(t3=(t2=t1<<2)+t6))+t6;
t7=t1;
for(i=2;i<ido;i+=2){
t2+=2;
t3+=2;
t4-=2;
t5-=2;
t7+=2;
ti1=cc[t2]+cc[t5];
ti2=cc[t2]-cc[t5];
ti3=cc[t3]-cc[t4];
tr4=cc[t3]+cc[t4];
tr1=cc[t2-1]-cc[t5-1];
tr2=cc[t2-1]+cc[t5-1];
ti4=cc[t3-1]-cc[t4-1];
tr3=cc[t3-1]+cc[t4-1];
ch[t7-1]=tr2+tr3;
cr3=tr2-tr3;
ch[t7]=ti2+ti3;
ci3=ti2-ti3;
cr2=tr1-tr4;
cr4=tr1+tr4;
ci2=ti1+ti4;
ci4=ti1-ti4;
ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2;
ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2;
ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3;
ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3;
ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4;
ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4;
}
t1+=ido;
}
if(ido%2 == 1)return;
L105:
t1=ido;
t2=ido<<2;
t3=ido-1;
t4=ido+(ido<<1);
for(k=0;k<l1;k++){
t5=t3;
ti1=cc[t1]+cc[t4];
ti2=cc[t4]-cc[t1];
tr1=cc[t1-1]-cc[t4-1];
tr2=cc[t1-1]+cc[t4-1];
ch[t5]=tr2+tr2;
ch[t5+=t0]=sqrt2*(tr1-ti1);
ch[t5+=t0]=ti2+ti2;
ch[t5+=t0]=-sqrt2*(tr1+ti1);
t3+=ido;
t1+=t2;
t4+=t2;
}
}
static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
float *c2,float *ch,float *ch2,float *wa){
static float tpi=6.283185307179586f;
int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,
t11,t12;
float dc2,ai1,ai2,ar1,ar2,ds2;
int nbd;
float dcp,arg,dsp,ar1h,ar2h;
int ipp2;
t10=ip*ido;
t0=l1*ido;
arg=tpi/(float)ip;
dcp=cos(arg);
dsp=sin(arg);
nbd=(ido-1)>>1;
ipp2=ip;
ipph=(ip+1)>>1;
if(ido<l1)goto L103;
t1=0;
t2=0;
for(k=0;k<l1;k++){
t3=t1;
t4=t2;
for(i=0;i<ido;i++){
ch[t3]=cc[t4];
t3++;
t4++;
}
t1+=ido;
t2+=t10;
}
goto L106;
L103:
t1=0;
for(i=0;i<ido;i++){
t2=t1;
t3=t1;
for(k=0;k<l1;k++){
ch[t2]=cc[t3];
t2+=ido;
t3+=t10;
}
t1++;
}
L106:
t1=0;
t2=ipp2*t0;
t7=(t5=ido<<1);
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
t6=t5;
for(k=0;k<l1;k++){
ch[t3]=cc[t6-1]+cc[t6-1];
ch[t4]=cc[t6]+cc[t6];
t3+=ido;
t4+=ido;
t6+=t10;
}
t5+=t7;
}
if (ido == 1)goto L116;
if(nbd<l1)goto L112;
t1=0;
t2=ipp2*t0;
t7=0;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
t7+=(ido<<1);
t8=t7;
for(k=0;k<l1;k++){
t5=t3;
t6=t4;
t9=t8;
t11=t8;
for(i=2;i<ido;i+=2){
t5+=2;
t6+=2;
t9+=2;
t11-=2;
ch[t5-1]=cc[t9-1]+cc[t11-1];
ch[t6-1]=cc[t9-1]-cc[t11-1];
ch[t5]=cc[t9]-cc[t11];
ch[t6]=cc[t9]+cc[t11];
}
t3+=ido;
t4+=ido;
t8+=t10;
}
}
goto L116;
L112:
t1=0;
t2=ipp2*t0;
t7=0;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
t7+=(ido<<1);
t8=t7;
t9=t7;
for(i=2;i<ido;i+=2){
t3+=2;
t4+=2;
t8+=2;
t9-=2;
t5=t3;
t6=t4;
t11=t8;
t12=t9;
for(k=0;k<l1;k++){
ch[t5-1]=cc[t11-1]+cc[t12-1];
ch[t6-1]=cc[t11-1]-cc[t12-1];
ch[t5]=cc[t11]-cc[t12];
ch[t6]=cc[t11]+cc[t12];
t5+=ido;
t6+=ido;
t11+=t10;
t12+=t10;
}
}
}
L116:
ar1=1.f;
ai1=0.f;
t1=0;
t9=(t2=ipp2*idl1);
t3=(ip-1)*idl1;
for(l=1;l<ipph;l++){
t1+=idl1;
t2-=idl1;
ar1h=dcp*ar1-dsp*ai1;
ai1=dcp*ai1+dsp*ar1;
ar1=ar1h;
t4=t1;
t5=t2;
t6=0;
t7=idl1;
t8=t3;
for(ik=0;ik<idl1;ik++){
c2[t4++]=ch2[t6++]+ar1*ch2[t7++];
c2[t5++]=ai1*ch2[t8++];
}
dc2=ar1;
ds2=ai1;
ar2=ar1;
ai2=ai1;
t6=idl1;
t7=t9-idl1;
for(j=2;j<ipph;j++){
t6+=idl1;
t7-=idl1;
ar2h=dc2*ar2-ds2*ai2;
ai2=dc2*ai2+ds2*ar2;
ar2=ar2h;
t4=t1;
t5=t2;
t11=t6;
t12=t7;
for(ik=0;ik<idl1;ik++){
c2[t4++]+=ar2*ch2[t11++];
c2[t5++]+=ai2*ch2[t12++];
}
}
}
t1=0;
for(j=1;j<ipph;j++){
t1+=idl1;
t2=t1;
for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++];
}
t1=0;
t2=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
for(k=0;k<l1;k++){
ch[t3]=c1[t3]-c1[t4];
ch[t4]=c1[t3]+c1[t4];
t3+=ido;
t4+=ido;
}
}
if(ido==1)goto L132;
if(nbd<l1)goto L128;
t1=0;
t2=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
for(k=0;k<l1;k++){
t5=t3;
t6=t4;
for(i=2;i<ido;i+=2){
t5+=2;
t6+=2;
ch[t5-1]=c1[t5-1]-c1[t6];
ch[t6-1]=c1[t5-1]+c1[t6];
ch[t5]=c1[t5]+c1[t6-1];
ch[t6]=c1[t5]-c1[t6-1];
}
t3+=ido;
t4+=ido;
}
}
goto L132;
L128:
t1=0;
t2=ipp2*t0;
for(j=1;j<ipph;j++){
t1+=t0;
t2-=t0;
t3=t1;
t4=t2;
for(i=2;i<ido;i+=2){
t3+=2;
t4+=2;
t5=t3;
t6=t4;
for(k=0;k<l1;k++){
ch[t5-1]=c1[t5-1]-c1[t6];
ch[t6-1]=c1[t5-1]+c1[t6];
ch[t5]=c1[t5]+c1[t6-1];
ch[t6]=c1[t5]-c1[t6-1];
t5+=ido;
t6+=ido;
}
}
}
L132:
if(ido==1)return;
for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik];
t1=0;
for(j=1;j<ip;j++){
t2=(t1+=t0);
for(k=0;k<l1;k++){
c1[t2]=ch[t2];
t2+=ido;
}
}
if(nbd>l1)goto L139;
is= -ido-1;
t1=0;
for(j=1;j<ip;j++){
is+=ido;
t1+=t0;
idij=is;
t2=t1;
for(i=2;i<ido;i+=2){
t2+=2;
idij+=2;
t3=t2;
for(k=0;k<l1;k++){
c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
t3+=ido;
}
}
}
return;
L139:
is= -ido-1;
t1=0;
for(j=1;j<ip;j++){
is+=ido;
t1+=t0;
t2=t1;
for(k=0;k<l1;k++){
idij=is;
t3=t2;
for(i=2;i<ido;i+=2){
idij+=2;
t3+=2;
c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3];
c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1];
}
t2+=ido;
}
}
}
static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){
int i,k1,l1,l2;
int na;
int nf,ip,iw,ix2,ix3,ido,idl1;
nf=ifac[1];
na=0;
l1=1;
iw=1;
for(k1=0;k1<nf;k1++){
ip=ifac[k1 + 2];
l2=ip*l1;
ido=n/l2;
idl1=ido*l1;
if(ip!=4)goto L103;
ix2=iw+ido;
ix3=ix2+ido;
if(na!=0)
dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1);
else
dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1);
na=1-na;
goto L115;
L103:
if(ip!=2)goto L106;
if(na!=0)
dradb2(ido,l1,ch,c,wa+iw-1);
else
dradb2(ido,l1,c,ch,wa+iw-1);
na=1-na;
goto L115;
L106:
if(ip!=3)goto L109;
ix2=iw+ido;
if(na!=0)
dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1);
else
dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1);
na=1-na;
goto L115;
L109:
/* The radix five case can be translated later..... */
/* if(ip!=5)goto L112;
ix2=iw+ido;
ix3=ix2+ido;
ix4=ix3+ido;
if(na!=0)
dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
else
dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1);
na=1-na;
goto L115;
L112:*/
if(na!=0)
dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1);
else
dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1);
if(ido==1)na=1-na;
L115:
l1=l2;
iw+=(ip-1)*ido;
}
if(na==0)return;
for(i=0;i<n;i++)c[i]=ch[i];
}
void drft_forward(drft_lookup *l,float *data){
if(l->n==1)return;
drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
}
void drft_backward(drft_lookup *l,float *data){
if (l->n==1)return;
drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache);
}
void drft_init(drft_lookup *l,int n){
l->n=n;
l->trigcache=_ogg_calloc(3*n,sizeof(*l->trigcache));
l->splitcache=_ogg_calloc(32,sizeof(*l->splitcache));
fdrffti(n, l->trigcache, l->splitcache);
}
void drft_clear(drft_lookup *l){
if(l){
if(l->trigcache)_ogg_free(l->trigcache);
if(l->splitcache)_ogg_free(l->splitcache);
memset(l,0,sizeof(*l));
}
}
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/shared/include/OgreMayaOptions.h
|
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_OPTIONS_H_
#define _OGREMAYA_OPTIONS_H_
#include "OgreMayaCommon.h"
#include <maya/MString.h>
#include <maya/MStringArray.h>
#include <map>
#include <string>
namespace OgreMaya {
// using namespace std;
using std::map;
using std::string;
class Options {
public:
static Options& Options::instance();
void reset();
void debugOutput();
public:
struct KeyframeRange {
KeyframeRange(int from=0, int to=0, int step=1): from(from), to(to), step(1) {}
bool isValid() {return from>0 && to>0;}
int from;
int to;
int step;
};
typedef map<string, KeyframeRange> KeyframeRangeMap;
string
inFile,
inAnimFile,
outMeshFile,
outSkelFile,
outAnimFile,
outMatFile,
matPrefix;
bool
verboseMode,
exportSelected,
exportMesh,
exportSkeleton,
exportVBA,
exportNormals,
exportColours,
exportUVs,
exportMaterial,
exportBounds;
KeyframeRangeMap
animations;
bool
valid;
int
precision;
float
scale;
private:
Options();
};
} // namespace OgreMaya
#define OPTIONS Options::instance()
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/MayaExport/shared/include/OgreMayaMesh.h
|
<reponame>AustralianDisabilityLimited/MultiversePlatform<gh_stars>10-100
/*
============================================================================
This source file is part of the Ogre-Maya Tools.
Distributed as part of Ogre (Object-oriented Graphics Rendering Engine).
Copyright (C) 2003 Fifty1 Software Inc., Bytelords
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
or go to http://www.gnu.org/licenses/gpl.txt
============================================================================
*/
#ifndef _OGREMAYA_MESH_H_
#define _OGREMAYA_MESH_H_
#include "OgreMayaCommon.h"
#include "OgreMayaSkeleton.h"
#include <maya/MGlobal.h>
#include <maya/MFloatArray.h>
#include <maya/MPointArray.h>
#include <maya/MFloatVectorArray.h>
#include <maya/MColorArray.h>
#include <maya/MObjectArray.h>
#include <maya/MFnMesh.h>
#include <maya/MStatus.h>
#include <maya/MItMeshPolygon.h>
#include <fstream>
#include <string>
#include <list>
#include <vector>
namespace OgreMaya {
using std::ofstream;
using std::list;
using std::string;
using std::vector;
// ===========================================================================
/** \struct MeshUV
Simple structure with single set of UV coordinates for a single vertex.
*/
// ===========================================================================
struct MeshVertexUV {
Real u;
Real v;
MeshVertexUV() {
u = (Real)0.0;
v = (Real)0.0;
}
bool operator ==(const MeshVertexUV& other) const {
return u==other.u && v==other.v;
}
};
typedef vector<MeshVertexUV> MeshVertexUVList;
// ===========================================================================
/** \struct MeshMayaUVSet
Structure that holds UVs for all vertex-faces for a single UV set.
*/
// ===========================================================================
struct MeshMayaUVSet {
MFloatArray uArray;
MFloatArray vArray;
MString sName;
};
typedef vector<MeshMayaUVSet> MeshMayaUVSetList;
// ===========================================================================
/** \struct VertexBoneAssignment
Structure that holds vertex bone assignments for a vertex.
*/
// ===========================================================================
struct VertexBoneAssignment {
int boneId;
float weight;
};
typedef vector<VertexBoneAssignment> VertexBoneAssignmentList;
struct WeightLess : std::binary_function<VertexBoneAssignment, VertexBoneAssignment, bool> {
bool operator()(const VertexBoneAssignment &vba1, const VertexBoneAssignment &vba2) const
{
return vba1.weight < vba2.weight;
}
};
// ===========================================================================
/** \struct MeshFaceVertex
Structure that defines a face-vertex.
*/
// ===========================================================================
struct MeshFaceVertex {
Vector3 vecPosition;
Vector3 vecNormal;
ColourValue colour;
MeshVertexUVList listUV;
VertexBoneAssignmentList boneAssignments;
bool operator==(const MeshFaceVertex& other) const {
if (this == &other)
return true;
// that's enough for equality (boneAssigment is not neccessery)
return
colour == other.colour
&& vecPosition == other.vecPosition
&& vecNormal == other.vecNormal
&& listEqual(
listUV.begin(), other.listUV.begin(),
listUV.end(), other.listUV.end()
);
}
void getBoneAssignmentMatrix(MMatrix *rMatrix) const;
#if 0
void getBoneAssignmentMatrix2(MMatrix *rMatrix) const;
#endif
};
typedef vector<MeshFaceVertex> MeshFaceVertexVector;
// ===========================================================================
/** \struct MeshTriFace
Structure that defines a triangular face as a set of 3 indices into an
arrray of MeshFaceVertex'es.
*/
// ===========================================================================
struct MeshTriFace {
unsigned long index0;
unsigned long index1;
unsigned long index2;
};
typedef vector<MeshTriFace> MeshTriFaceList;
// ===========================================================================
/** \struct MeshMayaGeometry
Structure that holds all data for a single Maya mesh.
*/
// ===========================================================================
struct MeshMayaGeometry {
string name;
// These are populated by the _queryMayaGeometry method
MPointArray Vertices;
MFloatVectorArray FaceVertexNormals; // face-vertex normals
MColorArray FaceVertexColours;
MIntArray TriangleVertexIds; // face-relative ids
MIntArray TrianglePolygonIds; // polygon number for each triangle
vector<MeshMayaUVSet> UVSets;
vector<string> shaderNames; // shaderNames[shaderId]
vector<string> materialNames; // materialNames[shaderId]
vector<int> materialIds; // materialIds[polygonId]
// Populated by _processPolyMesh
vector<VertexBoneAssignmentList> Weights;
// Populated in _parseMayaGeometry with _addFace
// Master set of vertex information
vector<MeshFaceVertex> faceVertices;
// maps from shader and relative vertex id to absolute vertex id entry in FaceVertices
vector<vector<int> > faceVertexIds; // faceVertexIds[shaderId][vertexId]
// maps from shader and relative triangle id to the indices of the vertices of the triangle
vector<vector<MeshTriFace> > triangleFaces; // triangleFaces[shaderId][triangleId]
// Default bone for vertices that lack bone weights
int parentBoneId;
// Bounds info
MVector AABBMin;
MVector AABBMax;
double radius;
};
// ===========================================================================
/** \class MeshGenerator
\author <NAME>, Fifty1 Software Inc.
\version 1.0
\date June 2003
Generates an Ogre mesh from a Maya scene. The complete Maya scene is
represented by a single Ogre Mesh, and Maya meshes are represented by
Ogre SubMeshes.
*/
// ===========================================================================
class MeshGenerator : SkeletonGenerator {
public:
/// Standard constructor.
MeshGenerator();
/// Destructor.
virtual ~MeshGenerator();
/// Export the complete Maya scene (called by OgreMaya.mll or OgreMaya.exe).
virtual bool exportAll();
/// Export selected parts of the Maya scene (called by OgreMaya.mll).
virtual bool exportSelection();
protected:
/// Required for OptionParser interface.
//bool _validateOptions();
/// Return the value for a boolean attribute of a dependency node.
static bool _getBooleanAttr(const MFnDependencyNode &fnDepNode,
const std::string &attrName,
MStatus &status);
/// Get the visibility information for the layer of an object.
static bool _getLayerVisibility(const MFnDependencyNode &fnDepNode,
MStatus &status);
/// Get the visibility information for a dag object. This checks the
/// object's visibilit, the object's ancestors, and the layer.
static bool _isVisible(MFnDagNode &fnDepNode, MStatus &status);
/// Process a Maya polyMesh - this corresponds to a submesh in ogre/axiom
MStatus _processPolyMesh(MeshMayaGeometry &rGeom, const MDagPath dagPath);
bool MeshGenerator::_exportMesh();
// bool _exportSubmesh(ofstream& out, const MeshMayaGeometry &mayaGeometry) const;
bool _exportSubmesh(ofstream& out, const MeshMayaGeometry &mayaGeometry, int shaderIndex) const;
MStatus _queryMayaGeometry(MFnMesh &fnMesh, MeshMayaGeometry &rGeom);
MStatus _parseMayaGeometry(MFnMesh &fnMesh, MeshMayaGeometry &rGeom);
static void _addFace(MeshMayaGeometry &rMayaGeometry,
MeshFaceVertex *faceVertices,
bool windForward, int shaderId);
MStatus _getJoint(const MObject &node, int &index) const;
void _populateFaceVertex(MeshFaceVertex &faceVertex,
const MeshMayaGeometry &rMayaGeometry,
const MIntArray &vertexIds, const MIntArray &normalIds,
int iPoly, int iPolyVertex, int iColour) const;
void _populateFaceVertexUVs(MeshFaceVertex &faceVertex,
const MeshMayaGeometry &rMayaGeometry, const MFnMesh &fnMesh,
int iPoly, int iPolyVertex) const;
bool _populateFaceVertexVBAs(MeshFaceVertex &faceVertex,
MeshMayaGeometry &rMayaGeometry,
const MIntArray &vertexIds, int iPolyVertex) const;
void _buildBoundsInfo(MeshMayaGeometry &rMayaGeometry) const;
void _getBoneAssignmentMatrix(MMatrix *rMatrix, const VertexBoneAssignmentList &vbaList) const;
void _getBoneAssignmentMatrix2(MMatrix *rMatrix, const VertexBoneAssignmentList &vbaList) const;
void _convertObjectToFace(MItMeshPolygon &iterPoly, MIntArray &objIndices, MIntArray &faceIndices);
string _getMaterialName(const MObject &shader, MStatus *pStatus = NULL);
};
} // namespace OgreMaya
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/mvVoiceCBL/mvVoiceCBL.h
|
<filename>lib/Vivox/mvVoice/mvVoiceCBL/mvVoiceCBL.h
// mvVoiceDLL.h
#include <string>
using namespace std;
namespace mvVoiceCBL
{
class VoiceCBL
{
public:
static __declspec(dllexport) std::string GetConnectorID();
static __declspec(dllexport) std::string GetAccountID();
static __declspec(dllexport) std::string GetSessionID();
static __declspec(dllexport) int Init(std::string ssServer);
static __declspec(dllexport) int Login(std::string ssConnectorID, std::string ssUsername, std::string ssPassword);
static __declspec(dllexport) int Call(std::string ssAccountID, std::string ssVoiceServer);
static __declspec(dllexport) int Hangup(std::string ssSessionID);
static __declspec(dllexport) int Logout(std::string ssAccountID);
static __declspec(dllexport) int Shutdown(std::string ssConnectorID);
static __declspec(dllexport) int MicMute(std::string ssConnectorID, bool mute);
};
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/vq/bookutil.c
|
<gh_stars>10-100
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: utility functions for loading .vqh and .vqd files
last mod: $Id: bookutil.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include "bookutil.h"
/* A few little utils for reading files */
/* read a line. Use global, persistent buffering */
static char *linebuffer=NULL;
static int lbufsize=0;
char *get_line(FILE *in){
long sofar=0;
if(feof(in))return NULL;
while(1){
int gotline=0;
while(!gotline){
if(sofar+1>=lbufsize){
if(!lbufsize){
lbufsize=1024;
linebuffer=_ogg_malloc(lbufsize);
}else{
lbufsize*=2;
linebuffer=_ogg_realloc(linebuffer,lbufsize);
}
}
{
long c=fgetc(in);
switch(c){
case EOF:
if(sofar==0)return(NULL);
/* fallthrough correct */
case '\n':
linebuffer[sofar]='\0';
gotline=1;
break;
default:
linebuffer[sofar++]=c;
linebuffer[sofar]='\0';
break;
}
}
}
if(linebuffer[0]=='#'){
sofar=0;
}else{
return(linebuffer);
}
}
}
/* read the next numerical value from the given file */
static char *value_line_buff=NULL;
int get_line_value(FILE *in,float *value){
char *next;
if(!value_line_buff)return(-1);
*value=strtod(value_line_buff, &next);
if(next==value_line_buff){
value_line_buff=NULL;
return(-1);
}else{
value_line_buff=next;
while(*value_line_buff>44)value_line_buff++;
if(*value_line_buff==44)value_line_buff++;
return(0);
}
}
int get_next_value(FILE *in,float *value){
while(1){
if(get_line_value(in,value)){
value_line_buff=get_line(in);
if(!value_line_buff)return(-1);
}else{
return(0);
}
}
}
int get_next_ivalue(FILE *in,long *ivalue){
float value;
int ret=get_next_value(in,&value);
*ivalue=value;
return(ret);
}
static float sequence_base=0.f;
static int v_sofar=0;
void reset_next_value(void){
value_line_buff=NULL;
sequence_base=0.f;
v_sofar=0;
}
char *setup_line(FILE *in){
reset_next_value();
value_line_buff=get_line(in);
return(value_line_buff);
}
int get_vector(codebook *b,FILE *in,int start, int n,float *a){
int i;
const static_codebook *c=b->c;
while(1){
if(v_sofar==n || get_line_value(in,a)){
reset_next_value();
if(get_next_value(in,a))
break;
for(i=0;i<start;i++){
sequence_base=*a;
get_line_value(in,a);
}
}
for(i=1;i<c->dim;i++)
if(get_line_value(in,a+i))
break;
if(i==c->dim){
float temp=a[c->dim-1];
for(i=0;i<c->dim;i++)a[i]-=sequence_base;
if(c->q_sequencep)sequence_base=temp;
v_sofar++;
return(0);
}
sequence_base=0.f;
}
return(-1);
}
/* read lines fromt he beginning until we find one containing the
specified string */
char *find_seek_to(FILE *in,char *s){
rewind(in);
while(1){
char *line=get_line(in);
if(line){
if(strstr(line,s))
return(line);
}else
return(NULL);
}
}
/* this reads the format as written by vqbuild/latticebuild; innocent
(legal) tweaking of the file that would not affect its valid
header-ness will break this routine */
codebook *codebook_load(char *filename){
codebook *b=_ogg_calloc(1,sizeof(codebook));
static_codebook *c=(static_codebook *)(b->c=_ogg_calloc(1,sizeof(static_codebook)));
encode_aux_nearestmatch *a=NULL;
encode_aux_threshmatch *t=NULL;
encode_aux_pigeonhole *p=NULL;
int quant_to_read=0;
FILE *in=fopen(filename,"r");
char *line;
long i;
if(in==NULL){
fprintf(stderr,"Couldn't open codebook %s\n",filename);
exit(1);
}
/* find the codebook struct */
find_seek_to(in,"static static_codebook ");
/* get the major important values */
line=get_line(in);
if(sscanf(line,"%ld, %ld,",
&(c->dim),&(c->entries))!=2){
fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
exit(1);
}
line=get_line(in);
line=get_line(in);
if(sscanf(line,"%d, %ld, %ld, %d, %d,",
&(c->maptype),&(c->q_min),&(c->q_delta),&(c->q_quant),
&(c->q_sequencep))!=5){
fprintf(stderr,"1: syntax in %s in line:\t %s",filename,line);
exit(1);
}
/* find the auxiliary encode struct[s] (if any) */
if(find_seek_to(in,"static encode_aux_nearestmatch _vq_aux")){
/* how big? */
c->nearest_tree=a=_ogg_calloc(1,sizeof(encode_aux_nearestmatch));
line=get_line(in);
line=get_line(in);
line=get_line(in);
line=get_line(in);
line=get_line(in);
if(sscanf(line,"%ld, %ld",&(a->aux),&(a->alloc))!=2){
fprintf(stderr,"2: syntax in %s in line:\t %s",filename,line);
exit(1);
}
/* load ptr0 */
find_seek_to(in,"static long _vq_ptr0");
reset_next_value();
a->ptr0=_ogg_malloc(sizeof(long)*a->aux);
for(i=0;i<a->aux;i++)
if(get_next_ivalue(in,a->ptr0+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
/* load ptr1 */
find_seek_to(in,"static long _vq_ptr1");
reset_next_value();
a->ptr1=_ogg_malloc(sizeof(long)*a->aux);
for(i=0;i<a->aux;i++)
if(get_next_ivalue(in,a->ptr1+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
/* load p */
find_seek_to(in,"static long _vq_p_");
reset_next_value();
a->p=_ogg_malloc(sizeof(long)*a->aux);
for(i=0;i<a->aux;i++)
if(get_next_ivalue(in,a->p+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
/* load q */
find_seek_to(in,"static long _vq_q_");
reset_next_value();
a->q=_ogg_malloc(sizeof(long)*a->aux);
for(i=0;i<a->aux;i++)
if(get_next_ivalue(in,a->q+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
}
if(find_seek_to(in,"static encode_aux_threshmatch _vq_aux")){
/* how big? */
c->thresh_tree=t=_ogg_calloc(1,sizeof(encode_aux_threshmatch));
line=get_line(in);
line=get_line(in);
line=get_line(in);
if(sscanf(line,"%d",&(t->quantvals))!=1){
fprintf(stderr,"3: syntax in %s in line:\t %s",filename,line);
exit(1);
}
line=get_line(in);
if(sscanf(line,"%d",&(t->threshvals))!=1){
fprintf(stderr,"4: syntax in %s in line:\t %s",filename,line);
exit(1);
}
/* load quantthresh */
find_seek_to(in,"static float _vq_quantthresh_");
reset_next_value();
t->quantthresh=_ogg_malloc(sizeof(float)*t->threshvals);
for(i=0;i<t->threshvals-1;i++)
if(get_next_value(in,t->quantthresh+i)){
fprintf(stderr,"out of data 1 while reading codebook %s\n",filename);
exit(1);
}
/* load quantmap */
find_seek_to(in,"static long _vq_quantmap_");
reset_next_value();
t->quantmap=_ogg_malloc(sizeof(long)*t->threshvals);
for(i=0;i<t->threshvals;i++)
if(get_next_ivalue(in,t->quantmap+i)){
fprintf(stderr,"out of data 2 while reading codebook %s\n",filename);
exit(1);
}
}
if(find_seek_to(in,"static encode_aux_pigeonhole _vq_aux")){
int pigeons=1,i;
/* how big? */
c->pigeon_tree=p=_ogg_calloc(1,sizeof(encode_aux_pigeonhole));
line=get_line(in);
if(sscanf(line,"%f, %f, %d, %d",&(p->min),&(p->del),
&(p->mapentries),&(p->quantvals))!=4){
fprintf(stderr,"5: syntax in %s in line:\t %s",filename,line);
exit(1);
}
line=get_line(in);
line=get_line(in);
if(sscanf(line,"%ld",&(p->fittotal))!=1){
fprintf(stderr,"6: syntax in %s in line:\t %s",filename,line);
exit(1);
}
/* load pigeonmap */
find_seek_to(in,"static long _vq_pigeonmap_");
reset_next_value();
p->pigeonmap=_ogg_malloc(sizeof(long)*p->mapentries);
for(i=0;i<p->mapentries;i++)
if(get_next_ivalue(in,p->pigeonmap+i)){
fprintf(stderr,"out of data (pigeonmap) while reading codebook %s\n",filename);
exit(1);
}
/* load fitlist */
find_seek_to(in,"static long _vq_fitlist_");
reset_next_value();
p->fitlist=_ogg_malloc(sizeof(long)*p->fittotal);
for(i=0;i<p->fittotal;i++)
if(get_next_ivalue(in,p->fitlist+i)){
fprintf(stderr,"out of data (fitlist) while reading codebook %s\n",filename);
exit(1);
}
/* load fitmap */
find_seek_to(in,"static long _vq_fitmap_");
reset_next_value();
for(i=0;i<c->dim;i++)pigeons*=p->quantvals;
p->fitmap=_ogg_malloc(sizeof(long)*pigeons);
for(i=0;i<pigeons;i++)
if(get_next_ivalue(in,p->fitmap+i)){
fprintf(stderr,"out of data (fitmap) while reading codebook %s\n",filename);
exit(1);
}
/* load fitlength */
find_seek_to(in,"static long _vq_fitlength_");
reset_next_value();
p->fitlength=_ogg_malloc(sizeof(long)*pigeons);
for(i=0;i<pigeons;i++)
if(get_next_ivalue(in,p->fitlength+i)){
fprintf(stderr,"out of data (fitlength) while reading codebook %s\n",filename);
exit(1);
}
}
switch(c->maptype){
case 0:
quant_to_read=0;
break;
case 1:
quant_to_read=_book_maptype1_quantvals(c);
break;
case 2:
quant_to_read=c->entries*c->dim;
break;
}
/* load the quantized entries */
find_seek_to(in,"static long _vq_quantlist_");
reset_next_value();
c->quantlist=_ogg_malloc(sizeof(long)*quant_to_read);
for(i=0;i<quant_to_read;i++)
if(get_next_ivalue(in,c->quantlist+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
/* load the lengthlist */
find_seek_to(in,"_lengthlist");
reset_next_value();
c->lengthlist=_ogg_malloc(sizeof(long)*c->entries);
for(i=0;i<c->entries;i++)
if(get_next_ivalue(in,c->lengthlist+i)){
fprintf(stderr,"out of data while reading codebook %s\n",filename);
exit(1);
}
/* got it all */
fclose(in);
vorbis_book_init_encode(b,c);
return(b);
}
void spinnit(char *s,int n){
static int p=0;
static long lasttime=0;
long test;
struct timeval thistime;
gettimeofday(&thistime,NULL);
test=thistime.tv_sec*10+thistime.tv_usec/100000;
if(lasttime!=test){
lasttime=test;
fprintf(stderr,"%s%d ",s,n);
p++;if(p>3)p=0;
switch(p){
case 0:
fprintf(stderr,"| \r");
break;
case 1:
fprintf(stderr,"/ \r");
break;
case 2:
fprintf(stderr,"- \r");
break;
case 3:
fprintf(stderr,"\\ \r");
break;
}
fflush(stderr);
}
}
void build_tree_from_lengths(int vals, long *hist, long *lengths){
int i,j;
long *membership=_ogg_malloc(vals*sizeof(long));
long *histsave=alloca(vals*sizeof(long));
memcpy(histsave,hist,vals*sizeof(long));
for(i=0;i<vals;i++)membership[i]=i;
/* find codeword lengths */
/* much more elegant means exist. Brute force n^2, minimum thought */
for(i=vals;i>1;i--){
int first=-1,second=-1;
long least=-1;
spinnit("building... ",i);
/* find the two nodes to join */
for(j=0;j<vals;j++)
if(least==-1 || hist[j]<=least){
least=hist[j];
first=membership[j];
}
least=-1;
for(j=0;j<vals;j++)
if((least==-1 || hist[j]<=least) && membership[j]!=first){
least=hist[j];
second=membership[j];
}
if(first==-1 || second==-1){
fprintf(stderr,"huffman fault; no free branch\n");
exit(1);
}
/* join them */
least=hist[first]+hist[second];
for(j=0;j<vals;j++)
if(membership[j]==first || membership[j]==second){
membership[j]=first;
hist[j]=least;
lengths[j]++;
}
}
for(i=0;i<vals-1;i++)
if(membership[i]!=membership[i+1]){
fprintf(stderr,"huffman fault; failed to build single tree\n");
exit(1);
}
/* for sanity check purposes: how many bits would it have taken to
encode the training set? */
{
long bitsum=0;
long samples=0;
for(i=0;i<vals;i++){
bitsum+=(histsave[i]-1)*lengths[i];
samples+=histsave[i]-1;
}
if(samples){
fprintf(stderr,"\rTotal samples in training set: %ld \n",samples);
fprintf(stderr,"\rTotal bits used to represent training set: %ld\n",
bitsum);
}
}
free(membership);
}
/* wrap build_tree_from_lengths to allow zero entries in the histogram */
void build_tree_from_lengths0(int vals, long *hist, long *lengths){
/* pack the 'sparse' hit list into a dense list, then unpack
the lengths after the build */
int upper=0,i;
long *lengthlist=_ogg_calloc(vals,sizeof(long));
long *newhist=alloca(vals*sizeof(long));
for(i=0;i<vals;i++)
if(hist[i]>0)
newhist[upper++]=hist[i];
if(upper != vals){
fprintf(stderr,"\rEliminating %d unused entries; %d entries remain\n",
vals-upper,upper);
}
build_tree_from_lengths(upper,newhist,lengthlist);
upper=0;
for(i=0;i<vals;i++)
if(hist[i]>0)
lengths[i]=lengthlist[upper++];
else
lengths[i]=0;
free(lengthlist);
}
void write_codebook(FILE *out,char *name,const static_codebook *c){
encode_aux_pigeonhole *p=c->pigeon_tree;
encode_aux_threshmatch *t=c->thresh_tree;
encode_aux_nearestmatch *n=c->nearest_tree;
int i,j,k;
/* save the book in C header form */
/* first, the static vectors, then the book structure to tie it together. */
/* quantlist */
if(c->quantlist){
long vals=(c->maptype==1?_book_maptype1_quantvals(c):c->entries*c->dim);
fprintf(out,"static long _vq_quantlist_%s[] = {\n",name);
for(j=0;j<vals;j++){
fprintf(out,"\t%ld,\n",c->quantlist[j]);
}
fprintf(out,"};\n\n");
}
/* lengthlist */
fprintf(out,"static long _vq_lengthlist_%s[] = {\n",name);
for(j=0;j<c->entries;){
fprintf(out,"\t");
for(k=0;k<16 && j<c->entries;k++,j++)
fprintf(out,"%2ld,",c->lengthlist[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
if(t){
/* quantthresh */
fprintf(out,"static float _vq_quantthresh_%s[] = {\n",name);
for(j=0;j<t->threshvals-1;){
fprintf(out,"\t");
for(k=0;k<8 && j<t->threshvals-1;k++,j++)
fprintf(out,"%.5g, ",t->quantthresh[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* quantmap */
fprintf(out,"static long _vq_quantmap_%s[] = {\n",name);
for(j=0;j<t->threshvals;){
fprintf(out,"\t");
for(k=0;k<8 && j<t->threshvals;k++,j++)
fprintf(out,"%5ld,",t->quantmap[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
fprintf(out,"static encode_aux_threshmatch _vq_auxt_%s = {\n",name);
fprintf(out,"\t_vq_quantthresh_%s,\n",name);
fprintf(out,"\t_vq_quantmap_%s,\n",name);
fprintf(out,"\t%d,\n",t->quantvals);
fprintf(out,"\t%d\n};\n\n",t->threshvals);
}
if(p){
int pigeons=1;
for(i=0;i<c->dim;i++)pigeons*=p->quantvals;
/* pigeonmap */
fprintf(out,"static long _vq_pigeonmap_%s[] = {\n",name);
for(j=0;j<p->mapentries;){
fprintf(out,"\t");
for(k=0;k<8 && j<p->mapentries;k++,j++)
fprintf(out,"%5ld, ",p->pigeonmap[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* fitlist */
fprintf(out,"static long _vq_fitlist_%s[] = {\n",name);
for(j=0;j<p->fittotal;){
fprintf(out,"\t");
for(k=0;k<8 && j<p->fittotal;k++,j++)
fprintf(out,"%5ld, ",p->fitlist[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* fitmap */
fprintf(out,"static long _vq_fitmap_%s[] = {\n",name);
for(j=0;j<pigeons;){
fprintf(out,"\t");
for(k=0;k<8 && j<pigeons;k++,j++)
fprintf(out,"%5ld, ",p->fitmap[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* fitlength */
fprintf(out,"static long _vq_fitlength_%s[] = {\n",name);
for(j=0;j<pigeons;){
fprintf(out,"\t");
for(k=0;k<8 && j<pigeons;k++,j++)
fprintf(out,"%5ld, ",p->fitlength[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
fprintf(out,"static encode_aux_pigeonhole _vq_auxp_%s = {\n",name);
fprintf(out,"\t%g, %g, %d, %d,\n",
p->min,p->del,p->mapentries,p->quantvals);
fprintf(out,"\t_vq_pigeonmap_%s,\n",name);
fprintf(out,"\t%ld,\n",p->fittotal);
fprintf(out,"\t_vq_fitlist_%s,\n",name);
fprintf(out,"\t_vq_fitmap_%s,\n",name);
fprintf(out,"\t_vq_fitlength_%s\n};\n\n",name);
}
if(n){
/* ptr0 */
fprintf(out,"static long _vq_ptr0_%s[] = {\n",name);
for(j=0;j<n->aux;){
fprintf(out,"\t");
for(k=0;k<8 && j<n->aux;k++,j++)
fprintf(out,"%6ld,",n->ptr0[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* ptr1 */
fprintf(out,"static long _vq_ptr1_%s[] = {\n",name);
for(j=0;j<n->aux;){
fprintf(out,"\t");
for(k=0;k<8 && j<n->aux;k++,j++)
fprintf(out,"%6ld,",n->ptr1[j]);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* p */
fprintf(out,"static long _vq_p_%s[] = {\n",name);
for(j=0;j<n->aux;){
fprintf(out,"\t");
for(k=0;k<8 && j<n->aux;k++,j++)
fprintf(out,"%6ld,",n->p[j]*c->dim);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
/* q */
fprintf(out,"static long _vq_q_%s[] = {\n",name);
for(j=0;j<n->aux;){
fprintf(out,"\t");
for(k=0;k<8 && j<n->aux;k++,j++)
fprintf(out,"%6ld,",n->q[j]*c->dim);
fprintf(out,"\n");
}
fprintf(out,"};\n\n");
fprintf(out,"static encode_aux_nearestmatch _vq_auxn_%s = {\n",name);
fprintf(out,"\t_vq_ptr0_%s,\n",name);
fprintf(out,"\t_vq_ptr1_%s,\n",name);
fprintf(out,"\t_vq_p_%s,\n",name);
fprintf(out,"\t_vq_q_%s,\n",name);
fprintf(out,"\t%ld, %ld\n};\n\n",n->aux,n->aux);
}
/* tie it all together */
fprintf(out,"static static_codebook %s = {\n",name);
fprintf(out,"\t%ld, %ld,\n",c->dim,c->entries);
fprintf(out,"\t_vq_lengthlist_%s,\n",name);
fprintf(out,"\t%d, %ld, %ld, %d, %d,\n",
c->maptype,c->q_min,c->q_delta,c->q_quant,c->q_sequencep);
if(c->quantlist)
fprintf(out,"\t_vq_quantlist_%s,\n",name);
else
fprintf(out,"\tNULL,\n");
if(n)
fprintf(out,"\t&_vq_auxn_%s,\n",name);
else
fprintf(out,"\tNULL,\n");
if(t)
fprintf(out,"\t&_vq_auxt_%s,\n",name);
else
fprintf(out,"\tNULL,\n");
if(p)
fprintf(out,"\t&_vq_auxp_%s,\n",name);
else
fprintf(out,"\tNULL,\n");
fprintf(out,"\t0\n};\n\n");
}
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/SpeedWind/SpeedWindParser.h
|
<filename>lib/SpeedWind/SpeedWindParser.h
///////////////////////////////////////////////////////////////////////
// SpeedWindParser.h
//
// (c) 2004 IDV, Inc.
//
//
// *** INTERACTIVE DATA VISUALIZATION (IDV) PROPRIETARY INFORMATION ***
//
// This software is supplied under the terms of a license agreement or
// nondisclosure agreement with Interactive Data Visualization and may
// not be copied or disclosed except in accordance with the terms of
// that agreement.
//
// Copyright (c) 2001-2004 IDV, Inc.
// All Rights Reserved.
//
// IDV, Inc.
// 1233 Washington St. Suite 610
// Columbia, SC 29201
// Voice: (803) 799-1699
// Fax: (803) 931-0320
// Web: http://www.idvinc.com
/////////////////////////////////////////////////////////////////////////////
// Preprocessor
#pragma once
#include "SpeedWind.h"
#include <map>
/////////////////////////////////////////////////////////////////////////////
// Forward references
/////////////////////////////////////////////////////////////////////////////
// CSpeedWindParser
class CSpeedWindParser
{
public:
// constructor
CSpeedWindParser(void);
// parsing
bool Parse(std::istream& isData);
// data retrieval
CSpeedWind::SWindAttributes GetWindAttributes(void) const { return m_sAttributes; }
// errors/warnings
std::string GetWarnings(void) const { return m_strWarnings; }
std::string GetError(void) const { return m_strError; }
private:
CSpeedWind::SWindAttributes m_sAttributes;
std::string m_strWarnings;
std::string m_strError;
unsigned int m_uiLineNumber;
std::map<std::string, int> m_mTokenMap;
bool ParseToken(std::string strToken, std::string strValue);
void AddWarning(std::string strWarning, std::string strLine);
};
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/Vivox/mvVoice/include/vxplatform/VxcPlatform.h
|
<gh_stars>10-100
#ifndef __VXCPLATFORM_H
#define __VXCPLATFORM_H
#ifdef _MSC_VER
#ifdef BUILDING_VIVOX_PLATFORM
#define VXPLATFORM_DLLEXPORT __declspec(dllexport)
#else
#define VXPLATFORM_DLLEXPORT __declspec(dllimport)
#endif
#else
#define VXPLATFORM_DLLEXPORT __attribute__ ((visibility("default")))
#endif
namespace vxplatform {
typedef unsigned long os_error_t;
typedef void * os_thread_handle;
typedef void * os_event_handle;
typedef os_error_t (*thread_start_function_t)(void *);
VXPLATFORM_DLLEXPORT os_error_t create_thread(thread_start_function_t pf, void * pArg, os_thread_handle *pHandle);
VXPLATFORM_DLLEXPORT os_error_t delete_thread(os_thread_handle handle);
VXPLATFORM_DLLEXPORT os_error_t close_thread_handle(os_thread_handle handle);
VXPLATFORM_DLLEXPORT os_error_t create_event(os_event_handle *pHandle);
VXPLATFORM_DLLEXPORT os_error_t set_event(os_event_handle handle);
VXPLATFORM_DLLEXPORT os_error_t wait_event(os_event_handle handle, int timeout=-1);
VXPLATFORM_DLLEXPORT os_error_t delete_event(os_event_handle handle);
class VXPLATFORM_DLLEXPORT Lock
{
void *m_pImpl;
public:
Lock(void);
~Lock(void);
void Take();
void Release();
private:
Lock(const Lock &);
};
}
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
tools/ethereal/packet-rudp.c
|
/* Packet-rudp.c
* Routines for Reliable UDP Protocol.
* Copyright 2004, <NAME> <<EMAIL>>
*
* $Id: packet-rudp.c 792 2005-02-17 20:05:09Z mccollum $
*
* Ethereal - Network traffic analyzer
* By <NAME> <<EMAIL>>
* Copyright 1998 <NAME>
*
* Modified to use the Multiverse modified version of RDP over UDP
* <NAME> <<EMAIL>>
* Copied from packet-data.c, README.developer, and various other files.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
* Reliable UDP is a lightweight protocol for providing TCP-like flow
* control over UDP. Cisco published an PFC a long time ago, and
* their actual implementation is slightly different, having no
* checksum field.
*
* I've cheated here - RUDP could be used for anything, but I've only
* seen it used to switched telephony calls, so we just call the Cisco SM
* dissector from here.
*
* Here are some links:
*
* http://www.watersprings.org/pub/id/draft-ietf-sigtran-reliable-udp-00.txt
* http://www.javvin.com/protocolRUDP.html
* http://www.cisco.com/univercd/cc/td/doc/product/access/sc/rel7/omts/omts_apb.htm#30052
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <gmodule.h>
#include <epan/packet.h>
#include "plugins/plugin_api.h"
#include "plugins/plugin_api_defs.h"
/* Define version if we are not building ethereal statically */
/*
#include "moduleinfo.h"
*/
#ifndef ENABLE_STATIC
G_MODULE_EXPORT const gchar version[] = VERSION;
#endif
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <string.h>
#include <glib.h>
#include <epan/packet.h>
#define RUDP_PORT_1 5005
#define RUDP_PORT_2 5010
#define RUDP_PORT_3 5050
#define RUDP_PORT_4 6001
#define RUDP_PORT_5 6010
#define RUDP_PORT_6 9010
static int proto_rudp = -1;
static int hf_rudp_flags = -1;
static int hf_rudp_flags_syn = -1;
static int hf_rudp_flags_ack = -1;
static int hf_rudp_flags_eak = -1;
static int hf_rudp_flags_rst = -1;
static int hf_rudp_flags_nul = -1;
static int hf_rudp_flags_ver = -1;
/*
static int hf_rudp_flags_chk = -1;
static int hf_rudp_flags_tcs = -1;
static int hf_rudp_flags_0 = -1;
*/
static int hf_rudp_hlen = -1;
static int hf_rudp_dlen = -1;
static int hf_rudp_seq = -1;
static int hf_rudp_ack = -1;
static int hf_rudp_options = -1;
static int hf_rudp_max_segs = -1;
static int hf_rudp_max_seg_size = -1;
static int hf_rudp_sequenced = -1;
static int hf_rudp_eak_list = -1;
static int hf_rudp_data = -1;
/* static int hf_rudp_cksum = -1; */
static gint ett_rudp = -1;
static gint ett_rudp_flags = -1;
static gint ett_rudp_options = -1;
static dissector_table_t subdissector_table;
static void
dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree)
{
tvbuff_t * next_tvb = NULL;
proto_tree *rudp_tree = NULL, *flags_tree, *options_tree;
proto_item *ti_root = NULL, *ti_flags = NULL, *ti_options = NULL;
int flags[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
/* int i; */
guint8 flag_data;
guint8 hlen;
guint16 dlen;
/* guint8 *data; */
flags[0] = hf_rudp_flags_syn;
flags[1] = hf_rudp_flags_ack;
flags[2] = hf_rudp_flags_eak;
flags[3] = hf_rudp_flags_rst;
flags[4] = hf_rudp_flags_nul;
/*
flags[5] = hf_rudp_flags_chk;
flags[6] = hf_rudp_flags_tcs;
flags[7] = hf_rudp_flags_0;
*/
flag_data = tvb_get_guint8(tvb, 0);
hlen = tvb_get_guint8(tvb, 1) * 2;
if (check_col(pinfo->cinfo, COL_PROTOCOL))
col_set_str(pinfo->cinfo, COL_PROTOCOL, "RUDP");
/*
if (check_col(pinfo->cinfo, COL_INFO))
col_clear(pinfo->cinfo, COL_INFO);
*/
if (tree) {
ti_root = proto_tree_add_item(tree, proto_rudp, tvb, 0, hlen, FALSE);
rudp_tree = proto_item_add_subtree(ti_root, ett_rudp);
ti_flags = proto_tree_add_item(rudp_tree, hf_rudp_flags, tvb, 0, 1, FALSE);
flags_tree = proto_item_add_subtree(ti_flags, ett_rudp_flags);
proto_tree_add_item(flags_tree, hf_rudp_flags_syn, tvb, 0, 1, FALSE);
proto_tree_add_item(flags_tree, hf_rudp_flags_ack, tvb, 0, 1, FALSE);
proto_tree_add_item(flags_tree, hf_rudp_flags_eak, tvb, 0, 1, FALSE);
proto_tree_add_item(flags_tree, hf_rudp_flags_rst, tvb, 0, 1, FALSE);
proto_tree_add_item(flags_tree, hf_rudp_flags_nul, tvb, 0, 1, FALSE);
proto_tree_add_item(flags_tree, hf_rudp_flags_ver, tvb, 0, 1, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_hlen, tvb, 1, 1, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_dlen, tvb, 2, 2, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_seq, tvb, 4, 4, FALSE);
proto_tree_add_item(rudp_tree, hf_rudp_ack, tvb, 8, 4, FALSE);
if (hlen > 12) {
ti_options = proto_tree_add_item(rudp_tree, hf_rudp_options, tvb, 12, hlen - 12, FALSE);
options_tree = proto_item_add_subtree(ti_options, ett_rudp_options);
if ((flag_data & 0x80) && hlen >= 18) {
/* syn is set - should be an open */
proto_tree_add_item(options_tree, hf_rudp_max_segs, tvb, 12, 2, FALSE);
proto_tree_add_item(options_tree, hf_rudp_max_seg_size, tvb, 14, 2, FALSE);
proto_tree_add_item(options_tree, hf_rudp_sequenced, tvb, 16, 1, FALSE);
}
if ((flag_data & 0x20)) {
/* eak is set */
/* int entries = (hlen - 12) / 4; */
proto_tree_add_item(options_tree, hf_rudp_eak_list, tvb, 12, hlen - 12, FALSE);
}
}
dlen = tvb_get_ntohs(tvb, 2);
if (dlen > 0)
proto_tree_add_item(rudp_tree, hf_rudp_data, tvb, hlen, dlen, FALSE);
}
next_tvb = tvb_new_subset(tvb, hlen, -1, -1);
if (tvb_length(next_tvb) && find_dissector("rudp.mvwp"))
call_dissector(find_dissector("rudp.mvwp"), next_tvb, pinfo, tree);
}
void proto_register_rudp(void)
{
static hf_register_info hf[] = {
{ &hf_rudp_flags,
{ "RUDP Header flags", "rudp.flags",
FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }
},
{ &hf_rudp_flags_syn,
{ "Syn", "rudp.flags.syn",
FT_BOOLEAN, 8, NULL, 0x80,
"", HFILL }
},
{ &hf_rudp_flags_ack,
{ "Ack", "rudp.flags.ack",
FT_BOOLEAN, 8, NULL, 0x40,
"", HFILL }
},
{ &hf_rudp_flags_eak,
{ "Eak", "rudp.flags.eak",
FT_BOOLEAN, 8, NULL, 0x20,
"Extended Ack", HFILL }
},
{ &hf_rudp_flags_rst,
{ "Rst", "rudp.flags.rst",
FT_BOOLEAN, 8, NULL, 0x10,
"Reset flag", HFILL }
},
{ &hf_rudp_flags_nul,
{ "Nul", "rudp.flags.nul",
FT_BOOLEAN, 8, NULL, 0x08,
"Null flag", HFILL }
},
{ &hf_rudp_flags_ver,
{ "Version", "rudp.flags.version",
FT_UINT8, BASE_DEC, NULL, 0x03,
"", HFILL }
},
{ &hf_rudp_hlen,
{ "Header Length", "rudp.hlen",
FT_UINT8, BASE_DEC, NULL, 0x0,
"", HFILL }
},
{ &hf_rudp_dlen,
{ "Data Length", "rudp.dlen",
FT_UINT16, BASE_DEC, NULL, 0x0,
"", HFILL }
},
{ &hf_rudp_seq,
{ "Seq", "rudp.seq",
FT_UINT32, BASE_DEC, NULL, 0x0,
"Sequence Number", HFILL }
},
{ &hf_rudp_ack,
{ "Ack", "rudp.ack",
FT_UINT32, BASE_DEC, NULL, 0x0,
"Acknowledgement Number", HFILL }
},
{ &hf_rudp_max_segs,
{ "MaxSegs", "rudp.opts.maxsegs",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Maximum Segments", HFILL }
},
{ &hf_rudp_max_seg_size,
{ "MaxSegSize", "rudp.opts.maxsegsize",
FT_UINT16, BASE_DEC, NULL, 0x0,
"Maximum Segment Size", HFILL }
},
{ &hf_rudp_sequenced,
{ "Sequenced", "rudp.opts.sequenced",
FT_BOOLEAN, 8, NULL, 0x80,
"", HFILL }
},
{ &hf_rudp_eak_list,
{ "EakList", "rudp.opts.eaklist",
FT_BYTES, BASE_HEX, NULL, 0x0,
"Extended Ack List", HFILL }
},
{ &hf_rudp_options,
{ "RUDP Header options", "rudp.opts",
FT_BYTES, BASE_HEX, NULL, 0x0,
"", HFILL }
},
{ &hf_rudp_data,
{ "Data", "rudp.data",
FT_BYTES, BASE_HEX, NULL, 0x0,
"RUDP Data", HFILL }
},
/*
{ &hf_rudp_eack,
{ "Extended acknowledgement numbers", "rudp.eack",
FT_UINT32, BASE_DEC, NULL, 0x0,
"", HFILL }},
{ &hf_rudp_sequenced,
{ "Sequenced", "rudp.sequenced",
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
"", HFILL }},
{ &hf_rudp_data,
{ "RUDP Data", "rudp.data",
FT_BYTES, BASE_HEX, NULL, 0x0,
"RUDP data", HFILL }},
*/
};
/* Setup protocol subtree array */
static gint *ett[] = {
&ett_rudp,
&ett_rudp_flags,
&ett_rudp_options,
};
if (proto_rudp == -1) {
proto_rudp = proto_register_protocol (
"Reliable UDP", /* name */
"RUDP", /* short name */
"rudp" /* abbrev */
);
}
proto_register_field_array(proto_rudp, hf, array_length(hf));
proto_register_subtree_array(ett, array_length(ett));
}
void proto_reg_handoff_rudp(void)
{
dissector_handle_t rudp_handle = NULL;
rudp_handle = create_dissector_handle(dissect_rudp, proto_rudp);
dissector_add("udp.port", RUDP_PORT_1, rudp_handle);
dissector_add("udp.port", RUDP_PORT_2, rudp_handle);
dissector_add("udp.port", RUDP_PORT_3, rudp_handle);
dissector_add("udp.port", RUDP_PORT_4, rudp_handle);
dissector_add("udp.port", RUDP_PORT_5, rudp_handle);
dissector_add("udp.port", RUDP_PORT_6, rudp_handle);
subdissector_table = register_dissector_table("rudp.mvwp", "Multiverse World Protocol", FT_UINT8, 0);
}
#ifndef ENABLE_STATIC
G_MODULE_EXPORT void
plugin_reg_handoff(void){
proto_reg_handoff_rudp();
}
G_MODULE_EXPORT void
plugin_init(plugin_address_table_t *pat
#ifndef PLUGINS_NEED_ADDRESS_TABLE
_U_
#endif
){
/* initialise the table of pointers needed in Win32 DLLs */
plugin_address_table_init(pat);
/* register the new protocol, protocol fields, and subtrees */
if (proto_rudp == -1) { /* execute protocol initialization only once */
proto_register_rudp();
}
}
#endif
|
AustralianDisabilityLimited/MultiversePlatform
|
lib/vorbis/examples/seeking_example.c
|
/********************************************************************
* *
* THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. *
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
* *
* THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
* by the XIPHOPHORUS Company http://www.xiph.org/ *
* *
********************************************************************
function: illustrate seeking, and test it too
last mod: $Id: seeking_example.c 2892 2005-12-02 20:42:19Z mccollum $
********************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include "vorbis/codec.h"
#include "vorbis/vorbisfile.h"
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
# include <io.h>
# include <fcntl.h>
#endif
void _verify(OggVorbis_File *ov,ogg_int64_t pos,
ogg_int64_t val,ogg_int64_t pcmval,
ogg_int64_t pcmlength,
char *bigassbuffer){
int j;
long bread;
char buffer[4096];
int dummy;
/* verify the raw position, the pcm position and position decode */
if(val!=-1 && ov_raw_tell(ov)<val){
printf("raw position out of tolerance: requested %ld, got %ld\n",
(long)val,(long)ov_raw_tell(ov));
exit(1);
}
if(pcmval!=-1 && ov_pcm_tell(ov)>pcmval){
printf("pcm position out of tolerance: requested %ld, got %ld\n",
(long)pcmval,(long)ov_pcm_tell(ov));
exit(1);
}
pos=ov_pcm_tell(ov);
if(pos<0 || pos>pcmlength){
printf("pcm position out of bounds: got %ld\n",(long)pos);
exit(1);
}
bread=ov_read(ov,buffer,4096,1,1,1,&dummy);
for(j=0;j<bread;j++){
if(buffer[j]!=bigassbuffer[j+pos*2]){
printf("data position after seek doesn't match pcm position\n");
{
FILE *f=fopen("a.m","w");
for(j=0;j<bread;j++)fprintf(f,"%d\n",(int)buffer[j]);
fclose(f);
f=fopen("b.m","w");
for(j=0;j<bread;j++)fprintf(f,"%d\n",(int)bigassbuffer[j+pos*2]);
fclose(f);
}
exit(1);
}
}
}
int main(){
OggVorbis_File ov;
int i,ret;
ogg_int64_t pcmlength;
char *bigassbuffer;
int dummy;
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
_setmode( _fileno( stdin ), _O_BINARY );
_setmode( _fileno( stdout ), _O_BINARY );
#endif
/* open the file/pipe on stdin */
if(ov_open(stdin,&ov,NULL,-1)<0){
printf("Could not open input as an OggVorbis file.\n\n");
exit(1);
}
if(ov_seekable(&ov)){
/* to simplify our own lives, we want to assume the whole file is
stereo. Verify this to avoid potentially mystifying users
(pissing them off is OK, just don't confuse them) */
for(i=0;i<ov.links;i++){
vorbis_info *vi=ov_info(&ov,i);
if(vi->channels!=2){
printf("Sorry; right now seeking_test can only use Vorbis files\n"
"that are entirely stereo.\n\n");
exit(1);
}
}
/* because we want to do sample-level verification that the seek
does what it claimed, decode the entire file into memory */
fflush(stdout);
pcmlength=ov_pcm_total(&ov,-1);
bigassbuffer=malloc(pcmlength*2); /* w00t */
i=0;
while(i<pcmlength*2){
int ret=ov_read(&ov,bigassbuffer+i,pcmlength*2-i,1,1,1,&dummy);
if(ret<0)continue;
if(ret){
i+=ret;
}else{
pcmlength=i/2;
}
fprintf(stderr,"\rloading.... [%ld left] ",
(long)(pcmlength*2-i));
}
/* Exercise all the real seeking cases; ov_raw_seek,
ov_pcm_seek_page and ov_pcm_seek. time seek is just a wrapper
on pcm_seek */
{
ogg_int64_t length=ov.end;
printf("\rtesting raw seeking to random places in %ld bytes....\n",
(long)length);
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()/RAND_MAX*length;
ogg_int64_t pos;
printf("\r\t%d [raw position %ld]... ",i,(long)val);
fflush(stdout);
ret=ov_raw_seek(&ov,val);
if(ret<0){
printf("seek failed: %d\n",ret);
exit(1);
}
_verify(&ov,pos,val,-1,pcmlength,bigassbuffer);
}
}
printf("\r");
{
printf("testing pcm page seeking to random places in %ld samples....\n",
(long)pcmlength);
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
ogg_int64_t pos;
printf("\r\t%d [pcm position %ld]... ",i,(long)val);
fflush(stdout);
ret=ov_pcm_seek_page(&ov,val);
if(ret<0){
printf("seek failed: %d\n",ret);
exit(1);
}
_verify(&ov,pos,-1,val,pcmlength,bigassbuffer);
}
}
printf("\r");
{
ogg_int64_t length=ov.end;
printf("testing pcm exact seeking to random places in %ld samples....\n",
(long)pcmlength);
for(i=0;i<1000;i++){
ogg_int64_t val=(double)rand()/RAND_MAX*pcmlength;
ogg_int64_t pos;
printf("\r\t%d [pcm position %ld]... ",i,(long)val);
fflush(stdout);
ret=ov_pcm_seek(&ov,val);
if(ret<0){
printf("seek failed: %d\n",ret);
exit(1);
}
if(ov_pcm_tell(&ov)!=val){
printf("Declared position didn't perfectly match request: %ld != %ld\n",
(long)val,(long)ov_pcm_tell(&ov));
exit(1);
}
_verify(&ov,pos,-1,val,pcmlength,bigassbuffer);
}
}
printf("\r \nOK.\n\n");
}else{
printf("Standard input was not seekable.\n");
}
ov_clear(&ov);
return 0;
}
|
YTJVDCM/PracticeRepository
|
main.c
|
<gh_stars>0
/* main.c
* Git practice (RPG battle)
*
* How to compile
* gcc -Wall -o main main.c
*
* Code written by YTJVDCM
*
*
* This code licensed by MIT License
* https://opensource.org/licenses/MIT
* Japanese
* https://licenses.opensource.jp/MIT/MIT.html
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <time.h>
#include <stdbool.h>
#define MONSTER_COUNT 5
#define DEFAULT_HP 1000
#define DEFAULT_ATK 10
void input(char *in); //INT_MAX文字までの文字を入力できる関数
int input_i(); //数字を入力する関数(安全策)
struct _MONSTER {
char *name; //名前
int hp; //HP
int atk; //攻撃力
int canescape; //逃げやすさ(0-100,0で逃げれない)
}typedef monster;
void attack(char *name,int atk,monster *monster_data);//攻撃する
void damage(char *name,int *hp,monster *monster_data);//攻撃される
bool escape(monster monster_data);//逃げられるかの判定
int main(){
srand(time(NULL));
bool turnflag = false;
bool escapeflag = false;
int choosed_id;
int choose;
char *name;
int hp=DEFAULT_HP;//プレイヤーのHP(defineで定義)
int atk=DEFAULT_ATK;//プレイヤーの攻撃力(defineで定義)
//モンスターの各種パラメーター
char *monsters_name[]={"スライム","ゾンビ","ドラゴン","老害","魔王"};
int monsters_hp[]={20,50,100,1000,1000};
int monsters_atk[]={10,20,100,1000,1000};
int monsters_canescape[]={100,90,0,0,0};
//メモリ取得
name = (char *)malloc(sizeof(char));
printf("名前を入力 > ");
input(name);
choosed_id = rand() % MONSTER_COUNT;
monster choosed_monster={monsters_name[choosed_id],monsters_hp[choosed_id],monsters_atk[choosed_id],monsters_canescape[choosed_id]};
printf("%s があらわれた!\n",choosed_monster.name);
while(1){
while(1){
fflush(stdin); //入力バッファ削除(安全策)
turnflag = false;
printf("%s の残りHP : %d\n",name,hp);
printf("%s はどうする\n",name);
printf("0.たたかう\t1.まほう\t2.どうぐ\t3.にげる\n");
choose = input_i();
switch(choose){
case 0:
attack(name,atk,&choosed_monster);
turnflag = true;
break;
case 1:
printf("この機能は、まだ実装されていない!!\n");
usleep(700000);
break;
case 2:
printf("この機能は、まだ実装されていない!!\n");
usleep(700000);
break;
case 3:
printf("%s は逃げようとした!\n",name);
usleep(700000);
if(escape(choosed_monster) == true){
printf("逃げるのに成功した!\n");
escapeflag = true;
}else{
printf("しかし、逃げられなかった!\n");
}
turnflag = true;
usleep(700000);
break;
default:
printf("不正な値です。\n");
}
if(turnflag == true)break;
}
if(escapeflag == true)break;
if(choosed_monster.hp<=0){
printf("%s に勝利した!\n",choosed_monster.name);
break;
}
damage(name,&hp,&choosed_monster);
if(hp<=0){
printf("%s に敗北してしまった...\n",choosed_monster.name);
break;
}
}
usleep(700000);
printf("GAME OVER\n");
free(name);
return 0;
}
void input(char *in){
char *tmp,ic;
//ここ環境によっては動かないかもしれない
for(int i=1;;i++){
scanf("%c",&ic);
if(ic == '\n')break;
tmp = (char*)realloc(in,(sizeof(char)*i)+1);
if(tmp == NULL){
printf("An error occurred\n");
exit(1);
}
in = tmp;
in[i]=0;
in[i-1]=ic;
}
}
int input_i(){
int ret;
char *tmp;
tmp = (char*)malloc(sizeof(char));
input(tmp);
ret = (tmp[0]-'0');
free(tmp);
return ret;
}
void attack(char *name,int atk,monster *monster_data){
srand(time(NULL));
int damage;
printf("%s の攻撃\n",name);
damage = atk + (rand() % ((atk/10)+1));
monster_data->hp -= damage;
usleep(700000);
printf("%sに%dのダメージ!\n",monster_data->name,damage);
usleep(700000);
}
void damage(char *name,int *hp,monster *monster_data){
srand(time(NULL));
int damage;
printf("%s の攻撃\n",monster_data->name);
damage = monster_data->atk + (rand() % ((monster_data->atk/10)+1));
*hp-=damage;
usleep(700000);
printf("%sに%dのダメージ!\n",name,damage);
usleep(700000);
}
bool escape(monster monster_data){
srand(time(NULL));
int success;
success = rand()%(100+1);
if(success < monster_data.canescape)return true;
return false;
}
|
Deadpikle/TDDbyE-Objective-C
|
TDDByExample/TDDByExample/Expression.h
|
//
// Expression.h
// TDDByExample
//
// Created by School of Computing Macbook on 1/1/17.
// Copyright © 2017 CIRC. All rights reserved.
//
#ifndef Expression_h
#define Expression_h
@class Money;
@class Bank;
@protocol Expression <NSObject>
@required
-(Money*)reduceWithBank:(Bank*)bank toCurrency:(NSString*)currency;
-(id<Expression>)plus:(id<Expression>)addend;
-(id<Expression>)times:(NSInteger)multiplier;
@end
#endif /* Expression_h */
|
Deadpikle/TDDbyE-Objective-C
|
TDDByExample/TDDByExample/Bank.h
|
//
// Bank.h
// TDDByExample
//
// Created by School of Computing Macbook on 1/1/17.
// Copyright © 2017 CIRC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Money.h"
#import "Expression.h"
@interface Bank : NSObject
-(Money*)reduce:(id<Expression>)expression toCurrency:(NSString*)currency;
-(NSInteger)getExchangeRateFromCurrency:(NSString*)fromCurrency toCurrency:(NSString*)toCurrency;
-(void)addCurrencyExchangeRateFrom:(NSString*)from toCurrency:(NSString*)to withRate:(NSInteger)rate;
@end
|
Deadpikle/TDDbyE-Objective-C
|
TDDByExample/TDDByExample/Sum.h
|
<gh_stars>0
//
// Sum.h
// TDDByExample
//
// Created by School of Computing Macbook on 1/1/17.
// Copyright © 2017 CIRC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Money.h"
#import "Expression.h"
@interface Sum : NSObject <Expression>
@property id<Expression> augend;
@property id<Expression> addend;
-(instancetype)initWithAugend:(id<Expression>)augend addend:(id<Expression>)addend;
@end
|
Deadpikle/TDDbyE-Objective-C
|
TDDByExample/TDDByExample/Money.h
|
//
// Money.h
// TDDByExample
//
// Created by Deadpikle on 7/31/16.
// Copyright © 2016 CIRC. All rights reserved.
//
// Benefits of instance variables over properties: http://stackoverflow.com/a/9086811/3938401
// I chose to use protected properties using a shared header because, syntacically,
// it is much cleaner. I don't want to use the -> in my Objective-C code!
// See: http://stackoverflow.com/q/11047351/3938401
#import <Foundation/Foundation.h>
#import "Expression.h"
@interface Money : NSObject <Expression>
@property int amount;
@property NSString *currencyType;
-(instancetype)initWithAmount:(int)amount currency:(NSString*)currency;
+(Money*)dollarWithAmount:(int)amount;
+(Money*)francWithAmount:(int)amount;
// The following functions should be implemented by all subclasses:
-(Money*)times:(int)multiplier;
-(NSString*)currency;
-(id<Expression>)plus:(id<Expression>)moneyToAdd;
@end
|
sunnygkp10/hhvm
|
hphp/runtime/ext_zend_compat/hhvm/zend-request-local.h
|
<reponame>sunnygkp10/hhvm
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2015 Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| <EMAIL> so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_ZEND_REQUEST_LOCAL
#define incl_HPHP_ZEND_REQUEST_LOCAL
#include "hphp/runtime/base/request-local.h"
#include <unordered_map>
#include <vector>
#include "hphp/runtime/base/request-event-handler.h"
namespace HPHP {
// a trick to allow us to parenthesize the type, so the macros
// don't get confused by the commas
namespace detail {
template<typename T> struct get_first_param;
template<typename P> struct get_first_param<void(P)> {
typedef P type;
};
}
#define ZEND_REQUEST_LOCAL_VECTOR(T, F, N, Z) \
IMPLEMENT_STATIC_REQUEST_LOCAL( \
HPHP::detail::get_first_param< \
void(HPHP::ZendRequestLocalVector<T, F>)>::type, N); \
typedef HPHP::ZendRequestLocalVector<T, F>::container Z
template <class T, class F>
struct ZendRequestLocalVector final : RequestEventHandler {
static_assert(std::is_pointer<T>::value,
"ZendRequestLocalVector only stores pointers");
using container = std::vector<T>;
void requestInit() override { clear(); }
void requestShutdown() override { clear(); }
container& get() { return m_container; }
private:
void clear() {
for (size_t i = 0; i < m_container.size(); ++i) {
if (m_container[i]) {
auto element = m_container[i];
m_container[i] = nullptr;
m_destroy_callback(element);
}
}
m_container.clear();
m_container.push_back(nullptr); // don't give out id 0
}
container m_container;
F m_destroy_callback;
};
#define ZEND_REQUEST_LOCAL_MAP(K, V, N) \
IMPLEMENT_STATIC_REQUEST_LOCAL( \
HPHP::detail::get_first_param< \
void(HPHP::ZendRequestLocalMap<K, V>)>::type, N)
template <class K, class V>
struct ZendRequestLocalMap final : RequestEventHandler {
typedef std::unordered_map<K, V> container;
void requestInit() override { m_map.clear(); }
void requestShutdown() override { m_map.clear(); }
container& get() { return m_map; }
private:
container m_map;
};
}
#endif // incl_HPHP_ZEND_REQUEST_LOCAL
|
sunnygkp10/hhvm
|
hphp/runtime/ext/stream/ext_stream.h
|
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2015 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| <EMAIL> so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_STREAM_H_
#define incl_HPHP_EXT_STREAM_H_
#include "hphp/runtime/ext/extension.h"
namespace HPHP {
const int64_t k_STREAM_CLIENT_CONNECT = 4;
const int64_t k_STREAM_CLIENT_ASYNC_CONNECT = 2;
const int64_t k_STREAM_CLIENT_PERSISTENT = 1;
const int64_t k_STREAM_META_TOUCH = 1;
const int64_t k_STREAM_META_OWNER_NAME = 2;
const int64_t k_STREAM_META_OWNER = 3;
const int64_t k_STREAM_META_GROUP_NAME = 4;
const int64_t k_STREAM_META_GROUP = 5;
const int64_t k_STREAM_META_ACCESS = 6;
const int64_t k_STREAM_BUFFER_NONE = 0; /* unbuffered */
const int64_t k_STREAM_BUFFER_LINE = 1; /* line buffered */
const int64_t k_STREAM_BUFFER_FULL = 2; /* fully buffered */
const int64_t k_STREAM_SERVER_BIND = 4;
const int64_t k_STREAM_SERVER_LISTEN = 8;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv23_CLIENT = 7;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv23_SERVER = 6;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv2_CLIENT = 3;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv2_SERVER = 2;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv3_CLIENT = 5;
const int64_t k_STREAM_CRYPTO_METHOD_SSLv3_SERVER = 4;
const int64_t k_STREAM_CRYPTO_METHOD_TLS_CLIENT = 57;
const int64_t k_STREAM_CRYPTO_METHOD_TLS_SERVER = 56;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT = 9;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_0_SERVER = 8;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT = 17;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_1_SERVER = 16;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT = 33;
const int64_t k_STREAM_CRYPTO_METHOD_TLSv1_2_SERVER = 32;
const int64_t k_STREAM_CRYPTO_METHOD_ANY_CLIENT = 63;
const int64_t k_STREAM_CRYPTO_METHOD_ANY_SERVER = 62;
const int64_t k_STREAM_ENFORCE_SAFE_MODE = 4;
const int64_t k_STREAM_IGNORE_URL = 2;
const int64_t k_STREAM_IPPROTO_ICMP = 1;
const int64_t k_STREAM_IPPROTO_IP = 0;
const int64_t k_STREAM_IPPROTO_RAW = 255;
const int64_t k_STREAM_IPPROTO_TCP = 6;
const int64_t k_STREAM_IPPROTO_UDP = 17;
const int64_t k_STREAM_IS_URL = 1;
const int64_t k_STREAM_MKDIR_RECURSIVE = 1;
const int64_t k_STREAM_MUST_SEEK = 16;
const int64_t k_STREAM_NOTIFY_AUTH_REQUIRED = 3;
const int64_t k_STREAM_NOTIFY_AUTH_RESULT = 10;
const int64_t k_STREAM_NOTIFY_COMPLETED = 8;
const int64_t k_STREAM_NOTIFY_CONNECT = 2;
const int64_t k_STREAM_NOTIFY_FAILURE = 9;
const int64_t k_STREAM_NOTIFY_FILE_SIZE_IS = 5;
const int64_t k_STREAM_NOTIFY_MIME_TYPE_IS = 4;
const int64_t k_STREAM_NOTIFY_PROGRESS = 7;
const int64_t k_STREAM_NOTIFY_REDIRECTED = 6;
const int64_t k_STREAM_NOTIFY_RESOLVE = 1;
const int64_t k_STREAM_NOTIFY_SEVERITY_ERR = 2;
const int64_t k_STREAM_NOTIFY_SEVERITY_INFO = 0;
const int64_t k_STREAM_NOTIFY_SEVERITY_WARN = 1;
const int64_t k_STREAM_OOB = 1;
const int64_t k_STREAM_PEEK = 2;
const int64_t k_STREAM_PF_INET = 2;
const int64_t k_STREAM_PF_INET6 = 10;
const int64_t k_STREAM_PF_UNIX = 1;
const int64_t k_STREAM_REPORT_ERRORS = 8;
const int64_t k_STREAM_SHUT_RD = 0;
const int64_t k_STREAM_SHUT_RDWR = 2;
const int64_t k_STREAM_SHUT_WR = 1;
const int64_t k_STREAM_SOCK_DGRAM = 2;
const int64_t k_STREAM_SOCK_RAW = 3;
const int64_t k_STREAM_SOCK_RDM = 4;
const int64_t k_STREAM_SOCK_SEQPACKET = 5;
const int64_t k_STREAM_SOCK_STREAM = 1;
const int64_t k_STREAM_URL_STAT_LINK = 1;
const int64_t k_STREAM_URL_STAT_QUIET = 2;
const int64_t k_STREAM_USE_PATH = 1;
///////////////////////////////////////////////////////////////////////////////
// stream context
struct StreamContext final : ResourceData {
DECLARE_RESOURCE_ALLOCATION_NO_SWEEP(StreamContext);
CLASSNAME_IS("stream-context")
const String& o_getClassNameHook() const override { return classnameof(); }
StreamContext(const Array& options, const Array& params)
: m_options(options), m_params(params) {
}
static bool validateOptions(const Variant& options);
void setOption(const String& wrapper, const String& option,
const Variant& value);
void mergeOptions(const Array& options);
Array getOptions() const;
static bool validateParams(const Variant& params);
void mergeParams(const Array& params);
Array getParams() const;
private:
static StaticString s_options_key;
static StaticString s_notification_key;
Array m_options;
Array m_params;
};
Variant HHVM_FUNCTION(stream_context_create,
const Variant& options = null_variant,
const Variant& params = null_variant);
Variant HHVM_FUNCTION(stream_context_get_options,
const Resource& stream_or_context);
bool HHVM_FUNCTION(stream_context_set_option,
const Variant& stream_or_context,
const Variant& wrapper,
const Variant& option = null_variant,
const Variant& value = null_variant);
Variant HHVM_FUNCTION(stream_context_get_default,
const Variant& options /* = null_variant */);
Variant HHVM_FUNCTION(stream_context_get_params,
const Resource& stream_or_context);
bool HHVM_FUNCTION(stream_context_set_params,
const Resource& stream_or_context,
const Array& params);
///////////////////////////////////////////////////////////////////////////////
Variant HHVM_FUNCTION(stream_copy_to_stream,
const Resource& source,
const Resource& dest,
int maxlength = -1,
int offset = 0);
Variant HHVM_FUNCTION(stream_get_contents,
const Resource& handle,
int maxlen = -1,
int offset = -1);
Variant HHVM_FUNCTION(stream_get_line,
const Resource& handle,
int length = 0,
const Variant& ending = null_variant);
Variant HHVM_FUNCTION(stream_get_meta_data,
const Resource& stream);
Array HHVM_FUNCTION(stream_get_transports);
Array HHVM_FUNCTION(stream_get_wrappers);
bool HHVM_FUNCTION(stream_is_local,
const Variant& stream_or_url);
bool HHVM_FUNCTION(stream_register_wrapper,
const String& protocol,
const String& classname,
int flags);
bool HHVM_FUNCTION(stream_wrapper_register,
const String& protocol,
const String& classname,
int flags);
bool HHVM_FUNCTION(stream_wrapper_restore,
const String& protocol);
bool HHVM_FUNCTION(stream_wrapper_unregister,
const String& protocol);
Variant HHVM_FUNCTION(stream_resolve_include_path,
const String& filename,
const Variant& context = null_variant);
Variant HHVM_FUNCTION(stream_select,
VRefParam read,
VRefParam write,
VRefParam except,
const Variant& vtv_sec,
int tv_usec = 0);
Object HHVM_FUNCTION(stream_await,
const Resource& stream,
int64_t events,
double timeout = 0.0);
bool HHVM_FUNCTION(stream_set_blocking,
const Resource& stream,
int mode);
bool HHVM_FUNCTION(stream_set_timeout,
const Resource& stream,
int seconds,
int microseconds = 0);
int64_t HHVM_FUNCTION(stream_set_write_buffer,
const Resource& stream,
int buffer);
int64_t HHVM_FUNCTION(set_file_buffer,
const Resource& stream,
int buffer);
///////////////////////////////////////////////////////////////////////////////
// stream sockets: ext_socket has better implementation of socket functions
Variant HHVM_FUNCTION(stream_socket_accept,
const Resource& server_socket,
double timeout = -1.0,
VRefParam peername = uninit_null());
Variant HHVM_FUNCTION(stream_socket_server,
const String& local_socket,
VRefParam errnum = uninit_null(),
VRefParam errstr = uninit_null(),
int flags = k_STREAM_SERVER_BIND|k_STREAM_SERVER_LISTEN,
const Variant& context = null_variant);
Variant HHVM_FUNCTION(stream_socket_client,
const String& remote_socket,
VRefParam errnum = uninit_null(),
VRefParam errstr = uninit_null(),
double timeout = -1.0,
int flags = 0,
const Variant& context = null_variant);
bool HHVM_FUNCTION(stream_socket_enable_crypto,
const Resource& socket,
bool enable,
int cryptotype,
const Variant& sessionstream);
Variant HHVM_FUNCTION(stream_socket_get_name,
const Resource& handle,
bool want_peer);
Variant HHVM_FUNCTION(stream_socket_pair,
int domain,
int type,
int protocol);
Variant HHVM_FUNCTION(stream_socket_recvfrom,
const Resource& socket,
int length,
int flags = 0,
VRefParam address = uninit_null());
Variant HHVM_FUNCTION(stream_socket_sendto,
const Resource& socket,
const String& data,
int flags = 0,
const Variant& address = null_variant);
bool HHVM_FUNCTION(stream_socket_shutdown,
const Resource& stream,
int how);
///////////////////////////////////////////////////////////////////////////////
}
#endif // incl_HPHP_EXT_STREAM_H_
|
sunnygkp10/hhvm
|
hphp/runtime/ext/libxml/ext_libxml.h
|
<gh_stars>1-10
/*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-2015 Facebook, Inc. (http://www.facebook.com) |
| Copyright (c) 1997-2010 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| <EMAIL> so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#ifndef incl_HPHP_EXT_LIBXML_H_
#define incl_HPHP_EXT_LIBXML_H_
#include "hphp/runtime/ext/extension.h"
#include <libxml/parser.h>
namespace HPHP {
///////////////////////////////////////////////////////////////////////////////
bool libxml_use_internal_error();
void libxml_add_error(const std::string& msg);
String libxml_get_valid_file_path(const String& source);
String libxml_get_valid_file_path(const char* source);
int libxml_streams_IO_read(void* context, char* buffer, int len);
int libxml_streams_IO_write(void* context, const char* buffer, int len);
int libxml_streams_IO_close(void* context);
int libxml_streams_IO_nop_close(void* context);
void php_libxml_node_free(xmlNodePtr node);
void php_libxml_node_free_resource(xmlNodePtr node);
bool HHVM_FUNCTION(libxml_disable_entity_loader, bool disable = true);
/*
* LibXML resource wrappers.
*
* Several extensions use libxml (DOMDocument, SimpleXML, ext_xsl) as their
* underlying representation of an XML DOM. Because these extensions share
* libxml data we use Resource wrappers to control destruction of libxml data.
*
* In addition to their req::ptr behavior these wrappers also serve as a
* cache for DOMNode objects that have been associated with particular xmlNodes
* and retain information about the owning document for each node.
*
* Unfortunately (read: Because, PHP), these wrappers will also sometimes serve
* as weak-references. In particular it is possible for (1) the cached
* DOMNode object to be free'd before the xmlNode*, in which case the DOMNode
* is responsible for clearing the cache, and (2) for the underlying xmlNode*
* to be free'd while there are still req::ptr holding XMLNodeData resouces.
*
* In the event of (1) the only reference to the free'd object will be the
* object in m_cache, and as such an raw ObjectData* is used as a quasi-weak
* pointer.
*
* In PHP, if the root of an orphaned sub-tree of a Document, or of an orphaned
* subtree with no associated document goes out of scope all of its descendants
* are freed. When this is done any live XMLNodeDatas remain valid, however,
* their xmlNode* pointers are cleared to indicate the bound node no longer
* exists.
*
* Any node properly connected to the root element of an xmlDoc* will remain
* valid until such time the the owning xmlDoc* becomes invalid or the node
* becomes orphaned from the root and its subtree is freed.
*
* Documents will remain valid until such time that there are no further
* references to nodes contained therein (including references to nodes whose
* underlying representation has been freed).
*
* The libxml_register_node() function will "Do the right thing" (tm) when
* given an xmlNodePtr. Specifically, if the node already has an associated
* XMLNodeData or XMLDocumnentData, that resource is attached- otherwise a new
* resource is created. Additionally, if a new resource is created for a node
* which itself is attached to a document with no associated resource, a
* resource will be created for that document.
*
* It is not necessary to cast xmlNode* to xmlDoc* before passing these pointers
* to libxml_register_node(), the type field will always be inspected before
* creating a new node resource.
*
* These resource classes are based on the PHP php_libxml_node_object
* (XMLNodeData), and php_libxml_ref_obj (XMLDocumentData). Rather than track
* these classes separately we track them as a single unified set of XMLNodeData
* resources.
*
* https://github.com/php/php-src/blob/master/ext/libxml/php_libxml.h
*/
struct XMLDocumentData;
struct XMLNodeData : SweepableResourceData {
DECLARE_RESOURCE_ALLOCATION(XMLNodeData)
explicit XMLNodeData(xmlNodePtr p);
virtual ~XMLNodeData();
ObjectData* getCache() const { return m_cache; }
void clearCache() { m_cache = nullptr; }
void setCache(ObjectData* o) { m_cache = o; }
void reset() { m_node = nullptr; }
void setDoc(req::ptr<XMLDocumentData>&& doc);
xmlDocPtr docp() const;
xmlNodePtr nodep() const { return m_node; }
req::ptr<XMLDocumentData> doc();
void unlink() { xmlUnlinkNode(m_node); }
private:
ObjectData* m_cache {nullptr}; // XXX: to avoid a cycle this is a weak ref
xmlNodePtr m_node {nullptr};
req::ptr<XMLDocumentData> m_doc {nullptr};
friend class XMLDocumentData;
};
struct XMLDocumentData : XMLNodeData {
DECLARE_RESOURCE_ALLOCATION(XMLDocumentData)
explicit XMLDocumentData(xmlDocPtr p)
: XMLNodeData((xmlNodePtr)p)
, m_formatoutput(false)
, m_validateonparse(false)
, m_resolveexternals(false)
, m_preservewhitespace(true)
, m_substituteentities(false)
, m_stricterror(true)
, m_recover(false)
, m_destruct(false)
{
assert(p->type == XML_HTML_DOCUMENT_NODE || p->type == XML_DOCUMENT_NODE);
}
xmlDocPtr docp() const { return (xmlDocPtr)m_node; }
void attachNode() { m_liveNodes++; }
void detachNode() {
assert(m_liveNodes);
if (!--m_liveNodes && m_destruct) cleanup();
}
void cleanup();
~XMLDocumentData() override { cleanup(); }
Array m_classmap;
uint32_t m_liveNodes {0};
unsigned m_formatoutput :1;
unsigned m_validateonparse :1;
unsigned m_resolveexternals :1;
unsigned m_preservewhitespace :1;
unsigned m_substituteentities :1;
unsigned m_stricterror :1;
unsigned m_recover :1;
unsigned m_destruct :1; // cleanup when last node de-registers
};
using XMLNode = req::ptr<XMLNodeData>;
inline XMLNode libxml_register_node(xmlNodePtr p) {
if (!p) return nullptr;
if (p->_private) {
return XMLNode(reinterpret_cast<XMLNodeData*>(p->_private));
}
if (p->type == XML_HTML_DOCUMENT_NODE ||
p->type == XML_DOCUMENT_NODE) {
assert(p->doc == (xmlDocPtr)p);
return req::make<XMLDocumentData>((xmlDocPtr)p);
}
return req::make<XMLNodeData>(p);
}
inline XMLNode libxml_register_node(xmlDocPtr p) {
return libxml_register_node((xmlNodePtr)p);
}
inline XMLNodeData::XMLNodeData(xmlNodePtr p) : m_node(p) {
assert(p && !p->_private);
m_node->_private = this;
if (p->doc && p != (xmlNodePtr)p->doc) {
m_doc = libxml_register_node((xmlNodePtr)p->doc)->doc();
m_doc->attachNode();
}
}
inline XMLNodeData::~XMLNodeData() {
if (m_node) {
assert(!m_cache && m_node->_private == this);
m_node->_private = nullptr;
php_libxml_node_free_resource(m_node);
}
if (m_doc) m_doc->detachNode();
}
inline void XMLNodeData::setDoc(req::ptr<XMLDocumentData>&& doc) {
if (m_doc) m_doc->detachNode();
if (doc) doc->attachNode();
m_doc = std::move(doc);
}
inline req::ptr<XMLDocumentData> XMLNodeData::doc() {
if (!m_node) return nullptr;
if (m_node->type == XML_HTML_DOCUMENT_NODE ||
m_node->type == XML_DOCUMENT_NODE) {
return req::ptr<XMLDocumentData>(static_cast<XMLDocumentData*>(this));
}
if (!m_doc) {
assert(!m_node->doc);
return nullptr;
}
assert(m_doc.get() == libxml_register_node((xmlNodePtr)m_node->doc).get());
return m_doc;
}
inline xmlDocPtr XMLNodeData::docp() const {
auto docData = const_cast<XMLNodeData*>(this)->doc();
return docData ? docData->docp() : nullptr;
}
#define LIBXML_SAVE_NOEMPTYTAG 1<<2
///////////////////////////////////////////////////////////////////////////////
}
#endif
|
starmuse/PROJBASEClasses
|
PROJBASEClasses/Classes/BaseTableViewController/PROJBaseTableViewHeaderFooterView.h
|
<reponame>starmuse/PROJBASEClasses
//
// PROJBaseTableViewHeaderFooterView.h
// PROJProjectA
//
// Created by 1 on 10/1/20.
// Copyright © 2020 hausinTec. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PROJTableViewModel.h"
NS_ASSUME_NONNULL_BEGIN
///--------------------------------------------
/// @name PROJBaseTableViewHeaderFooterView
///--------------------------------------------
@interface PROJBaseTableViewHeaderFooterView : UITableViewHeaderFooterView
@property (nonatomic, assign) NSInteger proj_section;
@property (nonatomic, strong) __kindof PROJTableViewSectionHeaderFooterModel *proj_headerFooterModel;
@property (nonatomic, weak) id delegate;
@end
NS_ASSUME_NONNULL_END
|
starmuse/PROJBASEClasses
|
PROJBASEClasses/Classes/BaseTableViewController/PROJBaseTableViewCell.h
|
//
// PROJBaseTableViewCell.h
// PROJProjectA
//
// Created by 1 on 10/1/20.
// Copyright © 2020 hausinTec. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PROJTableViewModel.h"
NS_ASSUME_NONNULL_BEGIN
///--------------------------------------------
/// @name PROJBaseTableViewCell
///--------------------------------------------
@interface PROJBaseTableViewCell : UITableViewCell
@property (nonatomic, strong) NSIndexPath *proj_indexPath;// 当前 cell 所处的 indexPath
@property (nonatomic, strong) __kindof PROJTableViewCellModel *proj_cellModel;// 持有一个 PROJTableViewCellModel 类型的 cellModel
@property (nonatomic, weak) id delegate;// 由子类覆写,已经交由tableviewcontroller
- (void)override_configSubviews;
@end
NS_ASSUME_NONNULL_END
|
starmuse/PROJBASEClasses
|
PROJBASEClasses/Classes/BaseTableViewController/PROJBaseTableViewController.h
|
//
// PROJBaseTableViewController.h
// PROJProjectA
//
// Created by 1 on 10/1/20.
// Copyright © 2020 hausinTec. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "PROJBaseViewController.h"
#import "PROJTableViewModel.h"
#import "PROJBaseTableViewHeaderFooterView.h"
#import "PROJBaseTableViewCell.h"
NS_ASSUME_NONNULL_BEGIN
///--------------------------------------------
/// @name PROJBaseTableViewControllerDataSource
///--------------------------------------------
@protocol PROJBaseTableViewControllerDataSource <NSObject>
@required
- (NSArray<NSString *> *)proj_classesRegistionForCells;// 提供 tableview 所需要的所有 cell 类型数组
- (__kindof PROJTableViewModel *)proj_tableViewModelForTableViewController;// 提供 tableview 所有要的 tableviewmodel.
@optional
- (UITableViewStyle)proj_tableViewStyle;
- (NSArray<NSString *> *)proj_classesRegistionForSectionHeader;
- (NSArray<NSString *> *)proj_classesRegistionForSectionFooter;
- (CGFloat)proj_estimatedHeightForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(7.0));
- (CGFloat)proj_estimatedHeightForHeaderInSection:(NSInteger)section API_AVAILABLE(ios(7.0));
- (CGFloat)proj_estimatedHeightForFooterInSection:(NSInteger)section API_AVAILABLE(ios(7.0));
@end
///--------------------------------------------
/// @name PROJBaseTableViewControllerDelegate
///--------------------------------------------
@protocol PROJBaseTableViewControllerDelegate <NSObject>
@end
///--------------------------------------------
/// @name PROJBaseTableViewController
///--------------------------------------------
@interface PROJBaseTableViewController : PROJBaseViewController
<UITableViewDelegate, UITableViewDataSource, UITableViewDataSourcePrefetching,
PROJBaseTableViewControllerDataSource, PROJBaseTableViewControllerDelegate>
@property (nonatomic, strong) UITableView *tableView;
@end
NS_ASSUME_NONNULL_END
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.