Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into test-merge
Browse files Browse the repository at this point in the history
  • Loading branch information
nomadalex committed May 20, 2012
2 parents 2fc39ee + b081777 commit 7953100
Show file tree
Hide file tree
Showing 116 changed files with 2,881 additions and 2,028 deletions.
497 changes: 250 additions & 247 deletions CMakeLists.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion coolaudio/LSAudioDeleCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef struct core_audio_play_tag{
fd_iseof iseof;
fd_ispaused ispaused;
fd_destroy destroy;
// 专用内部参数
// רÓÃÄÚ²¿²ÎÊý
AVAudioPlayer *player;
int playcount;
int autostop;
Expand Down
46 changes: 23 additions & 23 deletions coolaudio/audio_interface.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* 本文件定义了audio的公共接口
/*
* 本文件定义了audio的公共接口
*/

#ifndef AUDIO_INTERFACE_H_
Expand All @@ -13,79 +13,79 @@

struct audio_play;
/**
*从文件加载一个audio文件到内存
*从文件加载一个audio文件到内存
*/
typedef int (*fd_load) (struct audio_play* This,const char* filename);
/**
*从内存加载一个audio文件到内存
*从内存加载一个audio文件到内存
*/
typedef int (*fd_load_buf) (struct audio_play* This,const char* buf,int size);
/**
*从文件指针加载一个audio文件到内存
*从文件指针加载一个audio文件到内存
*/
typedef int (*fd_load_fp) (struct audio_play* This,int handle,char closed_by_me);

/**
*播放一个声音
*times=0为循环播放,time=n就播放几次,播放完成后
*处于末尾(eof()==true)并等待(不释放内存,可以再次调用rewind到开头或者seek到某个开始处然后play播放,或者调用stop释放内存),
*free_when_stop是播放完毕后是否释放内存(这个主要是用于播放音效使用)。
*播放一个声音
*times=0为循环播放,time=n就播放几次,播放完成后
*处于末尾(eof()==true)并等待(不释放内存,可以再次调用rewind到开头或者seek到某个开始处然后play播放,或者调用stop释放内存),
*free_when_stop是播放完毕后是否释放内存(这个主要是用于播放音效使用)。
*/
typedef int (*fd_play) (struct audio_play* This,int times,int free_when_stop);
/**
* 播放的简化版,等价于fd_play(This,1,1),用于播放音效;
* 播放的简化版,等价于fd_play(This,1,1),用于播放音效;
*/
typedef int (*fd_playstop) (struct audio_play* This);

/**
暂停播放一个声音,用resume可以恢复。
暂停播放一个声音,用resume可以恢复。
*/
typedef void (*fd_pause) (struct audio_play* This);

/**
停止声音并释放内存和资源。只有再次load才能重新加载声音。
停止声音并释放内存和资源。只有再次load才能重新加载声音。
*/
typedef int (*fd_stop) (struct audio_play* This);

/**
恢复播放一个pause的声音。
恢复播放一个pause的声音。
*/
typedef void (*fd_resume)(struct audio_play* This);

/**
设置音量
设置音量
*/
typedef int (*fd_volume) (struct audio_play* This,int volume);

/**
回到声音开头。同于seek(this,0,SEEK_BEGIN);
回到声音开头。同于seek(this,0,SEEK_BEGIN);
*/
typedef void (*fd_rewind)(struct audio_play* This);

/**
ms,相对于flag的时间单位为ms,flag是Begin,end,例如:
seek(this,0,Begin);就是回到开头,等价于rewind。
ms,相对于flag的时间单位为ms,flag是Begin,end,例如:
seek(this,0,Begin);就是回到开头,等价于rewind。
*/
typedef void (*fd_seek) (struct audio_play* This,int ms,int flag);

/**
判定函数:是否到达声音尾部
判定函数:是否到达声音尾部
*/
typedef int (*fd_iseof) (struct audio_play* This);
/**
判定函数:是否暂停:
判定函数:是否暂停:
*/
typedef int (*fd_ispaused)(struct audio_play* This);

/**
释放函数,释放这个播放器的公有资源
包括player本身.以后此player不能再使用了,
player变为一个无效指针,要再使用必须重新create
释放函数,释放这个播放器的公有资源
包括player本身.以后此player不能再使用了,
player变为一个无效指针,要再使用必须重新create
*/
typedef int (*fd_destroy)(struct audio_play* This);

/*
* 外部接口.
* 外部接口.
*/
typedef struct audio_play{
fd_load load;
Expand Down
60 changes: 30 additions & 30 deletions coolaudio/nge_io_mem.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,55 +14,55 @@
extern "C"{
#endif
/**
*打开MEM,注意确保MEM有效
*@param const char*,mem指针
*打开MEM,注意确保MEM有效
*@param const char*,mem指针
*@param int,size
*@param int,打开标志(IO_RDONLY,IO_WRONLY,IO_APPEND的一种)
*@return int,文件句柄,读写均用此文件句柄进行操作
*@param int,打开标志(IO_RDONLY,IO_WRONLY,IO_APPEND的一种)
*@return int,文件句柄,读写均用此文件句柄进行操作
*/
int io_mopen(const char* mem,int size,int flag);
/**
*读MEM文件,与fread类似
*@param void*,保存读取数据的缓存
*@param int,读取个数
*@param int,读取大小
*@param int,文件句柄
*@return,实际读取数量
*读MEM文件,与fread类似
*@param void*,保存读取数据的缓存
*@param int,读取个数
*@param int,读取大小
*@param int,文件句柄
*@return,实际读取数量
*/
int io_mread(void* buffer,int count,int size,int handle);
/**
*写MEM文件,与fwrite类似
*@param void*,待写数据的缓存
*@param int,待写块个数
*@param int,待写块大小
*@param int,文件句柄
*@return,实际写入数量
*写MEM文件,与fwrite类似
*@param void*,待写数据的缓存
*@param int,待写块个数
*@param int,待写块大小
*@param int,文件句柄
*@return,实际写入数量
*/
int io_mwrite(void* buffer,int count,int size,int handle);
/**
*文件指针偏移设置,与fseek类似
*@param int,文件句柄
*@param int offset,偏移量
*@param int flag,seek标志,IO_SEEK_CUR,IO_SEEK_END,IO_SEEK_SET
*@return int,返回0成功,-1失败
*文件指针偏移设置,与fseek类似
*@param int,文件句柄
*@param int offset,偏移量
*@param int flag,seek标志,IO_SEEK_CUR,IO_SEEK_END,IO_SEEK_SET
*@return int,返回0成功,-1失败
*/
int io_mseek(int handle,int offset,int flag);
/**
*获得当前文件偏移值
*@param int handle,文件句柄
*@return int,文件偏移值
*获得当前文件偏移值
*@param int handle,文件句柄
*@return int,文件偏移值
*/
int io_mtell(int handle);
/**
*关闭MEM文件
*@param int handle,文件句柄
*@return int,-1失败
*关闭MEM文件
*@param int handle,文件句柄
*@return int,-1失败
*/
int io_mclose(int handle);
/**
*MEM size大小
*@param int handle,文件句柄
*@return int,MEM size大小
*MEM size大小
*@param int handle,文件句柄
*@return int,MEM size大小
*/
int io_msize(int handle);

Expand Down
2 changes: 1 addition & 1 deletion dirent/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ set(DIRENT_SRCS

add_addon_srcs(NGE2_SRCS DIRENT_SRCS dirent)

install(FILES nge_dirent.hpp nge_ch_io_dir.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(FILES dirent/nge_dirent.hpp dirent/nge_ch_io_dir.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
27 changes: 15 additions & 12 deletions dirent/nge_dirent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void NGEDirent::sortDirentByModityTime()
sort( vec.begin(),vec.end(),DIRComparatorByModityTime());
}
//////////////////////////////////////////////////////////////////////////
//for win32 采用nge_io_dir修改
//for win32 采用nge_io_dir修改
//////////////////////////////////////////////////////////////////////////

#ifdef WIN32
Expand Down Expand Up @@ -117,7 +117,7 @@ static void st_GetProperty(dir_desc_p dir_entry,const char* path)
{
HANDLE hFile;
//*********************************************
//[获取文件和文件夹属性]
//[获取文件和文件夹属性]
hFile = CreateFile(path,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,NULL,
Expand All @@ -133,7 +133,7 @@ static void st_GetProperty(dir_desc_p dir_entry,const char* path)

GetFileTime(hFile, &ftCreate, &ftAccess, &ftModify);

//创建时间
//创建时间
FileTimeToLocalFileTime(&ftCreate, &ftLocal);
FileTimeToSystemTime(&ftLocal, &sysTime);

Expand All @@ -145,7 +145,7 @@ static void st_GetProperty(dir_desc_p dir_entry,const char* path)
dir_entry->ctime.min=sysTime.wMinute;
dir_entry->ctime.sec=sysTime.wSecond;

//修改时间
//修改时间
FileTimeToLocalFileTime(&ftModify, &ftLocal);
FileTimeToSystemTime(&ftLocal, &sysTime);

Expand All @@ -161,7 +161,7 @@ static void st_GetProperty(dir_desc_p dir_entry,const char* path)
}
else
{
//创建时间
//创建时间
dir_entry->ctime.year=0;
dir_entry->ctime.month=0;
dir_entry->ctime.day=0;
Expand All @@ -170,7 +170,7 @@ static void st_GetProperty(dir_desc_p dir_entry,const char* path)
dir_entry->ctime.min=0;
dir_entry->ctime.sec=0;

//修改时间
//修改时间
dir_entry->mtime.year=0;
dir_entry->mtime.month=0;
dir_entry->mtime.day=0;
Expand Down Expand Up @@ -237,7 +237,7 @@ static BOOL st_FindCloseFile(HANDLE handle )

int NGEDirent::openDirent(string directory,vector<DIR> &vec)
{
//等待重写
//等待重写
return 1;
}
int NGEDirent::openDirent(string directory)
Expand Down Expand Up @@ -300,7 +300,7 @@ int NGEDirent::openDirent(string directory)

int NGEDirent::openDeepDirent(string directory)
{
//等待重写
//等待重写
return 1;
}

Expand All @@ -324,14 +324,15 @@ NGEDirent::~NGEDirent()

#elif defined _PSP
#include <pspkernel.h>
#include <string.h>
#include "fat.h"
#include "directory.h"
#include "miniconv.h"
#include "nge_charsets.h"

NGEDirent::NGEDirent()
{
//初始化
//初始化
fat_init(sceKernelDevkitVersion());
}

Expand All @@ -350,10 +351,11 @@ int NGEDirent::openDirent(string directory,vector<DIR> &vec)

int NGEDirent::openDirent(string directory)
{
//保存当前工作目录 getcwd()
//保存当前工作目录 getcwd()
currentPath=directory;

char spath[256];
char buff[1024];

directory_item_struct* dirItems = NULL;

Expand All @@ -378,9 +380,10 @@ int NGEDirent::openDirent(string directory)
string shortFullPath=shortpath+dirItems[i].shortname;

//[longname] UTF-8->
charsets_utf8_conv( (const uint8 *) (dirItems[i].longname), (uint8 *) dirItems[i].longname);
nge_charsets_utf8_to_gbk((const uint8*)(dirItems[i].longname), (uint8*)buff, strlen(dirItems[i].longname), 1024);
strcpy((char*)dirItems[i].longname, (const char*)buff);

//创建 修改时间
//创建 修改时间
file_time ctime;
file_time mtime;
ctime.year=(dirItems[i].cdate >> 9) + 1980;
Expand Down
Loading

0 comments on commit 7953100

Please sign in to comment.