mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Delete unused code in DSoundStream, fix system_getpropertyint for iOS
This commit is contained in:
1 parent
2b50996a85
commit
51f352ee26
3 files changed
+17
-30
No files matched your search
@@ -13,19 +13,18 @@ public:
|
||||
DSoundState(HWND window, StreamCallback _callback, int sampleRate);
|
||||
bool Init(); // If fails, can safely delete the object
|
||||
|
||||
bool createBuffer();
|
||||
bool writeDataToBuffer(DWORD dwOffset, // Our own write cursor.
|
||||
char* soundData, // Start of our data.
|
||||
DWORD dwSoundBytes); // Size of block to copy.
|
||||
|
||||
inline int ModBufferSize(int x) { return (x + bufferSize) % bufferSize; }
|
||||
int RunThread();
|
||||
void UpdateSound();
|
||||
void StopSound();
|
||||
int GetCurSample();
|
||||
int GetSampleRate() { return sampleRate; }
|
||||
|
||||
private:
|
||||
bool CreateBuffer();
|
||||
bool WriteDataToBuffer(DWORD dwOffset, // Our own write cursor.
|
||||
char* soundData, // Start of our data.
|
||||
DWORD dwSoundBytes); // Size of block to copy.
|
||||
|
||||
CRITICAL_SECTION soundCriticalSection;
|
||||
HWND window_;
|
||||
HANDLE soundSyncEvent = NULL;
|
||||
@@ -62,7 +61,7 @@ int DSound_GetSampleRate() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DSoundState::createBuffer() {
|
||||
bool DSoundState::CreateBuffer() {
|
||||
PCMWAVEFORMAT pcmwf;
|
||||
DSBUFFERDESC dsbdesc;
|
||||
|
||||
@@ -92,7 +91,7 @@ bool DSoundState::createBuffer() {
|
||||
}
|
||||
}
|
||||
|
||||
bool DSoundState::writeDataToBuffer(DWORD dwOffset, // Our own write cursor.
|
||||
bool DSoundState::WriteDataToBuffer(DWORD dwOffset, // Our own write cursor.
|
||||
char* soundData, // Start of our data.
|
||||
DWORD dwSoundBytes) { // Size of block to copy.
|
||||
void *ptr1, *ptr2;
|
||||
@@ -149,7 +148,7 @@ int DSoundState::RunThread() {
|
||||
//We need to copy the full buffer, regardless of what the mixer claims to have filled
|
||||
//If we don't do this then the sound will loop if the sound stops and the mixer writes only zeroes
|
||||
numBytesRendered = numBytesToRender;
|
||||
writeDataToBuffer(lastPos, (char *) realtimeBuffer, numBytesRendered);
|
||||
WriteDataToBuffer(lastPos, (char *) realtimeBuffer, numBytesRendered);
|
||||
|
||||
currentPos = ModBufferSize(lastPos + numBytesRendered);
|
||||
totalRenderedBytes += numBytesRendered;
|
||||
@@ -184,7 +183,7 @@ bool DSoundState::Init() {
|
||||
}
|
||||
|
||||
ds->SetCooperativeLevel(window_, DSSCL_PRIORITY);
|
||||
if (!createBuffer())
|
||||
if (!CreateBuffer())
|
||||
return false;
|
||||
|
||||
DWORD num1;
|
||||
@@ -239,15 +238,6 @@ void DSoundState::StopSound() {
|
||||
DeleteCriticalSection(&soundCriticalSection);
|
||||
}
|
||||
|
||||
int DSoundState::GetCurSample() {
|
||||
EnterCriticalSection(&soundCriticalSection);
|
||||
int playCursor;
|
||||
dsBuffer->GetCurrentPosition((DWORD *)&playCursor,0);
|
||||
playCursor = ModBufferSize(playCursor-lastPos)+totalRenderedBytes;
|
||||
LeaveCriticalSection(&soundCriticalSection);
|
||||
return playCursor;
|
||||
}
|
||||
|
||||
void DSound_UpdateSound() {
|
||||
if (g_dsound) {
|
||||
g_dsound->UpdateSound();
|
||||
@@ -269,11 +259,3 @@ void DSound_StopSound() {
|
||||
delete g_dsound;
|
||||
g_dsound = NULL;
|
||||
}
|
||||
|
||||
int DSound_GetCurSample() {
|
||||
return g_dsound->GetCurSample();
|
||||
}
|
||||
|
||||
float DSound_GetTimer() {
|
||||
return (float)g_dsound->GetCurSample()*(1.0f/(4.0f*44100.0f));
|
||||
}
|
||||
@@ -9,8 +9,6 @@ bool DSound_StartSound(HWND window, StreamCallback _callback, int sampleRate);
|
||||
void DSound_UpdateSound();
|
||||
void DSound_StopSound();
|
||||
|
||||
float DSound_GetTimer();
|
||||
int DSound_GetCurSample();
|
||||
int DSound_GetSampleRate();
|
||||
|
||||
#endif //__SOUNDSTREAM_H__
|
||||
+8
-1
@@ -22,7 +22,14 @@ std::string System_GetProperty(SystemProperty prop) {
|
||||
}
|
||||
}
|
||||
|
||||
int System_GetPropertyInt(SystemProperty prop) { return -1; }
|
||||
int System_GetPropertyInt(SystemProperty prop) {
|
||||
switch (prop) {
|
||||
case SYSPROP_AUDIO_SAMPLE_RATE:
|
||||
return 44100;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void System_SendMessage(const char *command, const char *parameter) {
|
||||
if (!strcmp(command, "finish")) {
|
||||
|
||||
Reference in new issue
Block a user