summaryrefslogtreecommitdiffstats
path: root/arm-wt-22k
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:41 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-22 00:13:41 -0800
commit129d62c5566a136d7f2fb53a3d7c8a7eb447a4f1 (patch)
tree92fc8a59b6c28dcd0291323c816e726b9e7fc522 /arm-wt-22k
parent5257e139e49727f9eaab95f4f9390f629ccfe06d (diff)
downloadandroid_external_sonivox-129d62c5566a136d7f2fb53a3d7c8a7eb447a4f1.zip
android_external_sonivox-129d62c5566a136d7f2fb53a3d7c8a7eb447a4f1.tar.gz
android_external_sonivox-129d62c5566a136d7f2fb53a3d7c8a7eb447a4f1.tar.bz2
auto import from //branches/cupcake/...@127436
Diffstat (limited to 'arm-wt-22k')
-rw-r--r--arm-wt-22k/host_src/jet.h35
-rw-r--r--arm-wt-22k/lib_src/eas_midi.c12
-rw-r--r--arm-wt-22k/lib_src/jet.c107
-rw-r--r--arm-wt-22k/lib_src/jet_data.h6
4 files changed, 108 insertions, 52 deletions
diff --git a/arm-wt-22k/host_src/jet.h b/arm-wt-22k/host_src/jet.h
index fb83ec6..b5bce00 100644
--- a/arm-wt-22k/host_src/jet.h
+++ b/arm-wt-22k/host_src/jet.h
@@ -7,18 +7,18 @@
* Public interface for JET sound engine
*
* Copyright (c) 2006 Sonic Network Inc.
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*----------------------------------------------------------------------------
* Revision Control:
* $Revision: 554 $
@@ -52,6 +52,9 @@ typedef struct s_jet_status_tag
EAS_INT segmentRepeatCount;
EAS_INT numQueuedSegments;
EAS_BOOL paused;
+ EAS_I32 location;
+ EAS_U8 currentPlayingSegment;
+ EAS_U8 currentQueuedSegment;
} S_JET_STATUS;
typedef struct s_jet_event_tag
@@ -179,6 +182,14 @@ EAS_PUBLIC EAS_RESULT JET_SetMuteFlag (EAS_DATA_HANDLE easHandle, EAS_INT trackN
*/
EAS_PUBLIC EAS_RESULT JET_TriggerClip (EAS_DATA_HANDLE easHandle, EAS_INT clipID);
+/*----------------------------------------------------------------------------
+ * JET_Clear_Queue()
+ *----------------------------------------------------------------------------
+ * Clears all segments in the queue
+ *----------------------------------------------------------------------------
+*/
+EAS_PUBLIC EAS_RESULT JET_Clear_Queue (EAS_DATA_HANDLE easHandle);
+
#ifdef __cplusplus
} /* end extern "C" */
#endif
diff --git a/arm-wt-22k/lib_src/eas_midi.c b/arm-wt-22k/lib_src/eas_midi.c
index 08aed72..0c77aea 100644
--- a/arm-wt-22k/lib_src/eas_midi.c
+++ b/arm-wt-22k/lib_src/eas_midi.c
@@ -239,7 +239,7 @@ static EAS_RESULT ProcessMIDIMessage (S_EAS_DATA *pEASData, S_SYNTH *pSynth, S_M
case 0x80:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"NoteOff: %02x %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1, pMIDIStream->d2); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMStopNote(pEASData->pVoiceMgr, pSynth, channel, pMIDIStream->d1, pMIDIStream->d2);
break;
@@ -256,7 +256,7 @@ static EAS_RESULT ProcessMIDIMessage (S_EAS_DATA *pEASData, S_SYNTH *pSynth, S_M
{
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"NoteOff: %02x %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1, pMIDIStream->d2); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMStopNote(pEASData->pVoiceMgr, pSynth, channel, pMIDIStream->d1, pMIDIStream->d2);
}
break;
@@ -269,7 +269,7 @@ static EAS_RESULT ProcessMIDIMessage (S_EAS_DATA *pEASData, S_SYNTH *pSynth, S_M
case 0xb0:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"Control: %02x %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1, pMIDIStream->d2); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMControlChange(pEASData->pVoiceMgr, pSynth, channel, pMIDIStream->d1, pMIDIStream->d2);
#ifdef JET_INTERFACE
if (pMIDIStream->jetData & MIDI_FLAGS_JET_CB)
@@ -283,21 +283,21 @@ static EAS_RESULT ProcessMIDIMessage (S_EAS_DATA *pEASData, S_SYNTH *pSynth, S_M
case 0xc0:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"Program: %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMProgramChange(pEASData->pVoiceMgr, pSynth, channel, pMIDIStream->d1);
break;
case 0xd0:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"ChanPres: %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMChannelPressure(pSynth, channel, pMIDIStream->d1);
break;
case 0xe0:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_DETAIL,"PBend: %02x %02x %02x\n",
pMIDIStream->status, pMIDIStream->d1, pMIDIStream->d2); */ }
- if (parserMode < eParserModeMute)
+ if (parserMode <= eParserModeMute)
VMPitchBend(pSynth, channel, pMIDIStream->d1, pMIDIStream->d2);
break;
diff --git a/arm-wt-22k/lib_src/jet.c b/arm-wt-22k/lib_src/jet.c
index 864ee24..bcb4e5e 100644
--- a/arm-wt-22k/lib_src/jet.c
+++ b/arm-wt-22k/lib_src/jet.c
@@ -7,18 +7,18 @@
* Implementation for JET sound engine
*
* Copyright (c) 2006 Sonic Network Inc.
-
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*----------------------------------------------------------------------------
* Revision Control:
* $Revision: 563 $
@@ -548,6 +548,18 @@ EAS_PUBLIC EAS_RESULT JET_Status (EAS_DATA_HANDLE easHandle, S_JET_STATUS *pStat
pStatus->paused = !(easHandle->jetHandle->flags & JET_FLAGS_PLAYING);
pStatus->numQueuedSegments = easHandle->jetHandle->numQueuedSegments;
+ pStatus->currentPlayingSegment = easHandle->jetHandle->playSegment;
+ pStatus->currentQueuedSegment = easHandle->jetHandle->queueSegment;
+ if (pSeg->streamHandle != NULL)
+ {
+ EAS_RESULT result;
+ EAS_I32 location ;
+ if ((result = EAS_GetLocation(easHandle, pSeg->streamHandle, &location)) == EAS_SUCCESS)
+ if(location != 0)
+ {
+ pStatus->location = location;
+ }
+ }
return EAS_SUCCESS;
}
@@ -621,8 +633,8 @@ EAS_PUBLIC EAS_RESULT JET_QueueSegment (EAS_DATA_HANDLE easHandle, EAS_INT segme
return result;
p->state = JET_STATE_OPEN;
- /* if less than 3 segments queued up, prepare file for playback */
- if (++easHandle->jetHandle->numQueuedSegments < 3)
+ /* if less than SEG_QUEUE_DEPTH segments queued up, prepare file for playback */
+ if (++easHandle->jetHandle->numQueuedSegments < SEG_QUEUE_DEPTH)
{
result = JET_PrepareSegment(easHandle, easHandle->jetHandle->queueSegment);
if (result != EAS_SUCCESS)
@@ -739,14 +751,6 @@ EAS_PUBLIC EAS_RESULT JET_SetMuteFlags (EAS_DATA_HANDLE easHandle, EAS_U32 muteF
return EAS_IntSetStrmParam(easHandle, pSeg->streamHandle, PARSER_DATA_MUTE_FLAGS, (EAS_I32) muteFlags);
}
- /* if this segment is not repeating, use next segment */
- if (pSeg->repeatCount == 0)
- {
- EAS_INT index;
- index = JET_NextSegment(easHandle->jetHandle->playSegment);
- pSeg = &easHandle->jetHandle->segQueue[index];
- sync = EAS_FALSE;
- }
/* check for valid stream state */
if (pSeg->state == JET_STATE_CLOSED)
@@ -793,13 +797,6 @@ EAS_PUBLIC EAS_RESULT JET_SetMuteFlag (EAS_DATA_HANDLE easHandle, EAS_INT trackN
return EAS_IntSetStrmParam(easHandle, pSeg->streamHandle, PARSER_DATA_MUTE_FLAGS, (EAS_I32) pSeg->muteFlags);
}
- /* if this segment is not repeating, use next segment */
- if (pSeg->repeatCount == 0)
- {
- EAS_INT index;
- index = JET_NextSegment(easHandle->jetHandle->playSegment);
- pSeg = &easHandle->jetHandle->segQueue[index];
- }
/* check for valid stream state */
if (pSeg->state == JET_STATE_CLOSED)
@@ -976,6 +973,9 @@ EAS_PUBLIC EAS_RESULT JET_Process (EAS_DATA_HANDLE easHandle)
prepareNextSegment = EAS_FALSE;
}
break;
+
+ case JET_STATE_PAUSED:
+ break;
default:
{ /* dpp: EAS_ReportEx(_EAS_SEVERITY_ERROR, "JET_Render: Unexpected segment state %d\n", pSeg->state); */ }
@@ -1026,7 +1026,7 @@ void JET_Event (EAS_DATA_HANDLE easHandle, EAS_U32 segTrack, EAS_U8 channel, EAS
muteFlag = 1 << ((segTrack & JET_EVENT_TRACK_MASK) >> JET_EVENT_TRACK_SHIFT);
/* un-mute the track */
- if (easHandle->jetHandle->muteQueue[i] & JET_CLIP_TRIGGER_FLAG)
+ if ((easHandle->jetHandle->muteQueue[i] & JET_CLIP_TRIGGER_FLAG) && ((value & 0x40) > 0))
{
pSeg->muteFlags &= ~muteFlag;
easHandle->jetHandle->muteQueue[i] &= ~JET_CLIP_TRIGGER_FLAG;
@@ -1035,8 +1035,11 @@ void JET_Event (EAS_DATA_HANDLE easHandle, EAS_U32 segTrack, EAS_U8 channel, EAS
/* mute the track */
else
{
+ EAS_U32 beforeMute ;
+ beforeMute = pSeg->muteFlags ;
pSeg->muteFlags |= muteFlag;
- easHandle->jetHandle->muteQueue[i] = 0;
+ if (beforeMute != pSeg->muteFlags)
+ easHandle->jetHandle->muteQueue[i] = 0;
}
EAS_IntSetStrmParam(easHandle, pSeg->streamHandle, PARSER_DATA_MUTE_FLAGS, (EAS_I32) pSeg->muteFlags);
return;
@@ -1078,3 +1081,45 @@ void JET_Event (EAS_DATA_HANDLE easHandle, EAS_U32 segTrack, EAS_U8 channel, EAS
}
}
+/*----------------------------------------------------------------------------
+ * JET_Clear_Queue()
+ *----------------------------------------------------------------------------
+ * Clears the queue and stops play without a complete shutdown
+ *----------------------------------------------------------------------------
+*/
+EAS_RESULT JET_Clear_Queue(EAS_DATA_HANDLE easHandle)
+{
+ EAS_INT index;
+ EAS_RESULT result = EAS_SUCCESS;
+
+ { /* dpp: EAS_ReportEx(_EAS_SEVERITY_INFO, "JET_Clear_Queue\n"); */ }
+
+ /* pause all playing streams */
+ for (index = 0; index < SEG_QUEUE_DEPTH; index++)
+ {
+ if (easHandle->jetHandle->segQueue[index].state == JET_STATE_PLAYING)
+ {
+ result = EAS_Pause(easHandle, easHandle->jetHandle->segQueue[index].streamHandle);
+ if (result != EAS_SUCCESS)
+ return result;
+
+ easHandle->jetHandle->segQueue[index].state = JET_STATE_PAUSED;
+ }
+ }
+
+ /* close all streams */
+ for (index = 0; index < SEG_QUEUE_DEPTH; index++)
+ {
+ if (easHandle->jetHandle->segQueue[index].streamHandle != NULL)
+ {
+ result = JET_CloseSegment(easHandle, index);
+ if (result != EAS_SUCCESS)
+ return result;
+ }
+ }
+
+ easHandle->jetHandle->flags &= ~JET_FLAGS_PLAYING;
+ easHandle->jetHandle->playSegment = easHandle->jetHandle->queueSegment = 0;
+ return result;
+}
+
diff --git a/arm-wt-22k/lib_src/jet_data.h b/arm-wt-22k/lib_src/jet_data.h
index bdfe452..7174950 100644
--- a/arm-wt-22k/lib_src/jet_data.h
+++ b/arm-wt-22k/lib_src/jet_data.h
@@ -44,17 +44,17 @@
/* maximum number of JET events in internal queue */
#ifndef JET_EVENT_QUEUE_SIZE
-#define JET_EVENT_QUEUE_SIZE 8
+#define JET_EVENT_QUEUE_SIZE 32
#endif
/* maximum number of JET events in application queue */
#ifndef APP_EVENT_QUEUE_SIZE
-#define APP_EVENT_QUEUE_SIZE 8
+#define APP_EVENT_QUEUE_SIZE 32
#endif
/* maximum number of active mute events */
#ifndef JET_MUTE_QUEUE_SIZE
-#define JET_MUTE_QUEUE_SIZE 4
+#define JET_MUTE_QUEUE_SIZE 8
#endif
/*----------------------------------------------------------------------------